Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 3/20/2006(UTC) Posts: 53
|
wabbit wrote:--8<------------------------
Period:=Input("Period:",1,9999,21);
SecurityA:=Security("file_location",C);
num:=((Period * Sum(ROC(C,1,%) * ROC(SecurityA,1,%),Period)) - (Sum(ROC(C,1,%),Period) * Sum(ROC(SecurityA,1,%),Period)));
den:=Max(0.00001,((Period * Sum(Pwr(ROC(SecurityA,1,%),2),Period)) - Pwr(Sum(ROC(SecurityA,1,%),Period),2)));
num/den;
--8<------------------------
wabbit wrote:or even speed it up a little bit by reducing the number of computations....
--8<-------------------------
prd:=Input("Period:",1,9999,21);
thisSec:=ROC(C,1,%);
SecA:=ROC(Security("file_location",C),1,%);
num:=(prd*Sum(thisSec*SecA,prd)) - (Sum(thisSec,prd)*Sum(SecA,prd));
den:=Max(0.00001,(prd*Sum(Pwr(SecA,2),prd)) - Pwr(Sum(SecA,prd),2));
num/den;
--8<-------------------------
wabbit :D
They are not the same. :?:
I have created these 2 indicators and plotted it on the same chart.
The first one is a normal line which fluctuating up and down.
The second one is just a line moving narrowly around 0.
What's wrong? :|
|