Can someone translate the code representing Kaufman's Efficiency ratio below:
input: Price((H+L)/2), ERLen(21);
var: effratio(0), netchg(0), totchg(0);
if CurrentBar = 1 then
effratio = Price
else
begin
NetChg = Price - Price[ ERLen ] ;
TotChg = Summation( AbsValue( Price - Price[1] ), ERLen ) ;
if TotChg > 0 then
EffRatio = NetChg / TotChg -plot3
else
EffRatio = 0 ;
end;
plot1(effratio, "ER");
plot3(average(plot1,erlen),"Avg");
if plot1>plot3 then setplotcolor(1,green);
if plot1 plot2(plot3,"");
input: Price((H+L)/2), ERLen(21);
var: effratio(0), netchg(0), totchg(0);
if CurrentBar = 1 then
effratio = Price
else
begin
NetChg = Price - Price[ ERLen ] ;
TotChg = Summation( AbsValue( Price - Price[1] ), ERLen ) ;
if TotChg > 0 then
EffRatio = NetChg / TotChg -plot3
else
EffRatio = 0 ;
end;
plot1(effratio, "ER");
plot3(average(plot1,erlen),"Avg");
if plot1>plot3 then setplotcolor(1,green);
if plot1 plot2(plot3,"");
Comment