예스스탁
예스스탁 답변
2023-10-16 14:04:30
안녕하세요
예스스탁입니다.
진입봉에서 50틱 손실시 청산이므로
onclose타입은 진입이 아닌 것으로 보고 작성해 드립니다.
각 진입타입에 따라 식을 다르게 작성하셔야 합니다.
아래 내용 참고하시기 바랍니다.
1 atmarket타입
if MarketPosition <= 0 and 매수조건 Then
{
Buy("b",AtMarket);
ExitLong("bx",AtStop,NextBarOpen-PriceScale*50);
}
if MarketPosition == 1 Then
{
if BarsSinceEntry < 1 Then
ExitLong("bx1",AtStop,EntryPrice-PriceScale*50);
Else
ExitLong("bx2",AtStop,EntryPrice-PriceScale*100);
}
if MarketPosition >= 0 and 매도조건 Then
{
Sell("s",AtMarket);
ExitShort("sx",AtStop,NextBarOpen+PriceScale*50);
}
if MarketPosition == -1 Then
{
if BarsSinceEntry < 1 Then
ExitShort("sx1",AtStop,EntryPrice+PriceScale*50);
Else
ExitShort("sx2",AtStop,EntryPrice+PriceScale*100);
}
2 atstop타입
if MarketPosition <= 0 and 매수조건 Then
{
Buy("b",AtStop,가격);
ExitLong("bx",AtStop,max(NextBarOpen,가격)-PriceScale*50);
}
if MarketPosition == 1 Then
{
if BarsSinceEntry < 1 Then
ExitLong("bx1",AtStop,EntryPrice-PriceScale*50);
Else
ExitLong("bx2",AtStop,EntryPrice-PriceScale*100);
}
if MarketPosition >= 0 and 매도조건 Then
{
Sell("s",AtStop,가격);
ExitShort("sx",AtStop,min(NextBarOpen,가격)+PriceScale*50);
}
if MarketPosition == -1 Then
{
if BarsSinceEntry < 1 Then
ExitShort("sx1",AtStop,EntryPrice+PriceScale*50);
Else
ExitShort("sx2",AtStop,EntryPrice+PriceScale*100);
}
3 atlimit타입
if MarketPosition <= 0 and 매수조건 Then
{
Buy("b",AtLimit,가격);
ExitLong("bx",AtStop,min(NextBarOpen,가격)-PriceScale*50);
}
if MarketPosition == 1 Then
{
if BarsSinceEntry < 1 Then
ExitLong("bx1",AtStop,EntryPrice-PriceScale*50);
Else
ExitLong("bx2",AtStop,EntryPrice-PriceScale*100);
}
if MarketPosition >= 0 and 매도조건 Then
{
Sell("s",AtLimit,가격);
ExitShort("sx",AtStop,max(NextBarOpen,가격)+PriceScale*50);
}
if MarketPosition == -1 Then
{
if BarsSinceEntry < 1 Then
ExitShort("sx1",AtStop,EntryPrice+PriceScale*50);
Else
ExitShort("sx2",AtStop,EntryPrice+PriceScale*100);
}
즐거운 하루되세요
> 카르마다 님이 쓴 글입니다.
> 제목 : 문의드립니다.
> 선물시스템에서
진입한 봉 또는 그다음봉에서 50틱 밀리면 바로 손절청산되는 식을 원합니다.
진입한 봉이나 그 다음봉이 아닌 경우 100틱 밀리면 손절청산되길 원합니다.
1) 진입봉에서 50틱 되돌림 나올 경우
2) 진입봉 그 다음봉에서 50틱 되돌림 나올 경우 2가지 로직 부탁드립니다.
늘 노고에 감사드립니다~