23 9月 2008

Acceleration/Deceleration(AC)

Acceleration/Deceleration(AC)-MetaQuotes

Calculation:

AC bar chart is the difference between the value of 5/34 of the driving
force bar chart and 5-period simple moving average, taken from that
bar chart.

AO = SMA(median price, 5)-SMA(median price, 34)
AC = AO-SMA(AO, 5)


Where:
SMA — Simple Moving Average;
AO — Awesome Oscillator.


這個好用的指標居然HTS和TS內建指標沒有支援,我們根據上面的公式
來新增指標:
  • 這公式要注意的地方是SMA指的是Simple Moving Average,這個
    就只是一般的平均值,並非HTS內建的SMA。
  • 此外我們另外設定,當AC值增加時後顯示紅色,AC值減少時顯示
    綠色。
  • 程式碼要記得按 Verify(F3)
  • 指標設定好時,要將指標換成柱狀顯示。

TS新增指標(Indicator)
線圖顯示換成柱狀顯示

TS程式碼
inputs: Length1(5), Length2(34), Length3(5);
vars: AO(0), AC(0), MedianPrice(0);

MedianPrice = (high + low)/2;
AO = Average(MedianPrice , Length1) - Average(MedianPrice , Length2);
AC = AO - Average(AO, Length3);

plot1(AC, "AC", Iff(AC>AC[1], Red, Green), Default,1);


HTS程式碼
parameters: Length1(5), Length2(34), Length3(5)
vars: AO(0), AC(0), MedianPrice(0)

MedianPrice = (high + low)/2
AO = Average(MedianPrice , Length1) - Average(MedianPrice , Length2)
AC = AO - Average(AO, Length3)

draw1(AC, "AC", Iff(AC>AC[1], Red, Green), Default,1)


此指標顯示圖形

沒有留言:

張貼留言