커뮤니티
수식문의드립니다.
2018-04-25 15:14:42
214
글번호 118455
아래식으로 스위칭시스템을 만들고 싶은데요
몇가지 내용을 추가 하고 싶습니다.
부탁드립니다.
1. 직전 진입이 매수 였으면 다음진입은 매도진입으로
2. 직전 진입이 매도 였으면 다음진입은 매수진입으로
3. 3계약들어가서 아래 청산식으로 청산하되 반대신호가 나오면 직전포지션을 모두 청산하고 스위칭하게 하고 싶습니다.
If C > top
Then
Buy("매수", AtStop, C,3);
If C < bot
Then
Sell("매도", AtStop, C,3);
if MarketPosition == 1 Then{
exitlong("bx1",Atlimit,EntryPrice+PriceScale*10,"",1,1);
exitlong("bx2",Atlimit,EntryPrice+PriceScale*20,"",1,1);
exitlong("bx3",Atlimit,EntryPrice+PriceScale*30,"",1,1);
}
if MarketPosition == -1 Then{
ExitShort("sx1",Atlimit,EntryPrice-PriceScale*10,"",1,1);
ExitShort("sx2",Atlimit,EntryPrice-PriceScale*20,"",1,1);
ExitShort("sx3",Atlimit,EntryPrice-PriceScale*30,"",1,1);
}
답변 1
예스스탁 예스스탁 답변
2018-04-26 10:34:48
안녕하세요
예스스탁입니다.
Condition1 = MarketPosition == 0 and MarketPosition(1) == 1;
Condition2 = MarketPosition == 0 and MarketPosition(1) == -1;
If Condition1 == false and C > top
Then
Buy("매수", AtStop, C,3);
If Condition1 == false and C < bot
Then
Sell("매도", AtStop, C,3);
if MarketPosition == 1 Then{
exitlong("bx1",Atlimit,EntryPrice+PriceScale*10,"",1,1);
exitlong("bx2",Atlimit,EntryPrice+PriceScale*20,"",1,1);
exitlong("bx3",Atlimit,EntryPrice+PriceScale*30,"",1,1);
}
if MarketPosition == -1 Then{
ExitShort("sx1",Atlimit,EntryPrice-PriceScale*10,"",1,1);
ExitShort("sx2",Atlimit,EntryPrice-PriceScale*20,"",1,1);
ExitShort("sx3",Atlimit,EntryPrice-PriceScale*30,"",1,1);
}
즐거운 하루되세요
> 수다리 님이 쓴 글입니다.
> 제목 : 수식문의드립니다.
> 아래식으로 스위칭시스템을 만들고 싶은데요
몇가지 내용을 추가 하고 싶습니다.
부탁드립니다.
1. 직전 진입이 매수 였으면 다음진입은 매도진입으로
2. 직전 진입이 매도 였으면 다음진입은 매수진입으로
3. 3계약들어가서 아래 청산식으로 청산하되 반대신호가 나오면 직전포지션을 모두 청산하고 스위칭하게 하고 싶습니다.
If C > top
Then
Buy("매수", AtStop, C,3);
If C < bot
Then
Sell("매도", AtStop, C,3);
if MarketPosition == 1 Then{
exitlong("bx1",Atlimit,EntryPrice+PriceScale*10,"",1,1);
exitlong("bx2",Atlimit,EntryPrice+PriceScale*20,"",1,1);
exitlong("bx3",Atlimit,EntryPrice+PriceScale*30,"",1,1);
}
if MarketPosition == -1 Then{
ExitShort("sx1",Atlimit,EntryPrice-PriceScale*10,"",1,1);
ExitShort("sx2",Atlimit,EntryPrice-PriceScale*20,"",1,1);
ExitShort("sx3",Atlimit,EntryPrice-PriceScale*30,"",1,1);
}