커뮤니티

재문의 드립니다~

프로필 이미지
jyck
2021-03-08 17:48:59
557
글번호 146878
답변완료
안녕하세요? 지난달에 시그널메이커에서 만든 전략을 예스로 옮기는 작업을 부탁드렷었습니다. 원글 : 71328 그리고 알려주신방법으로 테스트해보니 XAverage 함수 에러가 나서 다시 수정요청을 드렸습니다. 원글 : 71356 최종 수정해주신 수식으로 적용을 해보니 매매신호가 나와서 점검을 해보았으나 시그널메이커에서 나오는 신호와 완전히 다르게 나옵니다. 비슷하거나 유사한게 아니라 완전히 다릅니다. 다시한번 아래의 시그널메이커를 예스로 정상변환하신건지 확인한번 더 부탁드립니다. 코드 아래에 추가로 주석을 추가하였습니다. 주석 참고부탁드립니다. input : Exit_PT(200),Exit_LPT(200),BuyProfit(150),SellProfit(150),StopTick(100); //괄호안의 숫자는 틱수이며 각각 //하루최대수익틱수(매매시간내에 200틱에 도달하면 자동청산 후 종료), 하루최대손실 틱수(매매시간내에 200틱 도달하면 자동청산 후 종료), 매수진입시 익절틱수, 매도진입시 익절틱수, 매수 또는 매도진입시 손절틱수 var :SP(0); Params : TradingStartTime1(090000),TradingEndTime1(045400); //오전 9시부터 익일 새벽 4시 54분가지 매매진행하며 매매종료시간이 되면 자동청산합니다. var : Today_P( 0 ), Pre_NetProfit( 0 ), ProfitPoint( 0 ),LossPoint(0), myOpenProfit(0),TickPoint(0); Params : FastPeriod(92), SlowPeriod(109), SignalPeriod(85); SP = SignalPosition; TickPoint = OneTick * PriceScale; V0 = MACD(C, FastPeriod, SlowPeriod); V1 = XAverage(V0, SignalPeriod); if Time = 090000 Or (Time >= 090000 And (Time[1] < 090000 Or Date<>date[1])) Then Begin ProfitPoint = 0; Today_P = 0; Pre_NetProfit = NetProfit[1]; condition99 = false; condition88 = false; End; Today_P = NetProfit - Pre_NetProfit; // 하루 누적 수익 myOpenProfit = OpenPositionProfit; If (Today_P + myOpenProfit) >= (Exit_PT * TickPoint ) Then condition99 = true; If (Today_P + myOpenProfit) <= (-Exit_LPT * TickPoint) Then condition88 = true; if TradingStartTime1 < TradingEndTime1 Then Begin If TradingStartTIME1 <= TIME And TIME <= TradingEndTIME1 Then COND44 = True Else COND44 = False; End Else Begin If TradingStartTIME1 <= TIME Or TIME <= TradingEndTIME1 Then COND44 = True Else COND44 = False; End; If Cond44 = False Then Begin if SP <> 0 Then Begin ExitLong("마감 매수 청산",OnClose,def,def,CurrentContracts); ExitShort("마감 매도 청산",OnClose,def,def,CurrentContracts); End; Cond44 = False; End; ProfitPoint = Exit_PT * TickPoint - Today_P - myOpenProfit; LossPoint = Exit_LPT * TickPoint + Today_P + myOpenProfit; if 1 = Sp then Begin ExitLong("매수 익절마감", Atlimit, close + ProfitPoint); ExitLong("매수 손절마감", AtStop, close - LossPoint); ExitLong("매수 청산", Atlimit, EntryPrice + BuyProfit * TickPoint ); End Else if -1 = Sp then Begin ExitShort("매도 익절마감", Atlimit, close - ProfitPoint); ExitShort("매도 손절마감", AtStop, close + LossPoint); ExitShort("매도 청산", Atlimit, EntryPrice - SellProfit * TickPoint ); End; //지정한 시간대에만 거래 if Cond44 And false = condition99 And false = condition88 Then Begin if CrossUp(V0,V1) Then Buy("매수") Else if CrossDown(V0,V1) Then Sell("매도"); End; SetStopLoss(StopTick * TickPoint * currentcontracts ,pointstop); //TrailingStop 적용하기 Params : up_price1(135), dn_price1(100), up_price2(100), dn_price2(80),up_price3(50), dn_price3(1); //135틱 이상 수익중이다가 100틱으로 떨어질때 트레일링스탑 적용, 참고로 시그널메이커에서는 위와 같이 세팅했을 경우 135틱 이상 수익중일때만 트레일링스탑이 적용되었습니다. //그러니까 135틱 이상 수익이 발생하지 않으면 2단계(100틱 => 80틱) 3단계(50틱 => 1틱) 트레일링 스탑이 적용되지 않았습니다. var : TickSize(0); TickSize = OneTick * PriceScale; If MaxContractProfit < TickSize * (up_price1 + 10) Then SetStopTrailing(TickSize * dn_price1, TickSize * up_price1) Else if MaxContractProfit < TickSize * (up_price2 + 10) Then setstopTrailing(TickSize * dn_price2, TickSize * up_price2) Else SetStopTrailing(TickSize * dn_price3, TickSize * up_price3);
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2021-03-09 16:57:05

안녕하세요 예스스탁입니다. 해당 수식 지표와 함께 적용해 보았지만 진입시점은 모두 지표와 일치합니다. 손절매와 트레일링스탑의 동작에 차이가 있는 것 같은데 시그널메이커의 해당 함수 동작방식에 대해 확인해 볼 내용이 있습니다. 편하신 시간에 02-3453-1060으로 전화주시기 바랍니다. 즐거운 하루되세요 > jyck 님이 쓴 글입니다. > 제목 : 재문의 드립니다~ > 안녕하세요? 지난달에 시그널메이커에서 만든 전략을 예스로 옮기는 작업을 부탁드렷었습니다. 원글 : 71328 그리고 알려주신방법으로 테스트해보니 XAverage 함수 에러가 나서 다시 수정요청을 드렸습니다. 원글 : 71356 최종 수정해주신 수식으로 적용을 해보니 매매신호가 나와서 점검을 해보았으나 시그널메이커에서 나오는 신호와 완전히 다르게 나옵니다. 비슷하거나 유사한게 아니라 완전히 다릅니다. 다시한번 아래의 시그널메이커를 예스로 정상변환하신건지 확인한번 더 부탁드립니다. 코드 아래에 추가로 주석을 추가하였습니다. 주석 참고부탁드립니다. input : Exit_PT(200),Exit_LPT(200),BuyProfit(150),SellProfit(150),StopTick(100); //괄호안의 숫자는 틱수이며 각각 //하루최대수익틱수(매매시간내에 200틱에 도달하면 자동청산 후 종료), 하루최대손실 틱수(매매시간내에 200틱 도달하면 자동청산 후 종료), 매수진입시 익절틱수, 매도진입시 익절틱수, 매수 또는 매도진입시 손절틱수 var :SP(0); Params : TradingStartTime1(090000),TradingEndTime1(045400); //오전 9시부터 익일 새벽 4시 54분가지 매매진행하며 매매종료시간이 되면 자동청산합니다. var : Today_P( 0 ), Pre_NetProfit( 0 ), ProfitPoint( 0 ),LossPoint(0), myOpenProfit(0),TickPoint(0); Params : FastPeriod(92), SlowPeriod(109), SignalPeriod(85); SP = SignalPosition; TickPoint = OneTick * PriceScale; V0 = MACD(C, FastPeriod, SlowPeriod); V1 = XAverage(V0, SignalPeriod); if Time = 090000 Or (Time >= 090000 And (Time[1] < 090000 Or Date<>date[1])) Then Begin ProfitPoint = 0; Today_P = 0; Pre_NetProfit = NetProfit[1]; condition99 = false; condition88 = false; End; Today_P = NetProfit - Pre_NetProfit; // 하루 누적 수익 myOpenProfit = OpenPositionProfit; If (Today_P + myOpenProfit) >= (Exit_PT * TickPoint ) Then condition99 = true; If (Today_P + myOpenProfit) <= (-Exit_LPT * TickPoint) Then condition88 = true; if TradingStartTime1 < TradingEndTime1 Then Begin If TradingStartTIME1 <= TIME And TIME <= TradingEndTIME1 Then COND44 = True Else COND44 = False; End Else Begin If TradingStartTIME1 <= TIME Or TIME <= TradingEndTIME1 Then COND44 = True Else COND44 = False; End; If Cond44 = False Then Begin if SP <> 0 Then Begin ExitLong("마감 매수 청산",OnClose,def,def,CurrentContracts); ExitShort("마감 매도 청산",OnClose,def,def,CurrentContracts); End; Cond44 = False; End; ProfitPoint = Exit_PT * TickPoint - Today_P - myOpenProfit; LossPoint = Exit_LPT * TickPoint + Today_P + myOpenProfit; if 1 = Sp then Begin ExitLong("매수 익절마감", Atlimit, close + ProfitPoint); ExitLong("매수 손절마감", AtStop, close - LossPoint); ExitLong("매수 청산", Atlimit, EntryPrice + BuyProfit * TickPoint ); End Else if -1 = Sp then Begin ExitShort("매도 익절마감", Atlimit, close - ProfitPoint); ExitShort("매도 손절마감", AtStop, close + LossPoint); ExitShort("매도 청산", Atlimit, EntryPrice - SellProfit * TickPoint ); End; //지정한 시간대에만 거래 if Cond44 And false = condition99 And false = condition88 Then Begin if CrossUp(V0,V1) Then Buy("매수") Else if CrossDown(V0,V1) Then Sell("매도"); End; SetStopLoss(StopTick * TickPoint * currentcontracts ,pointstop); //TrailingStop 적용하기 Params : up_price1(135), dn_price1(100), up_price2(100), dn_price2(80),up_price3(50), dn_price3(1); //135틱 이상 수익중이다가 100틱으로 떨어질때 트레일링스탑 적용, 참고로 시그널메이커에서는 위와 같이 세팅했을 경우 135틱 이상 수익중일때만 트레일링스탑이 적용되었습니다. //그러니까 135틱 이상 수익이 발생하지 않으면 2단계(100틱 => 80틱) 3단계(50틱 => 1틱) 트레일링 스탑이 적용되지 않았습니다. var : TickSize(0); TickSize = OneTick * PriceScale; If MaxContractProfit < TickSize * (up_price1 + 10) Then SetStopTrailing(TickSize * dn_price1, TickSize * up_price1) Else if MaxContractProfit < TickSize * (up_price2 + 10) Then setstopTrailing(TickSize * dn_price2, TickSize * up_price2) Else SetStopTrailing(TickSize * dn_price3, TickSize * up_price3);