커뮤니티
진입 및 청산
2017-09-25 23:10:48
173
글번호 113073
고생 많으십니다..
다음의 조건에서 진입 및 청산수식 부탁 드립니다.
if conbuy1==true then
buy("buy1");
if conbuy2==true then
buy("buy2");
if conbuy3==true then
buy("buy3");
if consell1==true then
sell("sell1");
if consell2==true then
sell("sell2");
if consell3==true then
sell("sell3");
## buy진입시.
1. 위의 buy 진입조건에서 첫 진입은 2계약 진입.
if buy청산==true then --> 1계약 청산 ( 1계약은 보유 )
if buycut==true then --> 보유계약 모두 손절.
( buy청산==true 이후에 buycut==true 이면 1계약이 손절되고
다른 신호 전에 buycut==true 이면 2계약이 손절됩니다. )
2. 현 보유포지션과 동일한 포지션의 조건이 성립될때
2계약 보유중이면 추가진입 제한
1계약 보유중이면 1계약 추가진입.
( 추가 진입하여 2계약이 되었을 경우에도 buy청산==true 이면 1계약 청산 )
3. 현 보유포지션(buy)과 다른 포지션(sell1 or sell2 or sell3)의 조건이 성립될때
보유 포지션(buy)은 모두 청산하고 다른 포지션(sell)으로 2계약 진입.
4. if buy본청==true then --> 보유계약 모두 청산. ( 1계약 또는 2계약 )
buy와 동일한 방법으로 sell 청산수식도 함께 부탁드립니다.
답변 1
예스스탁 예스스탁 답변
2017-09-26 13:37:53
안녕하세요
예스스탁입니다.
if conbuy1==true and (MarketPosition <= 0 or (MarketPosition == 1 and CurrentContracts == 1)) then
buy("buy1",OnClose,def,iff(MarketPosition<=0,2,1));
if conbuy2==true and (MarketPosition <= 0 or (MarketPosition == 1 and CurrentContracts == 1)) then
buy("buy2",OnClose,def,iff(MarketPosition<=0,2,1));
if conbuy3==true and (MarketPosition <= 0 or (MarketPosition == 1 and CurrentContracts == 1)) then
buy("buy3",OnClose,def,iff(MarketPosition<=0,2,1));
if consell1==true and (MarketPosition >= 0 or (MarketPosition == -1 and CurrentContracts == 1)) then
sell("sell1",OnClose,def,iff(MarketPosition>=0,2,1));
if consell2==true and (MarketPosition >= 0 or (MarketPosition == -1 and CurrentContracts == 1)) then
sell("sell2",OnClose,def,iff(MarketPosition>=0,2,1));
if consell3==true and (MarketPosition >= 0 or (MarketPosition == -1 and CurrentContracts == 1)) then
sell("sell3",OnClose,def,iff(MarketPosition>=0,2,1));
if MarketPosition == 1 then{
if CurrentContracts == 2 and buy청산 then
ExitLong("bx1",OnClose,def,"",1,1);
if buycut then
ExitLong("bx2");
if buy본청 then
ExitLong("bx3");
}
if MarketPosition == -1 then{
if CurrentContracts == 2 and sell청산 then
ExitShort("sx1",OnClose,def,"",1,1);
if sellcut then
ExitShort("sx2");
if sell본청 then
ExitShort("sx3");
}
즐거운 하루되세요
> 다올 님이 쓴 글입니다.
> 제목 : 진입 및 청산
> 고생 많으십니다..
다음의 조건에서 진입 및 청산수식 부탁 드립니다.
if conbuy1==true then
buy("buy1");
if conbuy2==true then
buy("buy2");
if conbuy3==true then
buy("buy3");
if consell1==true then
sell("sell1");
if consell2==true then
sell("sell2");
if consell3==true then
sell("sell3");
## buy진입시.
1. 위의 buy 진입조건에서 첫 진입은 2계약 진입.
if buy청산==true then --> 1계약 청산 ( 1계약은 보유 )
if buycut==true then --> 보유계약 모두 손절.
( buy청산==true 이후에 buycut==true 이면 1계약이 손절되고
다른 신호 전에 buycut==true 이면 2계약이 손절됩니다. )
2. 현 보유포지션과 동일한 포지션의 조건이 성립될때
2계약 보유중이면 추가진입 제한
1계약 보유중이면 1계약 추가진입.
( 추가 진입하여 2계약이 되었을 경우에도 buy청산==true 이면 1계약 청산 )
3. 현 보유포지션(buy)과 다른 포지션(sell1 or sell2 or sell3)의 조건이 성립될때
보유 포지션(buy)은 모두 청산하고 다른 포지션(sell)으로 2계약 진입.
4. if buy본청==true then --> 보유계약 모두 청산. ( 1계약 또는 2계약 )
buy와 동일한 방법으로 sell 청산수식도 함께 부탁드립니다.
다음글
이전글