커뮤니티

문의 드립니다

프로필 이미지
남산
2021-02-15 09:18:11
496
글번호 146305
답변완료
if&nbsp;MarketPosition&nbsp;<=&nbsp;0&nbsp;Then &nbsp;&nbsp; { &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;조건수식1&nbsp;Then &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;CurrentContracts&nbsp;<&nbsp;1&nbsp;Then&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;buy("매수1",OnClose,def,1); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Else &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;조건수식2&nbsp;and&nbsp;CurrentContracts&nbsp;<&nbsp;2&nbsp;Then &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;buy("매수2",OnClose,def,1); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} &nbsp;&nbsp;&nbsp;} if MarketPosition == 1 Then { if 조건수식3 Then { if CurrentContracts < 1 Then buy("수1",OnClose,def,1); } Else { if 조건수식4 and CurrentContracts < 2 Then buy("수2",OnClose,def,1); } } if MarketPosition == 1 Then { if 조건수식1 Then { exitlong("청산1",OnClose,def,"매수1"); } Else { if 조건수식1-2 and exitlong("청산1-1",OnClose,def,"매수1"); } if 조건수식2 Then { exitlong("청산2",OnClose,def,"수1"); } Else { if 조건수식2-1 and exitlong("청산2-1",OnClose,def,"수1"); } if 조건수식3 Then { exitlong("청산3",OnClose,def,"매수2"); } Else { if 조건수식3-1 and exitlong("청산3-1",OnClose,def,"매수2"); } if 조건수식4 Then { exitlong("청산4",OnClose,def,"수2"); } Else { if 조건수식4-1 and exitlong("청산4-1",OnClose,def,"수2"); } ExitLong("bp",atlimit,AvgEntryPrice+PriceScale*익절틱수); ExitLong("bl",AtStop,AvgEntryPrice-PriceScale*손절틱수); } 1. 위 수식에서 진입별 청산수식이 맞나요 2. 익절 및 손절방법을 각가 별도로 할 수 있도록 변경하여 주시면 감사드립니다 (매수1, 수1, 매수2, 수2)
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2021-02-15 18:25:11

안녕하세요 예스스탁입니다. 예 맞습니다. 다만 일부식이 if~then이 아닌 if~ and로 되어 있어 수정했습니다. 익절,손절도 진입별로 추가해 드립니다. input : 익절틱수1(10),손절틱수1(10); input : 익절틱수2(10),손절틱수2(10); input : 익절틱수3(10),손절틱수3(10); input : 익절틱수4(10),손절틱수4(10); if MarketPosition <= 0 Then { if 조건수식1 Then { if CurrentContracts < 1 Then buy("매수1",OnClose,def,1); } Else { if 조건수식2 and CurrentContracts < 2 Then buy("매수2",OnClose,def,1); } } if MarketPosition == 1 Then { if 조건수식3 Then { if CurrentContracts < 1 Then buy("수1",OnClose,def,1); } Else { if 조건수식4 and CurrentContracts < 2 Then buy("수2",OnClose,def,1); } } if MarketPosition == 1 Then { if 조건수식1 Then { exitlong("청산1",OnClose,def,"매수1"); } Else { if 조건수식1-2 Then exitlong("청산1-1",OnClose,def,"매수1"); } if 조건수식2 Then { exitlong("청산2",OnClose,def,"수1"); } Else { if 조건수식2-1 Then exitlong("청산2-1",OnClose,def,"수1"); } if 조건수식3 Then { exitlong("청산3",OnClose,def,"매수2"); } Else { if 조건수식3-1 Then exitlong("청산3-1",OnClose,def,"매수2"); } if 조건수식4 Then { exitlong("청산4",OnClose,def,"수2"); } Else { if 조건수식4-1 Then exitlong("청산4-1",OnClose,def,"수2"); } ExitLong("bp1",atlimit,AvgEntryPrice+PriceScale*익절틱수1,"매수1"); ExitLong("bl1",AtStop,AvgEntryPrice-PriceScale*손절틱수1,"매수1"); ExitLong("bp2",atlimit,AvgEntryPrice+PriceScale*익절틱수2,"수1"); ExitLong("bl2",AtStop,AvgEntryPrice-PriceScale*손절틱수2,"수1"); ExitLong("bp3",atlimit,AvgEntryPrice+PriceScale*익절틱수3,"매수2"); ExitLong("bl3",AtStop,AvgEntryPrice-PriceScale*손절틱수3,"매수2"); ExitLong("bp4",atlimit,AvgEntryPrice+PriceScale*익절틱수4,"수2"); ExitLong("bl4",AtStop,AvgEntryPrice-PriceScale*손절틱수4,"수2"); } 즐거운 하루되세요 > 남산 님이 쓴 글입니다. > 제목 : 문의 드립니다 > if&#160;MarketPosition&#160;<=&#160;0&#160;Then &#160;&#160; { &#160;&#160;&#160;&#160;&#160;&#160;if&#160;조건수식1&#160;Then &#160;&#160;&#160;&#160;&#160;&#160; { &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if&#160;CurrentContracts&#160;<&#160;1&#160;Then&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;buy("매수1",OnClose,def,1); &#160;&#160;&#160;&#160;&#160;&#160;} &#160;&#160;&#160;&#160;&#160;&#160;Else &#160;&#160;&#160;&#160;&#160;&#160;{ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if&#160;조건수식2&#160;and&#160;CurrentContracts&#160;<&#160;2&#160;Then &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;buy("매수2",OnClose,def,1); &#160;&#160;&#160;&#160;&#160;&#160;} &#160;&#160;&#160;} if MarketPosition == 1 Then { if 조건수식3 Then { if CurrentContracts < 1 Then buy("수1",OnClose,def,1); } Else { if 조건수식4 and CurrentContracts < 2 Then buy("수2",OnClose,def,1); } } if MarketPosition == 1 Then { if 조건수식1 Then { exitlong("청산1",OnClose,def,"매수1"); } Else { if 조건수식1-2 and exitlong("청산1-1",OnClose,def,"매수1"); } if 조건수식2 Then { exitlong("청산2",OnClose,def,"수1"); } Else { if 조건수식2-1 and exitlong("청산2-1",OnClose,def,"수1"); } if 조건수식3 Then { exitlong("청산3",OnClose,def,"매수2"); } Else { if 조건수식3-1 and exitlong("청산3-1",OnClose,def,"매수2"); } if 조건수식4 Then { exitlong("청산4",OnClose,def,"수2"); } Else { if 조건수식4-1 and exitlong("청산4-1",OnClose,def,"수2"); } ExitLong("bp",atlimit,AvgEntryPrice+PriceScale*익절틱수); ExitLong("bl",AtStop,AvgEntryPrice-PriceScale*손절틱수); } 1. 위 수식에서 진입별 청산수식이 맞나요 2. 익절 및 손절방법을 각가 별도로 할 수 있도록 변경하여 주시면 감사드립니다 (매수1, 수1, 매수2, 수2)