커뮤니티

수식문의드립니다.

프로필 이미지
파랭
2020-06-20 23:33:56
2166
글번호 140003
답변완료
예스랭귀지에 맞게 변경 부탁드립니다. Input: FastMA(12), SlowMA(26), MacdMA(9), NCOs(4), NBars(50), Trailbar(6); Vars: MVal(0), MAvg(0), MDif(0), TotalBars(0), HighestHi(0), LowestLo(0); Array: CO[2,50](0); MVal = MACD(Close, FastMA, SlowMA); MAvg = XAverage(MACD(Close, FastMA, SlowMA), MacdMA); MDif = MAval - MAvg; {Store the MACD Cross information in the CO array} If MDif Crosses Over 0 OR MDIF Crosses Under 0 Then Begin For counter = 0 to 49 Begin CO[0, 50-Counter] = CO[0, 49 - Counter]; CO[1, 50-Counter] = CO[1, 49 - Counter]; CO[2, 50-Counter] = CO[2, 49 - Counter]; End; CO[0,0] = BarNumber; CO[1,0] = High; CO[2,0] = Low; End; {Find the Highest High and the Lowest Low of the cross over and under bars} HighestHi = -1; LowestLo = 9999; For counter = 0 to NCOs-1 Begin If CO[1, counter] > HighestHi then HighestHi = CO[1, counter]; If CO[2, counter] < LowestLo then LowestLo = CO[2, counter]; End; {If the las N crosses coccured in the last 50 bars, then place the buy and sell orders} Totalbars = BarNumber - CO[0, NCOs -1]; If TotalBars < NBars then Begin Buy at HighestHi + Average(TrueRange,4)*0.5 stop; Sell at LowestLo - Average(TrueRange,4)*0.5 stop; End; {Trailing stop oders} ExitLong next bar at Lowest(Low, TrailBar) Stop; ExitShort next bar at Highest(High, TraiBar) Stop; 말로 풀어서 설명드리는 것보다 언어로 설명드리는게 더 편하실 것 같아 이렇게 부탁드립니다. 좋은 하루 보내세요!
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2020-06-22 13:53:46

안녕하세요 예스스탁입니다. Input: FastMA(12), SlowMA(26), MacdMA(9), NCOs(4), NBars(50), Trailbar(6); Vars: MVal(0), MAvg(0), MDif(0),counter(0), TotalBars(0), HighestHi(0), LowestLo(0); Array: CO[2,50](0); MVal = MACD(FastMA, SlowMA); MAvg = ema(MVal, MacdMA); MDif = Mval - MAvg; If crossup(MDif,0) OR CrossDown(MDIF,0) Then { For counter = 0 to 49 { CO[0, 50-Counter] = CO[0, 49 - Counter]; CO[1, 50-Counter] = CO[1, 49 - Counter]; CO[2, 50-Counter] = CO[2, 49 - Counter]; } CO[0,0] = index; CO[1,0] = High; CO[2,0] = Low; } HighestHi = -1; LowestLo = 9999; For counter = 0 to NCOs-1 Begin If CO[1, counter] > HighestHi then HighestHi = CO[1, counter]; If CO[2, counter] < LowestLo then LowestLo = CO[2, counter]; End; Totalbars = index - CO[0, NCOs -1]; If TotalBars < NBars then { Buy("b",AtStop,HighestHi + atr(4)*0.5); Sell("s",AtStop,LowestLo - atr(4)*0.5); } ExitLong("bx",AtStop,Lowest(Low, TrailBar)); ExitShort("sx",AtStop, Highest(High, TrailBar)); 즐거운 하루되세요 > 파랭 님이 쓴 글입니다. > 제목 : 수식문의드립니다. > 예스랭귀지에 맞게 변경 부탁드립니다. Input: FastMA(12), SlowMA(26), MacdMA(9), NCOs(4), NBars(50), Trailbar(6); Vars: MVal(0), MAvg(0), MDif(0), TotalBars(0), HighestHi(0), LowestLo(0); Array: CO[2,50](0); MVal = MACD(Close, FastMA, SlowMA); MAvg = XAverage(MACD(Close, FastMA, SlowMA), MacdMA); MDif = MAval - MAvg; {Store the MACD Cross information in the CO array} If MDif Crosses Over 0 OR MDIF Crosses Under 0 Then Begin For counter = 0 to 49 Begin CO[0, 50-Counter] = CO[0, 49 - Counter]; CO[1, 50-Counter] = CO[1, 49 - Counter]; CO[2, 50-Counter] = CO[2, 49 - Counter]; End; CO[0,0] = BarNumber; CO[1,0] = High; CO[2,0] = Low; End; {Find the Highest High and the Lowest Low of the cross over and under bars} HighestHi = -1; LowestLo = 9999; For counter = 0 to NCOs-1 Begin If CO[1, counter] > HighestHi then HighestHi = CO[1, counter]; If CO[2, counter] < LowestLo then LowestLo = CO[2, counter]; End; {If the las N crosses coccured in the last 50 bars, then place the buy and sell orders} Totalbars = BarNumber - CO[0, NCOs -1]; If TotalBars < NBars then Begin Buy at HighestHi + Average(TrueRange,4)*0.5 stop; Sell at LowestLo - Average(TrueRange,4)*0.5 stop; End; {Trailing stop oders} ExitLong next bar at Lowest(Low, TrailBar) Stop; ExitShort next bar at Highest(High, TraiBar) Stop; 말로 풀어서 설명드리는 것보다 언어로 설명드리는게 더 편하실 것 같아 이렇게 부탁드립니다. 좋은 하루 보내세요!