커뮤니티

수식어 부탁드립니다

프로필 이미지
푸른
2020-08-24 13:13:28
1101
글번호 141716
답변완료

첨부 이미지

Input : short(12), long(26), signal(9),Profit(20),Drop(10); input : StartTime(70000),EndTime(55000); var : Tcond(false); Var : MACDv(0), MACDs(0),macdo(0) ; if (sdate != sdate[1] and stime >= StartTime) or (sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then Tcond = true; if (sdate != sdate[1] and stime >= EndTime) or (sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then Tcond = False; MACDv = MACD(short, long); MACDs = ema(MACDv,signal); macdo = MACDv-MACDs; if Tcond == true then { if MarketPosition <= 0 and crossup(MACDO,0) Then buy("b"); if MarketPosition >= 0 and CrossDown(MACDO,0) Then sell("s"); if MarketPosition == 1 then { if highest(H,BarsSinceEntry) >= EntryPrice+Profit then { ExitLong("bx",AtStop,highest(H,BarsSinceEntry)-drop); } } if MarketPosition == 1 then { if Lowest(L,BarsSinceEntry) <= EntryPrice-Profit then { ExitShort("sx",AtStop,Lowest(L,BarsSinceEntry)+drop); } } } if EndTime > StartTime Then SetStopEndofday(EndTime); Else { if sdate != sdate[1] Then SetStopEndofday(EndTime); if bdate != bdate[1] Then SetStopEndofday(0); } ---------------------------- 수식어를 통한 특정기간,시간의 진입 신호가 나오질 않아서 문의 드립니다
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2020-08-25 09:58:24

안녕하세요 예스스탁입니다. 시작시간 체크와 끝시간체크 조건이 동시에 충족이되면 식작성상 하단에 위치한 Tcond = False;이 적용됩니다. 시간조건 내용의 위치를 서로 변경하시면 됩니다. Input : short(12), long(26), signal(9),Profit(20),Drop(10); input : StartTime(70000),EndTime(55000); var : Tcond(false); Var : MACDv(0), MACDs(0),macdo(0) ; if (sdate != sdate[1] and stime >= EndTime) or (sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then Tcond = False; if (sdate != sdate[1] and stime >= StartTime) or (sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then Tcond = true; MACDv = MACD(short, long); MACDs = ema(MACDv,signal); macdo = MACDv-MACDs; if Tcond == true then { if MarketPosition <= 0 and crossup(MACDO,0) Then buy("b"); if MarketPosition >= 0 and CrossDown(MACDO,0) Then sell("s"); if MarketPosition == 1 then { if highest(H,BarsSinceEntry) >= EntryPrice+Profit then { ExitLong("bx",AtStop,highest(H,BarsSinceEntry)-drop); } } if MarketPosition == 1 then { if Lowest(L,BarsSinceEntry) <= EntryPrice-Profit then { ExitShort("sx",AtStop,Lowest(L,BarsSinceEntry)+drop); } } } if EndTime > StartTime Then SetStopEndofday(EndTime); Else { if sdate != sdate[1] Then SetStopEndofday(EndTime); if bdate != bdate[1] Then SetStopEndofday(0); } 즐거운 하루되세요 > 푸른 님이 쓴 글입니다. > 제목 : 수식어 부탁드립니다 > Input : short(12), long(26), signal(9),Profit(20),Drop(10); input : StartTime(70000),EndTime(55000); var : Tcond(false); Var : MACDv(0), MACDs(0),macdo(0) ; if (sdate != sdate[1] and stime >= StartTime) or (sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then Tcond = true; if (sdate != sdate[1] and stime >= EndTime) or (sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then Tcond = False; MACDv = MACD(short, long); MACDs = ema(MACDv,signal); macdo = MACDv-MACDs; if Tcond == true then { if MarketPosition <= 0 and crossup(MACDO,0) Then buy("b"); if MarketPosition >= 0 and CrossDown(MACDO,0) Then sell("s"); if MarketPosition == 1 then { if highest(H,BarsSinceEntry) >= EntryPrice+Profit then { ExitLong("bx",AtStop,highest(H,BarsSinceEntry)-drop); } } if MarketPosition == 1 then { if Lowest(L,BarsSinceEntry) <= EntryPrice-Profit then { ExitShort("sx",AtStop,Lowest(L,BarsSinceEntry)+drop); } } } if EndTime > StartTime Then SetStopEndofday(EndTime); Else { if sdate != sdate[1] Then SetStopEndofday(EndTime); if bdate != bdate[1] Then SetStopEndofday(0); } ---------------------------- 수식어를 통한 특정기간,시간의 진입 신호가 나오질 않아서 문의 드립니다