커뮤니티

제가 테스트로 만든 매도 시스템 인데요.

프로필 이미지
초딩트레이더
2020-02-21 09:05:33
384
글번호 136177
답변완료
제가 테스트로 만든 매도 시스템 인데요. 1:50 분에 행잉맨이 발생하면 2:20 분에 close < high[1] 이면 매도 2:30 분에 close < high[1] 이면 매도 이런 단순한 프로그램인데요. 이 시스템이 생성한 파일을 보면 매도가 발생했다는 메시지가 나오는데요. 실제 매도는 안되요(매도 시스템을 적용했을때요) 한달 내내 이문제로 씨름 하고 있는데요 뭐가 문제인지 도저히 알수가 없어서.. 고수님들께 문의 드려요. 아래 파일을 한번 봐주시면 감사드리겠습니다. ---------------------------------------------------- input : starttime(220000),endtime(020000),intervalMin(2),intervalHammer(4),interval25(1), interval30(2),deceisionDuration(1),hat(1.3),head(1.4),pricegap(0.07); var : S1(0),D1(0),TM(0),TF(0); var : CurMin(0); var : curTime(0); var : con2(False); var : file_name("c:₩dantawang4-gc-xxxxxxxx.csv"); curMin = TimeToMinutes(time)-TimeToMinutes(sTime); if(NextBarOpen > 0) Then { Print(file_name,"bar open 봉번호=%f 봉시작=%f 봉끝=%f barsinceentry[0]=%f BarsSinceEntry=%f " ,index, sTime,Time, BarsSinceEntry[0],BarsSinceEntry); if HangingMan2(hat, head, pricegap) == True Then { con2 = True; Print(file_name, "xHangingMan2--------------------------------------------------------------------------!"); Print(file_name,"[x-curtime=%f time=%f curmin=%f con2=%s time to create hanginman", CurrentTime(),time, curMin, con2 ); Value1 = time; #CurrentTime() ; } } #MessageLog("curmin=%f intervalHammer=%f Close=%f", curmin, intervalHammer, Close); Print(file_name,"curTime=%f time=%f curMin >= IntervalHammer %f >= %f " ,CurrentTime(),time, curmin, intervalHammer); #Print(file_name, " %f current HangingMan2 time now!" , curTime); if curMin >= IntervalHammer then { Print(file_name," [curtime=%f time=%f Value1time=%f stime=%f con2=%s] <----------",CurrentTime(),time, Value1, stime,con2); Print(file_name," TimeToMinutes(time) - TimeToMinutes(Value1)=%f TimeToMinutes(currunt) - TimeToMinutes(Value1)=%f",TimeToMinutes(time) - TimeToMinutes(Value1), TimeToMinutes(CurrentTime()) - TimeToMinutes(Value1)); Print(file_name, "%f %f e(%f>=%f) " , TimeToMinutes(time) , TimeToMinutes(Value1) , TimeToMinutes(time) - TimeToMinutes(Value1) , intervalMin); if( con2 == True and ( TimeToMinutes(time) - TimeToMinutes(Value1) >= IntervalMin) ) Then { #curTime = CurrentTime() + 1 ; Print(file_name, "curTime=%f %f exit time!" ,CurrentTime(), Value1); Condition10 = False; Condition1 = False; con2 = False; Value10 = 0.0; } } #----해머나 행잉맨을 찾은 후에-------------------------------------------------------------------------- #-----condition10=true이면 #25-30 분 사이에 결정. Print(file_name , "%f curMin >= interval25 %f >= %f and %f < %f" ,time, curMin, interval25 ,curMin , Interval25 + deceisionDuration ); if curMin >= interval25 and curMin < Interval25 + deceisionDuration then { Print(file_name , "1---------------------------------------------"); Print(file_name , "curTime=%f time=%f Close=%f < Close[1]=%f ",CurrentTime(), time,Close, Close[1]); if( con2 == True and Close < Close[1] ) Then { #Sell("sell1"); #sell("s",AtMarket); Sell ("HM", AtStop,High[1]); MessageLog("HangingMan sell!"); Print(file_name, "curTime=%f time=%f HangingMan sell! ",CurrentTime(), time); Print(file_name,"curTime=%f time=%f High[1]=%f Low[1]=%f Close[1]=%f",CurrentTime(), time,High[1], Low[1], Close[1]); Condition10 = false; con2 = false; Condition1 = false; } } #----해머나 행잉맨을 찾은 후에-------------------------------------------------------------------------- #-----condition10=true이면 #30-35 분 사이에 결정. Print(file_name , "curTime=%f time=%f curMin >= interval30 %f >= %f and %f < %f" ,CurrentTime(), time,curMin, interval30 ,curMin , interval30 + deceisionDuration ); if curMin >= interval30 and curMin < Interval30 + deceisionDuration then { Print(file_name , "2---------------------------------------------"); Print(file_name , "curTime=%f time=%f Close < Close[1] Close=%f < Close[1]=%f ",CurrentTime(),time, Close, Close[1]); if( con2 == True and Close < Close[1] ) Then { #if MarketPosition[0] == 0 Then{ #Sell("sell2"); #sell("s2",AtMarket); Sell ("HM2", AtStop,High[1]); Print(file_name, "curTime=%f time=%f HangingMan sell! ",CurrentTime(), time); Print(file_name,"curTime=%f time=%f High[1]=%f Low[1]=%f Close[1]=%f",CurrentTime(), time,High[1], Low[1], Close[1]); #} Condition10 = false; con2 = false; Condition1 = false; #Value10 = 0.0; } } # Condition1 == true 이면 다음 시그널 시작 #특정 시간 이후 청산. if BarsSinceEntry == 1 Then { Print(file_name, "curTime=%f time=%f EXIT SHORT! ", CurrentTime(),time); exitShort(); } if MarketPosition[0] == -1 AND BarsSinceEntry == 0 AND High > High[1] Then { Print(file_name,"------------------------reached high!=============="); Print(file_name,"curTime=%f time=%f High[1]=%f", CurrentTime(),time,High[1]); Print(file_name,"------------------------reached high!=============="); exitShort(); } if MarketPosition[0] == -1 AND BarsSinceEntry == 1 AND High > High[2] Then { Print(file_name,"------------------------reached high!=============="); Print(file_name,"curTime=%f time=%f High[2]=%f", CurrentTime(), time,High[2]); Print(file_name,"------------------------reached high!=============="); exitShort(); }
시스템
답변 2
프로필 이미지

예스스탁 예스스탁 답변

2020-02-21 13:09:45

안녕하세요 예스스탁입니다. if 조건 then { Sell ("HM", AtStop,High[1]); MessageLog("HangingMan sell!"); Print(file_name, "curTime=%f time=%f HangingMan sell! ",CurrentTime(), time); Print(file_name,"curTime=%f time=%f High[1]=%f Low[1]=%f Close[1]=%f",CurrentTime(), time,High[1], Low[1], Close[1]); } 작성하신 신호에는 atstop타입이 사용되었습니다. atstop은 봉완성시에 지정한 가격을 셋팅하고 다음봉의 현재가가 해당 가격이하의 시세가 발생할때 신호가 발생합니다. 위 수식이라면 현재봉의 봉완성시 if조건이 만족하면 전봉의 고가(현재 완성봉이 아닌 전봉의 고가)를 셋팅, 메세지로그와 print를 출력하게 됩니다. 즉 신호가 발생할때 메세지로그나 프린트가 출력되는 것이 아니고 atstop이 셋팅된 봉에 출력됩니다. 가격이 셋팅되고 다음봉의 시세가 전봉의 고가 이하의 시세가 발생하지 않으면 신호는 발생하지 않습니다. 즐거운 하루되세요 > 초딩트레이더 님이 쓴 글입니다. > 제목 : 제가 테스트로 만든 매도 시스템 인데요. > 제가 테스트로 만든 매도 시스템 인데요. 1:50 분에 행잉맨이 발생하면 2:20 분에 close < high[1] 이면 매도 2:30 분에 close < high[1] 이면 매도 이런 단순한 프로그램인데요. 이 시스템이 생성한 파일을 보면 매도가 발생했다는 메시지가 나오는데요. 실제 매도는 안되요(매도 시스템을 적용했을때요) 한달 내내 이문제로 씨름 하고 있는데요 뭐가 문제인지 도저히 알수가 없어서.. 고수님들께 문의 드려요. 아래 파일을 한번 봐주시면 감사드리겠습니다. ---------------------------------------------------- input : starttime(220000),endtime(020000),intervalMin(2),intervalHammer(4),interval25(1), interval30(2),deceisionDuration(1),hat(1.3),head(1.4),pricegap(0.07); var : S1(0),D1(0),TM(0),TF(0); var : CurMin(0); var : curTime(0); var : con2(False); var : file_name("c:₩dantawang4-gc-xxxxxxxx.csv"); curMin = TimeToMinutes(time)-TimeToMinutes(sTime); if(NextBarOpen > 0) Then { Print(file_name,"bar open 봉번호=%f 봉시작=%f 봉끝=%f barsinceentry[0]=%f BarsSinceEntry=%f " ,index, sTime,Time, BarsSinceEntry[0],BarsSinceEntry); if HangingMan2(hat, head, pricegap) == True Then { con2 = True; Print(file_name, "xHangingMan2--------------------------------------------------------------------------!"); Print(file_name,"[x-curtime=%f time=%f curmin=%f con2=%s time to create hanginman", CurrentTime(),time, curMin, con2 ); Value1 = time; #CurrentTime() ; } } #MessageLog("curmin=%f intervalHammer=%f Close=%f", curmin, intervalHammer, Close); Print(file_name,"curTime=%f time=%f curMin >= IntervalHammer %f >= %f " ,CurrentTime(),time, curmin, intervalHammer); #Print(file_name, " %f current HangingMan2 time now!" , curTime); if curMin >= IntervalHammer then { Print(file_name," [curtime=%f time=%f Value1time=%f stime=%f con2=%s] <----------",CurrentTime(),time, Value1, stime,con2); Print(file_name," TimeToMinutes(time) - TimeToMinutes(Value1)=%f TimeToMinutes(currunt) - TimeToMinutes(Value1)=%f",TimeToMinutes(time) - TimeToMinutes(Value1), TimeToMinutes(CurrentTime()) - TimeToMinutes(Value1)); Print(file_name, "%f %f e(%f>=%f) " , TimeToMinutes(time) , TimeToMinutes(Value1) , TimeToMinutes(time) - TimeToMinutes(Value1) , intervalMin); if( con2 == True and ( TimeToMinutes(time) - TimeToMinutes(Value1) >= IntervalMin) ) Then { #curTime = CurrentTime() + 1 ; Print(file_name, "curTime=%f %f exit time!" ,CurrentTime(), Value1); Condition10 = False; Condition1 = False; con2 = False; Value10 = 0.0; } } #----해머나 행잉맨을 찾은 후에-------------------------------------------------------------------------- #-----condition10=true이면 #25-30 분 사이에 결정. Print(file_name , "%f curMin >= interval25 %f >= %f and %f < %f" ,time, curMin, interval25 ,curMin , Interval25 + deceisionDuration ); if curMin >= interval25 and curMin < Interval25 + deceisionDuration then { Print(file_name , "1---------------------------------------------"); Print(file_name , "curTime=%f time=%f Close=%f < Close[1]=%f ",CurrentTime(), time,Close, Close[1]); if( con2 == True and Close < Close[1] ) Then { #Sell("sell1"); #sell("s",AtMarket); Sell ("HM", AtStop,High[1]); MessageLog("HangingMan sell!"); Print(file_name, "curTime=%f time=%f HangingMan sell! ",CurrentTime(), time); Print(file_name,"curTime=%f time=%f High[1]=%f Low[1]=%f Close[1]=%f",CurrentTime(), time,High[1], Low[1], Close[1]); Condition10 = false; con2 = false; Condition1 = false; } } #----해머나 행잉맨을 찾은 후에-------------------------------------------------------------------------- #-----condition10=true이면 #30-35 분 사이에 결정. Print(file_name , "curTime=%f time=%f curMin >= interval30 %f >= %f and %f < %f" ,CurrentTime(), time,curMin, interval30 ,curMin , interval30 + deceisionDuration ); if curMin >= interval30 and curMin < Interval30 + deceisionDuration then { Print(file_name , "2---------------------------------------------"); Print(file_name , "curTime=%f time=%f Close < Close[1] Close=%f < Close[1]=%f ",CurrentTime(),time, Close, Close[1]); if( con2 == True and Close < Close[1] ) Then { #if MarketPosition[0] == 0 Then{ #Sell("sell2"); #sell("s2",AtMarket); Sell ("HM2", AtStop,High[1]); Print(file_name, "curTime=%f time=%f HangingMan sell! ",CurrentTime(), time); Print(file_name,"curTime=%f time=%f High[1]=%f Low[1]=%f Close[1]=%f",CurrentTime(), time,High[1], Low[1], Close[1]); #} Condition10 = false; con2 = false; Condition1 = false; #Value10 = 0.0; } } # Condition1 == true 이면 다음 시그널 시작 #특정 시간 이후 청산. if BarsSinceEntry == 1 Then { Print(file_name, "curTime=%f time=%f EXIT SHORT! ", CurrentTime(),time); exitShort(); } if MarketPosition[0] == -1 AND BarsSinceEntry == 0 AND High > High[1] Then { Print(file_name,"------------------------reached high!=============="); Print(file_name,"curTime=%f time=%f High[1]=%f", CurrentTime(),time,High[1]); Print(file_name,"------------------------reached high!=============="); exitShort(); } if MarketPosition[0] == -1 AND BarsSinceEntry == 1 AND High > High[2] Then { Print(file_name,"------------------------reached high!=============="); Print(file_name,"curTime=%f time=%f High[2]=%f", CurrentTime(), time,High[2]); Print(file_name,"------------------------reached high!=============="); exitShort(); }
프로필 이미지

초딩트레이더

2020-02-22 13:39:45

네 감사합니다. sell("" , atmarket)을 사용하면 되겟네요? 한번 해볼게요. 너무 감사합니다.