[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] EW OSC



PureBytes Links

Trading Reference Links

Friends I had this peice of easy language code for EW Oscillator .Iam 
trying to convert it in to AFL but not able to get what 
the "barnumber " and var function in amibroker stands for so not able 
to plot the breakout bands on the oscillator. Any help is highly 
appreciated.

EASY Language CODE:
Inputs: Price1(Average((H+L)/2,5) - Average((H+L)/2,35)),K(1),K2
(0.0555),Len(5);
Vars:  UpperBand(0),LowerBand(0),AvgP(0);

If Price1 >0  then begin
upperband=price1;
If barnumber>=2 then 
UpperBand= (upperband[1] + k2*(K*Price1 - upperband[1]));
end;


If Price1 < 0 then begin
LowerBand = Price1;
If barnumber>=2 then
LowerBand=(lowerband[1] + K2*(K*Price1 - lowerband[1]));
end;

AvgP = XAverage(Price1,Len);

Plot1(Price1,"Osc535");
Plot2(AvgP,"AvgP");
Plot3(UpperBand,"upper");
Plot4(LowerBand,"lower");


Attempted AFL code

price1=EMA((H+L)/2,5)-EMA((H+L)/2,17);
k=1;
k2=0.0555;
Lens=5;
upperband=Price1+k2*(k*Price1-price1);
Lowerband=Price1+K2*(K*Price1-price1);
Plot(Price1,"EW Osc",colorWhite,styleHistogram);
Plot(IIf(price1>0 AND BarsSince(Price1)
>=2 ,upperband,0),"UB",colorRed,styleLine);
Plot(IIf(price1<0 AND BarsSince(Price1)
>=2 ,Lowerband,0),"UB",colorBlue,styleLine);
Plot(WMA(Price1,Lens),"",colorOrange,styleLine);


Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.17.19/663 - Release Date: 2/1/2007 2:28 PM