커뮤니티

60분봉 매매 수식수정 부탁드립니다.

프로필 이미지
승부사1
2018-09-16 18:33:17
228
글번호 122083
답변완료
아래의 수식에서 1530 이후에 시그널이 발생되는 경우가 많이 있네요. 시그널은 발생하지만 매매는 되지 않는 문제가 있어서요. 1510 이후에는 매수, 매도 모두 시그널이 발생하지 않도록 수정할수 있을까요?? 부탁드립니다. 그리고 vol(1) 규정을 제외를 해보니 첫번째 시그널만 발생하고 그 뒤로는 발생하지 않습니다. vol(1) 을 설정창에서 설정할수 있도록 vol(1) 규정을 제외하고 정상작동하도록 부탁드립니다. - 아 래 - input : 타주기분(60),시작일(20180917),종료일(20181231),vol(1); var : S1(0),D1(0),TM(0),TF(0); var : CC(0),C1(0),Tcond(false),Xcond(false); if Bdate != Bdate[1] Then{ S1 = TimeToMinutes(stime); D1 = sdate; if sdate >= 시작일 and sdate[1] < 종료일 Then Tcond = true; } if Tcond == true and sdate >= 종료일 and stime >= 150000 Then { Tcond = false; ExitLong("청산"); } if TotalTrades > TotalTrades[1] Then { if LatestExitName(1) != "매도" Then Xcond = true; Else Xcond = false; } if D1 > 0 then { if sdate == D1 Then TM = TimeToMinutes(stime)-S1; Else TM = TimeToMinutes(stime)+1440-S1; TF = TM%타주기분; if Bdate != Bdate[1] or (Bdate == Bdate[1] and TF < TF[1]) Then { C1 = CC[1]; Condition1 = false; } CC = C; if Tcond == true and Condition1 == false and C1 > 0 and CC < C1 and MarketPosition == 0 and CurrentContracts < 1 and Xcond == false Then { Condition1 = true; Buy("매수",OnClose,def,vol); } if Tcond == true and Condition1 == false and C <= AvgEntryPrice and Xcond == false and MarketPosition == 1 and CurrentContracts < 19 Then { Condition1 = true; Buy("매수.",OnClose,def,vol); } if MarketPosition == 1 and Condition1 == false and C >= AvgEntryPrice*1.03 Then ExitLong("매도",OnClose,def,"",vol,2); if highest(H,BarsSinceEntry) >= EntryPrice*1.10 and highest(H,BarsSinceEntry) < EntryPrice*1.15 Then Exitlong("매도10",AtStop,EntryPrice*1.10); if highest(H,BarsSinceEntry) >= EntryPrice*1.15 and highest(H,BarsSinceEntry) < EntryPrice*1.20 Then Exitlong("매도15",AtStop,EntryPrice*1.15); if highest(H,BarsSinceEntry) >= EntryPrice*1.20 and highest(H,BarsSinceEntry) < EntryPrice*1.25 Then Exitlong("매도20",AtStop,EntryPrice*1.20); if highest(H,BarsSinceEntry) >= EntryPrice*1.25 and highest(H,BarsSinceEntry) < EntryPrice*1.30 Then Exitlong("매도25",AtStop,EntryPrice*1.25); if highest(H,BarsSinceEntry) >= EntryPrice*1.30 and highest(H,BarsSinceEntry) < EntryPrice*1.35 Then Exitlong("매도30",AtStop,EntryPrice*1.30); }
종목검색
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2018-09-17 11:05:44

안녕하세요 예스스탁입니다. 기존수식은 종료일의 15시이후에 신호가 발생하지 않습니다. 종료일 이전에는 시간제한이 없습니다. 종료일 이전에도 15시10분 이후에는 매수/매도 모두 신호가 발생하지 않게 처리해 드립니다. 수량은 수식안에서 vol로 지정하셔야 합니다. "매도"청산시에 일정수량으로 청산해야 해서 해당값이 필요합니다. 추가진입을 하는 수식은 식을 적용하실때 항상 사용자분이 피라미딩을 설정하셔야 합니다. 피라미딩을 모든진입신호허용으로 설정하고 적용하시면 됩니다. input : 타주기분(60),시작일(20180917),종료일(20181231),vol(1); var : S1(0),D1(0),TM(0),TF(0); var : CC(0),C1(0),Tcond(false),Xcond(false); if Bdate != Bdate[1] Then{ S1 = TimeToMinutes(stime); D1 = sdate; if sdate >= 시작일 and sdate[1] < 종료일 Then Tcond = true; } if Tcond == true and sdate >= 종료일 and stime >= 150000 Then { Tcond = false; ExitLong("청산"); } if TotalTrades > TotalTrades[1] Then { if LatestExitName(1) != "매도" Then Xcond = true; Else Xcond = false; } if D1 > 0 then { if sdate == D1 Then TM = TimeToMinutes(stime)-S1; Else TM = TimeToMinutes(stime)+1440-S1; TF = TM%타주기분; if Bdate != Bdate[1] or (Bdate == Bdate[1] and TF < TF[1]) Then { C1 = CC[1]; Condition1 = false; } CC = C; if Tcond == true and Condition1 == false and C1 > 0 and CC < C1 and MarketPosition == 0 and CurrentContracts < 1 and Xcond == false and stime < 151000 Then { Condition1 = true; Buy("매수",OnClose,def,vol); } if Tcond == true and Condition1 == false and C <= AvgEntryPrice and Xcond == false and MarketPosition == 1 and CurrentContracts < 19 and stime < 151000 Then { Condition1 = true; Buy("매수.",OnClose,def,vol); } if stime < 151000 then { if MarketPosition == 1 and Condition1 == false and C >= AvgEntryPrice*1.03 Then ExitLong("매도",OnClose,def,"",vol,2); if highest(H,BarsSinceEntry) >= EntryPrice*1.10 and highest(H,BarsSinceEntry) < EntryPrice*1.15 Then Exitlong("매도10",AtStop,EntryPrice*1.10); if highest(H,BarsSinceEntry) >= EntryPrice*1.15 and highest(H,BarsSinceEntry) < EntryPrice*1.20 Then Exitlong("매도15",AtStop,EntryPrice*1.15); if highest(H,BarsSinceEntry) >= EntryPrice*1.20 and highest(H,BarsSinceEntry) < EntryPrice*1.25 Then Exitlong("매도20",AtStop,EntryPrice*1.20); if highest(H,BarsSinceEntry) >= EntryPrice*1.25 and highest(H,BarsSinceEntry) < EntryPrice*1.30 Then Exitlong("매도25",AtStop,EntryPrice*1.25); if highest(H,BarsSinceEntry) >= EntryPrice*1.30 and highest(H,BarsSinceEntry) < EntryPrice*1.35 Then Exitlong("매도30",AtStop,EntryPrice*1.30); } } 즐거운 하루되세요 > 승부사1 님이 쓴 글입니다. > 제목 : 60분봉 매매 수식수정 부탁드립니다. > 아래의 수식에서 1530 이후에 시그널이 발생되는 경우가 많이 있네요. 시그널은 발생하지만 매매는 되지 않는 문제가 있어서요. 1510 이후에는 매수, 매도 모두 시그널이 발생하지 않도록 수정할수 있을까요?? 부탁드립니다. 그리고 vol(1) 규정을 제외를 해보니 첫번째 시그널만 발생하고 그 뒤로는 발생하지 않습니다. vol(1) 을 설정창에서 설정할수 있도록 vol(1) 규정을 제외하고 정상작동하도록 부탁드립니다. - 아 래 - input : 타주기분(60),시작일(20180917),종료일(20181231),vol(1); var : S1(0),D1(0),TM(0),TF(0); var : CC(0),C1(0),Tcond(false),Xcond(false); if Bdate != Bdate[1] Then{ S1 = TimeToMinutes(stime); D1 = sdate; if sdate >= 시작일 and sdate[1] < 종료일 Then Tcond = true; } if Tcond == true and sdate >= 종료일 and stime >= 150000 Then { Tcond = false; ExitLong("청산"); } if TotalTrades > TotalTrades[1] Then { if LatestExitName(1) != "매도" Then Xcond = true; Else Xcond = false; } if D1 > 0 then { if sdate == D1 Then TM = TimeToMinutes(stime)-S1; Else TM = TimeToMinutes(stime)+1440-S1; TF = TM%타주기분; if Bdate != Bdate[1] or (Bdate == Bdate[1] and TF < TF[1]) Then { C1 = CC[1]; Condition1 = false; } CC = C; if Tcond == true and Condition1 == false and C1 > 0 and CC < C1 and MarketPosition == 0 and CurrentContracts < 1 and Xcond == false Then { Condition1 = true; Buy("매수",OnClose,def,vol); } if Tcond == true and Condition1 == false and C <= AvgEntryPrice and Xcond == false and MarketPosition == 1 and CurrentContracts < 19 Then { Condition1 = true; Buy("매수.",OnClose,def,vol); } if MarketPosition == 1 and Condition1 == false and C >= AvgEntryPrice*1.03 Then ExitLong("매도",OnClose,def,"",vol,2); if highest(H,BarsSinceEntry) >= EntryPrice*1.10 and highest(H,BarsSinceEntry) < EntryPrice*1.15 Then Exitlong("매도10",AtStop,EntryPrice*1.10); if highest(H,BarsSinceEntry) >= EntryPrice*1.15 and highest(H,BarsSinceEntry) < EntryPrice*1.20 Then Exitlong("매도15",AtStop,EntryPrice*1.15); if highest(H,BarsSinceEntry) >= EntryPrice*1.20 and highest(H,BarsSinceEntry) < EntryPrice*1.25 Then Exitlong("매도20",AtStop,EntryPrice*1.20); if highest(H,BarsSinceEntry) >= EntryPrice*1.25 and highest(H,BarsSinceEntry) < EntryPrice*1.30 Then Exitlong("매도25",AtStop,EntryPrice*1.25); if highest(H,BarsSinceEntry) >= EntryPrice*1.30 and highest(H,BarsSinceEntry) < EntryPrice*1.35 Then Exitlong("매도30",AtStop,EntryPrice*1.30); }