커뮤니티

적합이평

프로필 이미지
yunmx
2018-11-01 17:05:30
232
글번호 123278
답변완료
안녕하세요? 적합이평을 아래와 같이 수정해 봤는데요.. 검증하면 마지막줄 마지막에 ; 가 잘못된 토큰이라고 아래와 같이 에러가 뜹니다. 문법 에러, 잘못된 토큰:'<File End>' 제대로 적용되는 수식으로 수정 부탁드립니다. Inputs: Period1(5), Period2(20), Period3(60); Vars: Noise(0), Signal(0), Diff(0), efRatio(0), Smooth(1), Fastest(0.6667), Slowest(0.0645), AdaptMA1(0), AdaptMA2(0), AdaptMA3(0); Diff = AbsValue(Close - Close[1]); IF CurrentBar <= Period1 Then AdaptMA1 = Close; IF CurrentBar > Period1 Then Begin Signal = AbsValue(Close - Close[Period1]); Noise = accumN(Diff, Period1); efRatio = Signal / Noise; Smooth = Power(efRatio * (Fastest - Slowest) + Slowest, 2); AdaptMA1 = AdaptMA1[1] + Smooth * (Close - AdaptMA1[1]); IF CurrentBar <= Period2 Then AdaptMA2 = Close; IF CurrentBar > Period2 Then Begin Signal = AbsValue(Close - Close[Period2]); Noise = accumN(Diff, Period1); efRatio = Signal / Noise; Smooth = Power(efRatio * (Fastest - Slowest) + Slowest, 2); AdaptMA2 = AdaptMA2[1] + Smooth * (Close - AdaptMA2[1]); IF CurrentBar <= Period3 Then AdaptMA3 = Close; IF CurrentBar > Period3 Then Begin Signal = AbsValue(Close - Close[Period3]); Noise = accumN(Diff, Period3); efRatio = Signal / Noise; Smooth = Power(efRatio * (Fastest - Slowest) + Slowest, 2); AdaptMA3 = AdaptMA3[1] + Smooth * (Close - AdaptMA3[1]); plot1(AdaptMA1,"Adaptive moving average"); plot2(AdaptMA2,"Adaptive moving average"); plot3(AdaptMA3,"Adaptive moving average");
지표
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2018-11-02 11:22:43

안녕하세요 예스스탁입니다. Inputs: Period1(5),Period2(20),Period3(60); var : Diff(0); Var : Noise1(0),Signal1(0),efRatio1(0),Smooth1(1),Fastest1(0.6667),Slowest1(0.0645),AdaptMA1(0); Var : Noise2(0),Signal2(0),efRatio2(0),Smooth2(1),Fastest2(0.6667),Slowest2(0.0645),AdaptMA2(0); Var : Noise3(0),Signal3(0),efRatio3(0),Smooth3(1),Fastest3(0.6667),Slowest3(0.0645),AdaptMA3(0); Diff = AbsValue(Close - Close[1]); IF CurrentBar <= Period1 Then AdaptMA1 = Close; IF CurrentBar > Period1 Then Begin Signal1 = AbsValue(Close - Close[Period1]); Noise1 = accumN(Diff, Period1); efRatio1 = Signal1 / Noise1; Smooth1 = Power(efRatio1 * (Fastest1 - Slowest1) + Slowest1, 2); AdaptMA1 = AdaptMA1 + Smooth1 * (Close - AdaptMA1); End; IF CurrentBar <= Period2 Then AdaptMA2 = Close; IF CurrentBar > Period2 Then Begin Signal2 = AbsValue(Close - Close[Period2]); Noise2 = accumN(Diff, Period2); efRatio2 = Signal2 / Noise2; Smooth2 = Power(efRatio2 * (Fastest2 - Slowest2) + Slowest2, 2); AdaptMA2 = AdaptMA2 + Smooth2 * (Close - AdaptMA2); End; IF CurrentBar <= Period3 Then AdaptMA3 = Close; IF CurrentBar > Period3 Then Begin Signal3 = AbsValue(Close - Close[Period3]); Noise3 = accumN(Diff, Period3); efRatio3 = Signal3 / Noise3; Smooth3 = Power(efRatio3 * (Fastest3 - Slowest3) + Slowest3, 2); AdaptMA3 = AdaptMA3 + Smooth3 * (Close - AdaptMA3); End; plot1(AdaptMA1,"Adaptive moving average1"); plot2(AdaptMA2,"Adaptive moving average2"); plot3(AdaptMA3,"Adaptive moving average3"); 즐거운 하루되세요 > yunmx 님이 쓴 글입니다. > 제목 : 적합이평 > 안녕하세요? 적합이평을 아래와 같이 수정해 봤는데요.. 검증하면 마지막줄 마지막에 ; 가 잘못된 토큰이라고 아래와 같이 에러가 뜹니다. 문법 에러, 잘못된 토큰:'<File End>' 제대로 적용되는 수식으로 수정 부탁드립니다. Inputs: Period1(5), Period2(20), Period3(60); Vars: Noise(0), Signal(0), Diff(0), efRatio(0), Smooth(1), Fastest(0.6667), Slowest(0.0645), AdaptMA1(0), AdaptMA2(0), AdaptMA3(0); Diff = AbsValue(Close - Close[1]); IF CurrentBar <= Period1 Then AdaptMA1 = Close; IF CurrentBar > Period1 Then Begin Signal = AbsValue(Close - Close[Period1]); Noise = accumN(Diff, Period1); efRatio = Signal / Noise; Smooth = Power(efRatio * (Fastest - Slowest) + Slowest, 2); AdaptMA1 = AdaptMA1[1] + Smooth * (Close - AdaptMA1[1]); IF CurrentBar <= Period2 Then AdaptMA2 = Close; IF CurrentBar > Period2 Then Begin Signal = AbsValue(Close - Close[Period2]); Noise = accumN(Diff, Period1); efRatio = Signal / Noise; Smooth = Power(efRatio * (Fastest - Slowest) + Slowest, 2); AdaptMA2 = AdaptMA2[1] + Smooth * (Close - AdaptMA2[1]); IF CurrentBar <= Period3 Then AdaptMA3 = Close; IF CurrentBar > Period3 Then Begin Signal = AbsValue(Close - Close[Period3]); Noise = accumN(Diff, Period3); efRatio = Signal / Noise; Smooth = Power(efRatio * (Fastest - Slowest) + Slowest, 2); AdaptMA3 = AdaptMA3[1] + Smooth * (Close - AdaptMA3[1]); plot1(AdaptMA1,"Adaptive moving average"); plot2(AdaptMA2,"Adaptive moving average"); plot3(AdaptMA3,"Adaptive moving average");