커뮤니티

문의

프로필 이미지
좌오비우오비
2021-02-04 22:05:57
461
글번호 146122
답변완료
진입수식에 답변주신 청산수식을 적용해보았습니다. 손절 익절 트레일링스탑 모두 시뮬레이션에 변화가 없는데 검토바랍니다. ***************************************************************************** Input : up(1800),pyra2(1.5),pyra3(1.5); input : v1(1),v2(2),v3(3); var : BH(0); input : up손절1(1.00),up익절1(99999),upTR1(4.00); input : up손절2(1.10),up익절2(99999),upTR2(4.10); input : up손절3(1.20),up익절3(99999),upTR3(4.20); var : C2(0,data2),entry(false,data2); C2 = data2(C); if data2(Bdate != Bdate[1]) Then entry = false; if MarketPosition <= 0 and entry == false and data2(Bdate == Bdate[1] and HighD(0) > HighD(0)[1] and HighD(0)-LowD(0) >= up) Then{ entry = true; Buy("b1",OnClose,DEF,v1); } if MarketPosition == 1 and IsEntryName("b1",0) == true Then { BH = Highest(H,BarsSinceEntry); if CurrentContracts > CurrentContracts[1] Then Condition1 = False; if BH > BH[1] Then Condition1 = true; if MaxEntries == 1 and Condition1 == true Then Buy("bb2",AtLimit,BH-pyra2,V2); if MaxEntries == 2 and Condition1 == true Then Buy("bb3",AtLimit,BH-pyra3,V3); } var : E1(0),E2(0),E3(0); var : H1(0),H2(0),H3(0); if MarketPosition == 1 Then { if CurrentContracts > CurrentContracts and LatestEntryName(0) == "b1" Then { E1 = LatestEntryPrice(0); H1 = H; } if H1 > 0 and H > H1 Then H1 = H; if CurrentContracts > CurrentContracts and LatestEntryName(0) == "bb2" Then { E2 = LatestEntryPrice(0); H2 = H; } if H2 > 0 and H > H2 Then H2 = H; if CurrentContracts > CurrentContracts and LatestEntryName(0) == "bb3" Then { E3 = LatestEntryPrice(0); H3 = H; } if H3 > 0 and H > H3 Then H3 = H; if E1 > 0 then { ExitLong("bl1",AtStop,E1-up손절1,"b1"); Exitlong("bp1",AtLimit,E1+up익절1,"b1"); Exitlong("btr1",AtStop,H1-upTR1,"b1"); } if E2 > 0 Then { ExitLong("bl2",AtStop,E2-up손절2,"bb2"); Exitlong("bp2",AtLimit,E2+up익절2,"bb2"); Exitlong("btr2",AtStop,H2-upTR2,"bb2"); } if E3 > 0 Then { ExitLong("bl3",AtStop,E3-up손절3,"bb3"); Exitlong("bp3",AtLimit,E3+up익절3,"bb3"); Exitlong("btr3",AtStop,H3-upTR3,"bb3"); } } Else { E1 = 0; E2 = 0; E3 = 0; }
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2021-02-08 10:34:10

안녕하세요 예스스탁입니다. 해당수식이 각 진입별 진입가와 해당 진입이후 최고가를 기준으로 청산하고 청산시 지정한 진입명으로 진입된 수량으로 청산이 발생합니다. 테스트 결과 정상적으로 청산이 됩니다. 수식에 참조데이타 data2가 사용되므로 수식을 아래와 같이 변경해서 적용해 보시기 바랍니다. 신호가 의도와 다르게 발생하면 02-3453-1060으로 전화주시기 바랍니다. Input : up(1800),pyra2(1.5),pyra3(1.5); input : v1(1),v2(2),v3(3); var : BH(0); input : up손절1(1.00),up익절1(99999),upTR1(4.00); input : up손절2(1.10),up익절2(99999),upTR2(4.10); input : up손절3(1.20),up익절3(99999),upTR3(4.20); var : C2(0,data2),entry(false,data2); C2 = data2(C); if data2(Bdate != Bdate[1]) Then entry = false; if MarketPosition <= 0 and entry == false and data2(Bdate == Bdate[1] and HighD(0) > HighD(0)[1] and HighD(0)-LowD(0) >= up) Then{ entry = true; Buy("b1",OnClose,DEF,v1); } if MarketPosition == 1 and IsEntryName("b1",0) == true Then { BH = Highest(H,BarsSinceEntry); if CurrentContracts > CurrentContracts[1] Then Condition1 = False; if BH > BH[1] Then Condition1 = true; if MaxEntries == 1 and Condition1 == true Then Buy("bb2",AtLimit,BH-pyra2,V2); if MaxEntries == 2 and Condition1 == true Then Buy("bb3",AtLimit,BH-pyra3,V3); } var : E1(0,Data2),E2(0,Data2),E3(0,Data2); var : H1(0,Data2),H2(0,Data2),H3(0,Data2); if MarketPosition == 1 Then { if CurrentContracts > CurrentContracts and LatestEntryName(0) == "b1" Then { E1 = LatestEntryPrice(0); H1 = data2(H); } if H1 > 0 and data2(H) > H1 Then H1 = data2(H); if CurrentContracts > CurrentContracts and LatestEntryName(0) == "bb2" Then { E2 = LatestEntryPrice(0); H2 = data2(H); } if H2 > 0 and data2(H) > H2 Then H2 = data2(H); if CurrentContracts > CurrentContracts and LatestEntryName(0) == "bb3" Then { E3 = LatestEntryPrice(0); H3 = data2(H); } if H3 > 0 and data2(H) > H3 Then H3 = data2(H); if E1 > 0 then { ExitLong("bl1",AtStop,E1-up손절1,"b1"); Exitlong("bp1",AtLimit,E1+up익절1,"b1"); Exitlong("btr1",AtStop,H1-upTR1,"b1"); } if E2 > 0 Then { ExitLong("bl2",AtStop,E2-up손절2,"bb2"); Exitlong("bp2",AtLimit,E2+up익절2,"bb2"); Exitlong("btr2",AtStop,H2-upTR2,"bb2"); } if E3 > 0 Then { ExitLong("bl3",AtStop,E3-up손절3,"bb3"); Exitlong("bp3",AtLimit,E3+up익절3,"bb3"); Exitlong("btr3",AtStop,H3-upTR3,"bb3"); } } Else { E1 = 0; E2 = 0; E3 = 0; } 즐거운 하루되세요 > 좌오비우오비 님이 쓴 글입니다. > 제목 : 문의 > 진입수식에 답변주신 청산수식을 적용해보았습니다. 손절 익절 트레일링스탑 모두 시뮬레이션에 변화가 없는데 검토바랍니다. ***************************************************************************** Input : up(1800),pyra2(1.5),pyra3(1.5); input : v1(1),v2(2),v3(3); var : BH(0); input : up손절1(1.00),up익절1(99999),upTR1(4.00); input : up손절2(1.10),up익절2(99999),upTR2(4.10); input : up손절3(1.20),up익절3(99999),upTR3(4.20); var : C2(0,data2),entry(false,data2); C2 = data2(C); if data2(Bdate != Bdate[1]) Then entry = false; if MarketPosition <= 0 and entry == false and data2(Bdate == Bdate[1] and HighD(0) > HighD(0)[1] and HighD(0)-LowD(0) >= up) Then{ entry = true; Buy("b1",OnClose,DEF,v1); } if MarketPosition == 1 and IsEntryName("b1",0) == true Then { BH = Highest(H,BarsSinceEntry); if CurrentContracts > CurrentContracts[1] Then Condition1 = False; if BH > BH[1] Then Condition1 = true; if MaxEntries == 1 and Condition1 == true Then Buy("bb2",AtLimit,BH-pyra2,V2); if MaxEntries == 2 and Condition1 == true Then Buy("bb3",AtLimit,BH-pyra3,V3); } var : E1(0),E2(0),E3(0); var : H1(0),H2(0),H3(0); if MarketPosition == 1 Then { if CurrentContracts > CurrentContracts and LatestEntryName(0) == "b1" Then { E1 = LatestEntryPrice(0); H1 = H; } if H1 > 0 and H > H1 Then H1 = H; if CurrentContracts > CurrentContracts and LatestEntryName(0) == "bb2" Then { E2 = LatestEntryPrice(0); H2 = H; } if H2 > 0 and H > H2 Then H2 = H; if CurrentContracts > CurrentContracts and LatestEntryName(0) == "bb3" Then { E3 = LatestEntryPrice(0); H3 = H; } if H3 > 0 and H > H3 Then H3 = H; if E1 > 0 then { ExitLong("bl1",AtStop,E1-up손절1,"b1"); Exitlong("bp1",AtLimit,E1+up익절1,"b1"); Exitlong("btr1",AtStop,H1-upTR1,"b1"); } if E2 > 0 Then { ExitLong("bl2",AtStop,E2-up손절2,"bb2"); Exitlong("bp2",AtLimit,E2+up익절2,"bb2"); Exitlong("btr2",AtStop,H2-upTR2,"bb2"); } if E3 > 0 Then { ExitLong("bl3",AtStop,E3-up손절3,"bb3"); Exitlong("bp3",AtLimit,E3+up익절3,"bb3"); Exitlong("btr3",AtStop,H3-upTR3,"bb3"); } } Else { E1 = 0; E2 = 0; E3 = 0; }