커뮤니티

시스템식 부탁드립니다.

프로필 이미지
양치기
2023-02-07 12:21:58.0
1340
글번호 225770
답변완료
항상 도움 주셔서 감사합니다. 아래 시스템식에서 하루 손실제한을 100 POINT로 제한하는 시스템식 부탁드립다. #=============================================== Inputs : SL(51); Inputs : TS(10),TP(50); Inputs : T1(100),T2(15); Inputs : shortPeriod(5), longPeriod(20), SPeriod(9); Var : MACDV(0), MACDsig(0) ; ### 해외선물 새벽시간 당일청산 ### if sDate != sDate[1] Then SetStopEndofday(060000); if Bdate != Bdate[1] Then SetStopEndofday(0); ### 일매매손익에 따른 손절 ### ##### 변수셋팅 ##### MACDV = MACD(shortPeriod, longPeriod); MACDsig = ema(MACDV,SPeriod); #-------------------------------------------------------------------------------------- ##### 매매로직 ##### #-------------------------------------------------------------------------------------- if sTime >= 140000 and sTime <=2400000 or stime >= 000000 and sTime <= 070000 Then { #-------------------------------------------------------------------------------------- #---------------------- # Long Entry 매수 #---------------------- If marketposition <= 0 and macdv > macdsig and macdv > 0 Then Begin Buy("B1",OnClose,DEf,amt); End; # Long Exit 익절 및 본청 if MarketPosition == 1 Then { if MaxEntries == 1 and C > dayopen() Then { ExitLong("BP1",AtLimit,AvgEntryPrice+T1); } if MaxEntries == 2 and C > dayopen() Then ExitLong("BP2",AtLimit,AvgEntryPrice+T2); if MaxEntries == 3 and C > dayopen() Then ExitLong("BP3",AtLimit,AvgEntryPrice+T2); if MaxEntries == 3 and C > dayopen() Then ExitLong("BL",AtStop,AvgEntryPrice-T2*6); if MaxEntries == 1 and C > dayopen() Then Buy("B2",AtLimit,LatestEntryPrice(0)-T2,1); if MaxEntries == 2 and C > dayopen() Then Buy("B3",AtLimit,LatestEntryPrice(0)-T2,1); } #---------------------- # Short Entry 매도 #---------------------- If marketposition >= 0 and macdv < macdsig and macdv < 0 Then Begin Sell("S1",OnClose,DEf,amt); End; # Short Exit 익절 및 본청 if MarketPosition == -1 Then { if MaxEntries == 1 and C < dayopen() Then { ExitShort("SP1",AtLimit,AvgEntryPrice-T1); } if MaxEntries == 2 and C < dayopen() Then ExitShort("SP2",AtLimit,AvgEntryPrice-T2); if MaxEntries == 3 and C < dayopen() Then ExitShort("SP3",AtLimit,AvgEntryPrice-T2); if MaxEntries == 3 and C < dayopen() Then ExitShort("SL",AtStop,AvgEntryPrice+T2*6); if MaxEntries == 1 and C < dayopen() Then Sell("S2",AtLimit,LatestEntryPrice(0)+T2,1); if MaxEntries == 2 and C < dayopen() Then Sell("S3",AtLimit,LatestEntryPrice(0)+T2,1); } #-------------------------------------------------------------------------------------- } //매매시간 종료 #-------------------------------------------------------------------------------------- ##### 포지션 익절, 손절 ##### #-------------------------------------------------------------------------------------- ##### 스탑로스 ##### SetStopLoss(SL,PointStop); SetStopTrailing(TS,TP,PointStop); 감사합니다.
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2023-03-16 17:23:55.0

안녕하세요 예스스탁입니다. Input : 당일손실(100); Inputs : PT(50),SL(51); Inputs : TS(10),TP(50); Inputs : shortPeriod(5), longPeriod(20), SPeriod(9); Inputs : T1(100),T2(15); Var : MACDV(0), MACDsig(0) ; Var : N1(0),dayPl(0),Xcond(false); if Bdate != Bdate[1] Then { Xcond = false; N1 = NetProfit; } daypl = NetProfit-N1; if TotalTrades > TotalTrades[1] then { if daypl <= 당일손실 Then Xcond = true; if IsExitName("dbl",1) == true or IsExitName("dsl",1) == true then Xcond = true; } ### 해외선물 새벽시간 당일청산 ### if sDate != sDate[1] Then SetStopEndofday(060000); if Bdate != Bdate[1] Then SetStopEndofday(0); ### 일매매손익에 따른 손절 ### ##### 변수셋팅 ##### MACDV = MACD(shortPeriod, longPeriod); MACDsig = ema(MACDV,SPeriod); #-------------------------------------------------------------------------------------- ##### 매매로직 ##### #-------------------------------------------------------------------------------------- if sTime >= 140000 and sTime <=2400000 or stime >= 000000 and sTime <= 070000 and Xcond == False Then { #-------------------------------------------------------------------------------------- #---------------------- # Long Entry 매수 #---------------------- If marketposition <= 0 and macdv > macdsig and macdv2 > 0 Then Begin Buy("B1",OnClose,DEf,amt); End; # Long Exit 익절 및 본청 if MarketPosition == 1 Then { if MaxEntries == 1 and C > dayopen() Then { ExitLong("BP1",AtLimit,AvgEntryPrice+T1); } if MaxEntries == 2 and C > dayopen() Then ExitLong("BP2",AtLimit,AvgEntryPrice+T2); if MaxEntries == 3 and C > dayopen() Then ExitLong("BP3",AtLimit,AvgEntryPrice+T2); if MaxEntries == 3 and C > dayopen() Then ExitLong("BL",AtStop,AvgEntryPrice-T2*6); if MaxEntries == 1 and C > dayopen() Then Buy("B2",AtLimit,LatestEntryPrice(0)-T2,1); if MaxEntries == 2 and C > dayopen() Then Buy("B3",AtLimit,LatestEntryPrice(0)-T2,1); } #---------------------- # Short Entry 매도 #---------------------- # Short Entry MACD If marketposition >= 0 and macdv < macdsig and macdv2 < 0 Then Begin Sell("S1",OnClose,DEf,amt); End; # Short Exit 익절 및 본청 if MarketPosition == -1 Then { if MaxEntries == 1 and C < dayopen() Then { ExitShort("SP1",AtLimit,AvgEntryPrice-T1); } if MaxEntries == 2 and C < dayopen() Then ExitShort("SP2",AtLimit,AvgEntryPrice-T2); if MaxEntries == 3 and C < dayopen() Then ExitShort("SP3",AtLimit,AvgEntryPrice-T2); if MaxEntries == 3 and C < dayopen() Then ExitShort("SL",AtStop,AvgEntryPrice+T2*6); if MaxEntries == 1 and C < dayopen() Then Sell("S2",AtLimit,LatestEntryPrice(0)+T2,1); if MaxEntries == 2 and C < dayopen() Then Sell("S3",AtLimit,LatestEntryPrice(0)+T2,1); } if MarketPosition == 1 then { ExitLong("dbl",AtStop,EntryPrice-((당일손실+daypl)/CurrentContracts)); } if MarketPosition == -1 then { ExitShort("dsl",AtStop,EntryPrice+((당일손실+daypl)/CurrentContracts)); } #-------------------------------------------------------------------------------------- } //매매시간 종료 #-------------------------------------------------------------------------------------- ##### 포지션 익절, 손절 ##### #-------------------------------------------------------------------------------------- ##### 스탑로스 ##### SetStopLoss(SL,PointStop); SetStopTrailing(TS,TP,PointStop); 즐거운 하루되세요 > 양치기 님이 쓴 글입니다. > 제목 : 시스템식 부탁드립니다. > 항상 도움 주셔서 감사합니다. 아래 시스템식에서 하루 손실제한을 100 POINT로 제한하는 시스템식 부탁드립다. #=============================================== Inputs : SL(51); Inputs : TS(10),TP(50); Inputs : T1(100),T2(15); Inputs : shortPeriod(5), longPeriod(20), SPeriod(9); Var : MACDV(0), MACDsig(0) ; ### 해외선물 새벽시간 당일청산 ### if sDate != sDate[1] Then SetStopEndofday(060000); if Bdate != Bdate[1] Then SetStopEndofday(0); ### 일매매손익에 따른 손절 ### ##### 변수셋팅 ##### MACDV = MACD(shortPeriod, longPeriod); MACDsig = ema(MACDV,SPeriod); #-------------------------------------------------------------------------------------- ##### 매매로직 ##### #-------------------------------------------------------------------------------------- if sTime >= 140000 and sTime <=2400000 or stime >= 000000 and sTime <= 070000 Then { #-------------------------------------------------------------------------------------- #---------------------- # Long Entry 매수 #---------------------- If marketposition <= 0 and macdv > macdsig and macdv > 0 Then Begin Buy("B1",OnClose,DEf,amt); End; # Long Exit 익절 및 본청 if MarketPosition == 1 Then { if MaxEntries == 1 and C > dayopen() Then { ExitLong("BP1",AtLimit,AvgEntryPrice+T1); } if MaxEntries == 2 and C > dayopen() Then ExitLong("BP2",AtLimit,AvgEntryPrice+T2); if MaxEntries == 3 and C > dayopen() Then ExitLong("BP3",AtLimit,AvgEntryPrice+T2); if MaxEntries == 3 and C > dayopen() Then ExitLong("BL",AtStop,AvgEntryPrice-T2*6); if MaxEntries == 1 and C > dayopen() Then Buy("B2",AtLimit,LatestEntryPrice(0)-T2,1); if MaxEntries == 2 and C > dayopen() Then Buy("B3",AtLimit,LatestEntryPrice(0)-T2,1); } #---------------------- # Short Entry 매도 #---------------------- If marketposition >= 0 and macdv < macdsig and macdv < 0 Then Begin Sell("S1",OnClose,DEf,amt); End; # Short Exit 익절 및 본청 if MarketPosition == -1 Then { if MaxEntries == 1 and C < dayopen() Then { ExitShort("SP1",AtLimit,AvgEntryPrice-T1); } if MaxEntries == 2 and C < dayopen() Then ExitShort("SP2",AtLimit,AvgEntryPrice-T2); if MaxEntries == 3 and C < dayopen() Then ExitShort("SP3",AtLimit,AvgEntryPrice-T2); if MaxEntries == 3 and C < dayopen() Then ExitShort("SL",AtStop,AvgEntryPrice+T2*6); if MaxEntries == 1 and C < dayopen() Then Sell("S2",AtLimit,LatestEntryPrice(0)+T2,1); if MaxEntries == 2 and C < dayopen() Then Sell("S3",AtLimit,LatestEntryPrice(0)+T2,1); } #-------------------------------------------------------------------------------------- } //매매시간 종료 #-------------------------------------------------------------------------------------- ##### 포지션 익절, 손절 ##### #-------------------------------------------------------------------------------------- ##### 스탑로스 ##### SetStopLoss(SL,PointStop); SetStopTrailing(TS,TP,PointStop); 감사합니다.