커뮤니티

전략변환~

프로필 이미지
jyck
2021-03-04 20:38:59
805
글번호 146798
답변완료
안녕하세요? 시그널메이커에서 예스로 이사중입니다.변환 부탁드립니다.^^ Params : Exit_Loss(200), Exit_Profit_Today(900), Exit_Loss_Today(240), BuyProfit(450), SellProfit(450); Params : TradingStartTime(111800), TradingEndTIME(034500); Params : trailing_up_price1(150), trailing_stop_price1(130),trailing_up_price2(90), trailing_stop_price2(80),trailing_up_price3(50), trailing_stop_price3(1), up_price_high(145), up_price_high_stop(20), x_value(60); vars : t1(1), Today_P(0), Pre_NetProfit(0), LossPoint(0), ProfitPoint(0), myOpenProfit(0), TickPoint(0); Vars : SP(0), R(0), R_1(0), S(0), S_1(0); Vars : st(0), et(0); V1 = Dayofweek((10000 * Year(D)) + (100 * 3) + 1); If V1 = 0 Then Value2 = 8 Else Value2 = 15 - V1; // 3월 두번째 일요일 날짜 V2 = Dayofweek((10000 * Year(D)) + (100 * 11) + 1); If V2 = 0 Then Value4 = 1 Else value4 = 8 - V2; // 11월 첫번째 일요일 날짜 If date > (10000 * Year(D)) + (100 * 3) + value2 And date < (10000 * Year(D)) + (100 * 11) + value4 Then Begin st = 070000; // 써머타임 적용 시, 장시작 시간 et = 060000; // 써머타임 적용 시, 장종료 시간 End Else Begin st = 080000; // 장 시작 시간 et = 070000; // 장 종료 시간 End; condition1 = (IntPortion(time/10000) > IntPortion(et/10000) And IntPortion(time[1]/10000) <= IntPortion(et/10000)) Or st <> st[1]; R = highest(H, X_value); R_1 = R[1]; S = lowest(L, X_value); S_1 = S[1]; SP = SignalPosition; TickPoint = OneTick * PriceScale; Vars : PPosit(0); if condition1 Then Begin ProfitPoint = 0; Today_P = 0; Pre_NetProfit = NetProfit[1]; Cond99 = false; pPosit = 0; End; IF ExitDate(1) = Date Then pPosit = SignalPosition(1) Else pPosit = 0; Today_P = NetProfit - Pre_NetProfit; // 하루 누적 수익 myOpenProfit = OpenPositionProfit; If (Today_P + myOpenProfit) >= (Exit_Profit_Today * TickPoint) Then Cond99 = true Else If (Today_P + myOpenProfit) <= -(Exit_Loss_Today * TickPoint) Then Cond99 = True; if TradingStartTime < TradingEndTIME Then Begin If TradingStartTime <= TIME And TIME <= TradingEndTIME Then COND44 = True Else COND44 = False; End Else Begin If TradingStartTime <= TIME Or TIME <= TradingEndTIME 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; LossPoint = -Exit_Loss_Today * TickPoint - Today_P - myOpenProfit; ProfitPoint = Exit_Profit_Today * 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 = Cond99 Then Begin // 매수 진입 If SP[1] <> 1 And PPosit <> 1 And time >= T1 And (CrossUp(c, R_1) Or CrossDown(C, S_1)) And C > R_1 Then Buy(); //매도 진입 If SP[1] <> -1 And PPosit <> -1 And CrossDown(C, S_1) Then Sell(); End; SetStopLoss(Exit_Loss * tickpoint); var : TickSize(0); TickSize = OneTick * PriceScale; If MaxContractProfit < TickSize * (trailing_up_price1 + 10) Then SetStopTrailing(TickSize * trailing_stop_price1, TickSize * trailing_up_price1) Else if MaxContractProfit < TickSize * (trailing_up_price2 + 10) Then setstopTrailing(TickSize * trailing_stop_price2, TickSize * trailing_up_price2) Else SetStopTrailing(TickSize * trailing_stop_price3, TickSize * trailing_up_price3); var : TickSize2(0), oC(0), oC_b1(0), oC_s1(0), oC_b2(0), oC_s2(0), oC_b3(0), oC_s3(0); TickSize2 = OneTick * PriceScale; If MaxPositionProfit >= up_price_high * TickSize2 Then Begin ExitLong("EXB12", AtStop, EntryPrice + up_price_high_stop * TickSize2); ExitShort("EXS12", AtStop, EntryPrice - up_price_high_stop * TickSize2); End;
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2021-03-05 11:18:07

안녕하세요 예스스탁입니다. input : Exit_Loss(200), Exit_Profit_Today(900), Exit_Loss_Today(240), BuyProfit(450), SellProfit(450); input : TradingStartTime(111800), TradingEndTIME(034500); input : trailing_up_price1(150), trailing_stop_price1(130),trailing_up_price2(90), trailing_stop_price2(80),trailing_up_price3(50), trailing_stop_price3(1), up_price_high(145), up_price_high_stop(20), x_value(60); vars : t1(1), Today_P(0), Pre_NetProfit(0), LossPoint(0), ProfitPoint(0), myOpenProfit(0), TickPoint(0); Vars : SP(0), R(0), R_1(0), S(0), S_1(0); Vars : st(0), et(0),Year(0),V1(0),V2(0),cond99(False),COND44(False); Year = Floor(sdate/10000); V1 = Dayofweek((10000 * Year) + (100 * 3) + 1); If V1 == 0 Then Value2 = 8; Else Value2 = 15 - V1; // 3월 두번째 일요일 날짜 V2 = Dayofweek((10000 * Year) + (100 * 11) + 1); If V2 == 0 Then Value4 = 1; Else value4 = 8 - V2; // 11월 첫번째 일요일 날짜 If sdate > (10000 * Year) + (100 * 3) + value2 And sdate < (10000 * Year) + (100 * 11) + value4 Then Begin st = 070000; // 써머타임 적용 시, 장시작 시간 et = 060000; // 써머타임 적용 시, 장종료 시간 End Else Begin st = 080000; // 장 시작 시간 et = 070000; // 장 종료 시간 End; condition1 = (IntPortion(stime/10000) > IntPortion(et/10000) And IntPortion(stime[1]/10000) <= IntPortion(et/10000)) Or st <> st[1]; R = highest(H, X_value); R_1 = R[1]; S = lowest(L, X_value); S_1 = S[1]; SP = MarketPosition; TickPoint = PriceScale; Vars : PPosit(0); if condition1 Then Begin ProfitPoint = 0; Today_P = 0; Pre_NetProfit = NetProfit[1]; Cond99 = false; pPosit = 0; End; IF ExitDate(1) == Date Then pPosit = MarketPosition(1); Else pPosit = 0; Today_P = NetProfit - Pre_NetProfit; // 하루 누적 수익 myOpenProfit = OpenPositionProfit; If (Today_P + myOpenProfit) >= (Exit_Profit_Today * TickPoint) Then Cond99 = true; Else If (Today_P + myOpenProfit) <= -(Exit_Loss_Today * TickPoint) Then Cond99 = True; if TradingStartTime < TradingEndTIME Then Begin If TradingStartTime <= sTIME And sTIME <= TradingEndTIME Then COND44 = True; Else COND44 = False; End Else Begin If TradingStartTime <= sTIME Or sTIME <= TradingEndTIME 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; LossPoint = -Exit_Loss_Today * TickPoint - Today_P - myOpenProfit; ProfitPoint = Exit_Profit_Today * 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 == Cond99 Then Begin // 매수 진입 If SP[1] <> 1 And PPosit <> 1 And time >= T1 And (CrossUp(c, R_1) Or CrossDown(C, S_1)) And C > R_1 Then Buy(); //매도 진입 If SP[1] <> -1 And PPosit <> -1 And CrossDown(C, S_1) Then Sell(); End; SetStopLoss(Exit_Loss * tickpoint); var : TickSize(0); TickSize = PriceScale; If MaxPositionProfit < TickSize * (trailing_up_price1 + 10) Then SetStopTrailing(TickSize * trailing_stop_price1, TickSize * trailing_up_price1,PointStop); Else if MaxPositionProfit < TickSize * (trailing_up_price2 + 10) Then setstopTrailing(TickSize * trailing_stop_price2, TickSize * trailing_up_price2,PointStop); Else SetStopTrailing(TickSize * trailing_stop_price3, TickSize * trailing_up_price3,PointStop); var : TickSize2(0), oC(0), oC_b1(0), oC_s1(0), oC_b2(0), oC_s2(0), oC_b3(0), oC_s3(0); TickSize2 = PriceScale; If MaxPositionProfit >= up_price_high * TickSize2 Then Begin ExitLong("EXB12", AtStop, EntryPrice + up_price_high_stop * TickSize2); ExitShort("EXS12", AtStop, EntryPrice - up_price_high_stop * TickSize2); End; 즐거운 하루되세요 > jyck 님이 쓴 글입니다. > 제목 : 전략변환~ > 안녕하세요? 시그널메이커에서 예스로 이사중입니다.변환 부탁드립니다.^^ Params : Exit_Loss(200), Exit_Profit_Today(900), Exit_Loss_Today(240), BuyProfit(450), SellProfit(450); Params : TradingStartTime(111800), TradingEndTIME(034500); Params : trailing_up_price1(150), trailing_stop_price1(130),trailing_up_price2(90), trailing_stop_price2(80),trailing_up_price3(50), trailing_stop_price3(1), up_price_high(145), up_price_high_stop(20), x_value(60); vars : t1(1), Today_P(0), Pre_NetProfit(0), LossPoint(0), ProfitPoint(0), myOpenProfit(0), TickPoint(0); Vars : SP(0), R(0), R_1(0), S(0), S_1(0); Vars : st(0), et(0); V1 = Dayofweek((10000 * Year(D)) + (100 * 3) + 1); If V1 = 0 Then Value2 = 8 Else Value2 = 15 - V1; // 3월 두번째 일요일 날짜 V2 = Dayofweek((10000 * Year(D)) + (100 * 11) + 1); If V2 = 0 Then Value4 = 1 Else value4 = 8 - V2; // 11월 첫번째 일요일 날짜 If date > (10000 * Year(D)) + (100 * 3) + value2 And date < (10000 * Year(D)) + (100 * 11) + value4 Then Begin st = 070000; // 써머타임 적용 시, 장시작 시간 et = 060000; // 써머타임 적용 시, 장종료 시간 End Else Begin st = 080000; // 장 시작 시간 et = 070000; // 장 종료 시간 End; condition1 = (IntPortion(time/10000) > IntPortion(et/10000) And IntPortion(time[1]/10000) <= IntPortion(et/10000)) Or st <> st[1]; R = highest(H, X_value); R_1 = R[1]; S = lowest(L, X_value); S_1 = S[1]; SP = SignalPosition; TickPoint = OneTick * PriceScale; Vars : PPosit(0); if condition1 Then Begin ProfitPoint = 0; Today_P = 0; Pre_NetProfit = NetProfit[1]; Cond99 = false; pPosit = 0; End; IF ExitDate(1) = Date Then pPosit = SignalPosition(1) Else pPosit = 0; Today_P = NetProfit - Pre_NetProfit; // 하루 누적 수익 myOpenProfit = OpenPositionProfit; If (Today_P + myOpenProfit) >= (Exit_Profit_Today * TickPoint) Then Cond99 = true Else If (Today_P + myOpenProfit) <= -(Exit_Loss_Today * TickPoint) Then Cond99 = True; if TradingStartTime < TradingEndTIME Then Begin If TradingStartTime <= TIME And TIME <= TradingEndTIME Then COND44 = True Else COND44 = False; End Else Begin If TradingStartTime <= TIME Or TIME <= TradingEndTIME 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; LossPoint = -Exit_Loss_Today * TickPoint - Today_P - myOpenProfit; ProfitPoint = Exit_Profit_Today * 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 = Cond99 Then Begin // 매수 진입 If SP[1] <> 1 And PPosit <> 1 And time >= T1 And (CrossUp(c, R_1) Or CrossDown(C, S_1)) And C > R_1 Then Buy(); //매도 진입 If SP[1] <> -1 And PPosit <> -1 And CrossDown(C, S_1) Then Sell(); End; SetStopLoss(Exit_Loss * tickpoint); var : TickSize(0); TickSize = OneTick * PriceScale; If MaxContractProfit < TickSize * (trailing_up_price1 + 10) Then SetStopTrailing(TickSize * trailing_stop_price1, TickSize * trailing_up_price1) Else if MaxContractProfit < TickSize * (trailing_up_price2 + 10) Then setstopTrailing(TickSize * trailing_stop_price2, TickSize * trailing_up_price2) Else SetStopTrailing(TickSize * trailing_stop_price3, TickSize * trailing_up_price3); var : TickSize2(0), oC(0), oC_b1(0), oC_s1(0), oC_b2(0), oC_s2(0), oC_b3(0), oC_s3(0); TickSize2 = OneTick * PriceScale; If MaxPositionProfit >= up_price_high * TickSize2 Then Begin ExitLong("EXB12", AtStop, EntryPrice + up_price_high_stop * TickSize2); ExitShort("EXS12", AtStop, EntryPrice - up_price_high_stop * TickSize2); End;