커뮤니티

수식종료후 매매시작 수식작성

프로필 이미지
tnsflwls
2021-06-29 01:11:20
1354
글번호 150368
답변완료
수고 하십니다 ! Input : Period1(1), Period2(10), Period3(35), Period4(60), Period5(120),period6(240),Period7(480), Period8(960), Period9(1920), Period10(3840),period11(7680); var : Sma1(0),Sma2(0),Sma3(0),Sma4(0),Sma5(0),sma6(0),Sma7(0),Sma8(0),Sma9(0),Sma10(0),sma11(0); Sma1 = ma(C,Period1); Sma2 = ma(C,Period2); Sma3 = ma(C,Period3); Sma4 = ma(C,Period4); Sma5 = ma(C,Period5); sma6 = ma(c,period6); Sma7 = ma(C,Period7); Sma8 = ma(C,Period8); Sma9 = ma(C,Period9); Sma10 = ma(C,Period10); sma11 = ma(c,period11); if sma1 > sma3+PriceScale*3 Then Sell("3도"); Buy("재수",AtStop,EntryPrice+PriceScale*8); SetStopTrailing(PriceScale*4,PriceScale*15, PointStop); if sma1 < sma3-PriceScale*3 Then Buy("3수"); sell("bs",AtStop,EntryPrice-PriceScale*8); SetStopTrailing(PriceScale*4,PriceScale*15, Pointstop); 위 수식에서 예를들면 매수를 하였는데 지수가 하락을 하여 8틱이 손실이나면 청산과 동시에 매도를 하여 15틱이 이익으로가서 4틱이 이익에서 빠질때 청산을 해야 하는데 수식적용이 setstoptrailing 수식으로 적용이 안되고 8틱손실이 되어 매도체결과 동시에 청산되면서 매수를 또 체결하는데 setstoptrailing수식이 완료 될때까지 매매는 정지하는 수식을 부탁 드립니다.
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2021-06-29 10:08:22

안녕하세요 예스스탁입니다. 스위칭 후에는 트레일링 스탑으로만 청산하고자 하시면 아래와 같이 수정하셔야 하며 다른 진입들 또한 스위칭이 되면 동작되지 않게 하셔야 합니다. Input : Period1(1), Period2(10), Period3(35), Period4(60), Period5(120),period6(240),Period7(480), Period8(960), Period9(1920), Period10(3840),period11(7680); var : Sma1(0),Sma2(0),Sma3(0),Sma4(0),Sma5(0),sma6(0),Sma7(0),Sma8(0),Sma9(0),Sma10(0),sma11(0); Sma1 = ma(C,Period1); Sma2 = ma(C,Period2); Sma3 = ma(C,Period3); Sma4 = ma(C,Period4); Sma5 = ma(C,Period5); sma6 = ma(c,period6); Sma7 = ma(C,Period7); Sma8 = ma(C,Period8); Sma9 = ma(C,Period9); Sma10 = ma(C,Period10); sma11 = ma(c,period11); if (MarketPosition == 0 or (MarketPosition == 1 and IsEntryName("3수") == true)) and sma1 > sma3+PriceScale*3 Then { Sell("3도"); Buy("SB1",AtStop,C+PriceScale*8); } if MarketPosition == -1 and IsEntryName("3도") == true and highest(H,BarsSinceEntry) < EntryPrice+PriceScale*8 Then Buy("SB2",AtStop,EntryPrice+PriceScale*8); if (MarketPosition == 0 or (MarketPosition == -1 and IsEntryName("3도") == true)) and sma1 < sma3-PriceScale*3 Then { Buy("3수"); sell("BS1",AtStop,C-PriceScale*8); } if MarketPosition == 1 and IsEntryName("3수") == true and lowest(L,BarsSinceEntry) > EntryPrice-PriceScale*8 Then sell("BS2",AtStop,EntryPrice-PriceScale*8); if MarketPosition == 1 and IsEntryName("3수") == False Then SetStopTrailing(PriceScale*4,PriceScale*15, Pointstop); Else if MarketPosition == -1 and IsEntryName("3도") == False Then SetStopTrailing(PriceScale*4,PriceScale*15, Pointstop); Else SetStopTrailing(0,0); 즐거운 하루되세요 > tnsflwls 님이 쓴 글입니다. > 제목 : 수식종료후 매매시작 수식작성 > 수고 하십니다 ! Input : Period1(1), Period2(10), Period3(35), Period4(60), Period5(120),period6(240),Period7(480), Period8(960), Period9(1920), Period10(3840),period11(7680); var : Sma1(0),Sma2(0),Sma3(0),Sma4(0),Sma5(0),sma6(0),Sma7(0),Sma8(0),Sma9(0),Sma10(0),sma11(0); Sma1 = ma(C,Period1); Sma2 = ma(C,Period2); Sma3 = ma(C,Period3); Sma4 = ma(C,Period4); Sma5 = ma(C,Period5); sma6 = ma(c,period6); Sma7 = ma(C,Period7); Sma8 = ma(C,Period8); Sma9 = ma(C,Period9); Sma10 = ma(C,Period10); sma11 = ma(c,period11); if sma1 > sma3+PriceScale*3 Then Sell("3도"); Buy("재수",AtStop,EntryPrice+PriceScale*8); SetStopTrailing(PriceScale*4,PriceScale*15, PointStop); if sma1 < sma3-PriceScale*3 Then Buy("3수"); sell("bs",AtStop,EntryPrice-PriceScale*8); SetStopTrailing(PriceScale*4,PriceScale*15, Pointstop); 위 수식에서 예를들면 매수를 하였는데 지수가 하락을 하여 8틱이 손실이나면 청산과 동시에 매도를 하여 15틱이 이익으로가서 4틱이 이익에서 빠질때 청산을 해야 하는데 수식적용이 setstoptrailing 수식으로 적용이 안되고 8틱손실이 되어 매도체결과 동시에 청산되면서 매수를 또 체결하는데 setstoptrailing수식이 완료 될때까지 매매는 정지하는 수식을 부탁 드립니다.