|
收到有學員問,Amibroker是否有Projection Oscillator這個指標?
這個是炒外匯的常用的指標,Amibroker的內置指標中是沒有的,不過已強調過任何指標也可以自己寫出來,而且並不困難。
1)開啟formula editor
(按圖可放大)
2)將以下copy到formula editor
n = Param(“Periods",12,5,50,1);
av = Param(“Average",5,2,20,1);
n = Optimize(“Periods",n,5,50,1);
av = Optimize(“Average",av,2,20,1);
function ProjOsc(n) {
// Slope of High {n period regression line of High)}
SlopeHigh = ((n * (Sum( Cum(1) * High, n))) – (Sum( Cum(1),n) * (
Sum(High, n)))) / ((n * Sum( Cum(1) ^ 2 , n)) – (Sum(Cum(1),n) ^
2));
//Slope of Low {n period regression line of Low}
SlopeLow = ((n * (Sum( Cum(1) * Low, n))) – (Sum( Cum(1), n) * (
Sum(Low, n)))) / ((n * Sum( Cum(1)^ 2, n)) – ( Sum(Cum(1),n) ^
2));
//Upper Projection Band
UpProjBand = 0;
for (i=0; i<n-1; i++)
{
UpProjBand =
Max(Max(Ref(High,-i)+i*slopehigh,Ref(High,-i-1)+(i+1)*slopehigh),UpProjBand);
}
//Lower Projection Band
LoProjBand = 10000;
for (i=0; i<n-1; i++)
{
LoProjBand =
Min(Min(Ref(Low,-i)+i*slopelow,Ref(Low,-i-1)+(i+1)*slopelow),LoProjBand);
}
//Projection Oscillator
ProOsc = 100 * (Close – LoProjBand) / (UpProjBand – LoProjBand);
return ProOsc;
}
aa= ProjOsc(n);
bb= MA(ProjOsc(n),av);
Plot(aa,"Projection Osc",colorblack,styleLine);
Plot(bb,"MA ProjOsc",colorgreen,styleLine);
3) 儲存在custom的file
4) right click 指標按insert 便能將指標放在圖表上分析
Projection Oscillator由Dr. Mel Widner研創,與其他不同的指標一樣,傳統的用法也是超買/超賣,背馳,突破等,不少人利用此指標來交易外匯。傳統的參數是12及5,但若應用在港股上,將參數設定為50及10會更好。分析股票時,初步看,每當由50以下重回至50以上有機會是股價重拾升勢的時間,值得留意,不過有關的方法仍有待詳細測試。
不過還是那一句,多一個指標作參考及分析箇然是好,但世上沒有無敵指標的,並非用了那個指標進行程式交易便能必勝,要明白指標的原理及優點,將其融入你個人的交易策略做分析,看看是否能提高回報,這才是正確的做法!
富昌金融集團聯席董事麥振威
電郵: paul.mark881@gmail.com
|