커뮤니티

추가 문의 드립니다.

프로필 이미지
jyck
2021-03-04 20:24:50
877
글번호 146797
답변완료
원글번호 : 71328 안녕하세요? 지난번 시그널메이커의 수식을 예스로 옮기는 수식을 부탁했었습니다. YesLanguage 편집기에서 수식검증을 하면 선언되지 않은 이름 'XAverage'이(가) 사용되었습니다. 라는 오류가 나타납니다.
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2021-03-05 10:29:21

안녕하세요 예스스탁입니다. 죄송합니다. XAverage를 별도로 사용자함수로 만들어 가지고 있어 해당 부분을 간과했습니다. 예스랭귀지에서 지수이동평균을 계산하는 ema입니다.아래는 수정한식입니다. input : Exit_PT(200),Exit_LPT(200),BuyProfit(150),SellProfit(150),StopTick(100); var : SP(0),V0(0),V1(0),Cond44(False); input : TradingStartTime1(090000),TradingEndTime1(045400); var : Today_P( 0 ), Pre_NetProfit( 0 ), ProfitPoint( 0 ),LossPoint(0), myOpenProfit(0),TickPoint(0); input : FastPeriod(92), SlowPeriod(109), SignalPeriod(85); SP = MarketPosition; TickPoint = PriceScale; V0 = MACD(FastPeriod, SlowPeriod); V1 = Ema(V0, SignalPeriod); if sTime == 090000 Or (sTime >= 090000 And (sTime[1] < 090000 Or bDate<>bdate[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 <= sTIME And sTIME <= TradingEndTIME1 Then COND44 = True; Else COND44 = False; End Else Begin If TradingStartTIME1 <= sTIME Or sTIME <= 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,pointstop); //Trailing 적용하기 input : up_price1(135), dn_price1(100), up_price2(100), dn_price2(80),up_price3(50), dn_price3(1); var : TickSize(0); TickSize = PriceScale; If MaxPositionProfit < TickSize * (up_price1 + 10) Then SetStopTrailing(TickSize * dn_price1, TickSize * up_price1,PointStop); Else if MaxPositionProfit < TickSize * (up_price2 + 10) Then setstopTrailing(TickSize * dn_price2, TickSize * up_price2,PointStop); Else SetStopTrailing(TickSize * dn_price3, TickSize * up_price3,PointStop); 즐거운 하루되세요 > jyck 님이 쓴 글입니다. > 제목 : 추가 문의 드립니다. > 원글번호 : 71328 안녕하세요? 지난번 시그널메이커의 수식을 예스로 옮기는 수식을 부탁했었습니다. YesLanguage 편집기에서 수식검증을 하면 선언되지 않은 이름 'XAverage'이(가) 사용되었습니다. 라는 오류가 나타납니다.