커뮤니티

문의

프로필 이미지
좌오비우오비
2021-02-04 14:32:42
594
글번호 146106
답변완료
아래 수식처럼 피라미딩으로 진입한 이후 exitlong 수식을 적용해보았습니다. 여기에 exit 수량을 세팅하는 수식을 추가해주십시요. b1 2개 진입했으므로 exit 2개 bb2 3개 진입했으므로 exit 3개 bb3 4개 진입했으므로 exit 4개 if MarketPosition == 1 and IsEntryName("b1") == true Then { ExitLong("bl1",AtStop,EntryPrice-up손절1); Exitlong("bp1",AtLimit,EntryPrice+up익절1); Exitlong("btr1",AtStop,Highest(h,BarsSinceEntry)-upTR1); } if MarketPosition == 1 and IsEntryName("bb2") == true then { ExitLong("bl2",AtStop,EntryPrice-up손절2); Exitlong("bp2",AtLimit,EntryPrice+up익절2); Exitlong("btr2",AtStop,highest(h,BarsSinceEntry)-upTR2); } if MarketPosition == 1 and IsEntryName("bb3") == true then { ExitLong("bl3",AtStop,EntryPrice-up손절3); Exitlong("bp3",AtLimit,EntryPrice+up익절3); Exitlong("btr3",AtStop,highest(h,BarsSinceEntry)-upTR3); } ************************************************************************************* 안녕하세요 예스스탁입니다. input : v1(2),v2(3),v3(4); var : BH(0),SL(0); if MarketPosition <= 0 and 첫매수진입조건 Then 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-0.5,V2); if MaxEntries == 2 and Condition1 == true Then Buy("bb3",AtLimit,BH-0.6,V3); }
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2021-02-04 15:32:32

안녕하세요 예스스탁입니다. 1 청산함수의 4번째 매개변수가 진입명을 지정하는 부분입니다. 청산함수에 진입명을 지정하면 해당 진입명으로 신호가 발생되어 있을때만 동작하고 해당 진입으로 들어간 수량만 청산하게 됩니다. if MarketPosition == 1 Then { ExitLong("bl1",AtStop,EntryPrice-up손절1,"b1"); Exitlong("bp1",AtLimit,EntryPrice+up익절1,"b1"); Exitlong("btr1",AtStop,Highest(h,BarsSinceEntry)-upTR1,"b1"); ExitLong("bl2",AtStop,EntryPrice-up손절2,"bb2"); Exitlong("bp2",AtLimit,EntryPrice+up익절2,"bb2"); Exitlong("btr2",AtStop,highest(h,BarsSinceEntry)-upTR2,"bb2"); ExitLong("bl3",AtStop,EntryPrice-up손절3,"bb3"); Exitlong("bp3",AtLimit,EntryPrice+up익절3,"bb3"); Exitlong("btr3",AtStop,highest(h,BarsSinceEntry)-upTR3,"bb3"); } 2 올려주신 청산식의 EntryPrice는 지정한 첫매수의 진입가 입니다. 피라미딩으로 들어가는 각각의 진입가가 아닙니다. 또한 Highest(h,BarsSinceEntry)도 첫진입이후 최고가 입니다. 위 내용으로 사용하시는 부분이면 그대로 사용하시면 되고 각각의 진입가와 최고가를 계산하고자 하시면 아래식 이용하시면 됩니다. 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; } 즐거운 하루되세요 > 좌오비우오비 님이 쓴 글입니다. > 제목 : 문의 > 아래 수식처럼 피라미딩으로 진입한 이후 exitlong 수식을 적용해보았습니다. 여기에 exit 수량을 세팅하는 수식을 추가해주십시요. b1 2개 진입했으므로 exit 2개 bb2 3개 진입했으므로 exit 3개 bb3 4개 진입했으므로 exit 4개 if MarketPosition == 1 and IsEntryName("b1") == true Then { ExitLong("bl1",AtStop,EntryPrice-up손절1); Exitlong("bp1",AtLimit,EntryPrice+up익절1); Exitlong("btr1",AtStop,Highest(h,BarsSinceEntry)-upTR1); } if MarketPosition == 1 and IsEntryName("bb2") == true then { ExitLong("bl2",AtStop,EntryPrice-up손절2); Exitlong("bp2",AtLimit,EntryPrice+up익절2); Exitlong("btr2",AtStop,highest(h,BarsSinceEntry)-upTR2); } if MarketPosition == 1 and IsEntryName("bb3") == true then { ExitLong("bl3",AtStop,EntryPrice-up손절3); Exitlong("bp3",AtLimit,EntryPrice+up익절3); Exitlong("btr3",AtStop,highest(h,BarsSinceEntry)-upTR3); } ************************************************************************************* 안녕하세요 예스스탁입니다. input : v1(2),v2(3),v3(4); var : BH(0),SL(0); if MarketPosition <= 0 and 첫매수진입조건 Then 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-0.5,V2); if MaxEntries == 2 and Condition1 == true Then Buy("bb3",AtLimit,BH-0.6,V3); }