커뮤니티

문의

프로필 이미지
목마와숙녀
2026-01-23 16:01:10
88
글번호 230040
답변완료

아래 수식은

국내선물 데이트레이딩  "전략A" 에 사용하는 청산수식입니다.

하나의 전략에 사용되며 5개의 청산수식입니다.


문제점 :  청산전략은 1번씩 5번만 사용되어야 하는데 반복되어 사용되는 문제가 발생됩니다.


     1)  ExitLong("320",Atlimit,EntryPrice+b1gl);     이런 형식은 1번씩만 사용되는 것 같은데


     2)  c>Lowd(0)+Lowdb1 Then

                ExitLong("Lowdb1");    이런 형식은 청산이 반복되어 다음 포지션을 잡으면 바로 또 청산되는 것을 반복합니다.



요청내용

5개의 청산전략이 한번씩만 작동되도록 수식을 수정해 주십시요


항상 고맙습니다.



********************************************************************************************************************


input : b1lock(094000),b1gl(3.2);

input : b1lock2(150000),Lowdb1(999999);

input : b2lock(120000),b2gl(14.4);

input : b2lock2(110000),Lowdb2(21);

input : b2st3(140000),b2lock3(150000),Lowdb3(16.2);



if marketposition() == 1 and IsEntryName("b1") == true and stime<b1lock Then

      ExitLong("320",Atlimit,EntryPrice+b1gl);


if marketposition() == 1 and IsEntryName("b1") == true and stime<b1lock2 and

   c>Lowd(0)+Lowdb1 Then

      ExitLong("Lowdb1");


if marketposition() == 1 and IsEntryName("b2") == true and stime<b2lock Then

      ExitLong("1440",Atlimit,EntryPrice+b2gl);


if marketposition() == 1 and IsEntryName("b2") == true and stime<b2lock2 and

   c>Lowd(0)+Lowdb2 Then

      ExitLong("Lowdb2");


if marketposition() == 1 and IsEntryName("b2") == true and stime>=b2st3 and stime<b2lock3 and

   c>Lowd(0)+Lowdb3 Then

      ExitLong("Lowdb3");


시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2026-01-26 10:10:19

안녕하세요 예스스탁입니다. 해당 청산식들은 진입 후에 조건을 충족하면 전량청산되는 식들입니다. 각 청산식들에 횟수에 제한은 없습니다. 진입후 가장먼저 만족한 조건으로 청산되는데 c>Lowd(0)+Lowdb1와 같은 조건은 진입후 종가가 Lowd(0)+Lowdb1보다 크면 바로 청산이 됩니다. 각 청산이 하루에 한번만 동작하게 하시려면 아래와 같이 제어하시면 됩니다. input : b1lock(094000),b1gl(3.2); input : b1lock2(150000),Lowdb1(999999); input : b2lock(120000),b2gl(14.4); input : b2lock2(110000),Lowdb2(21); input : b2st3(140000),b2lock3(150000),Lowdb3(16.2); if Bdate != Bdate[1] Then { Condition1 = False; Condition2 = False; Condition3 = False; Condition4 = False; Condition5 = False; } if TotalTrades > TotalTrades[1] Then { if IsExitName("320",1) == true Then Condition1 = true; if IsExitName("Lowdb1",1) == true Then Condition2 = true; if IsExitName("1440",1) == true Then Condition3 = true; if IsExitName("Lowdb2",1) == true Then Condition4 = true; if IsExitName("Lowdb3",1) == true Then Condition5 = true; } if marketposition() == 1 and Condition1 == False and IsEntryName("b1") == true and stime<b1lock Then ExitLong("320",Atlimit,EntryPrice+b1gl); if marketposition() == 1 and Condition2 == False and IsEntryName("b1") == true and stime<b1lock2 and c>Lowd(0)+Lowdb1 Then ExitLong("Lowdb1"); if marketposition() == 1 and Condition3 == False and IsEntryName("b2") == true and stime<b2lock Then ExitLong("1440",Atlimit,EntryPrice+b2gl); if marketposition() == 1 and Condition4 == False and IsEntryName("b2") == true and stime<b2lock2 and c>Lowd(0)+Lowdb2 Then ExitLong("Lowdb2",OnClose,Def,"b2"); if marketposition() == 1 and Condition4 == False and IsEntryName("b2") == true and stime>=b2st3 and stime<b2lock3 and c>Lowd(0)+Lowdb3 Then ExitLong("Lowdb3"); 즐거운 하루되세요