I've been searching for an EL version of Chaikin Money Flow, I especially like the one in IB's Trader Workstation and have been trying to duplicate that.
The code below is the best I've come up with so far, and most of the time it works great, but randomly I get divide by 0 errors in the event log and the indicator will not display. Sometimes i can get it back by deleting all cached data and reloading the page, but it is a big problem for it to not be available.
I would be incredibly grateful if any of you could take a look through the code below and point out what the problem is - thank you in advance!!
Chris
{ Chaikin Money Flow }
inputs: len(21);
var: den(0), den2(0);
// Currencies don't always track volume, so this sets the value to zero if there isn't volume
den = summation(V,len);
den2 = H-L;
if den = 0 or den2 = 0 then begin
value1 = 0;
end
else begin
value1 = summation(((( C-L ) - ( H-C )) / ( H-L )) * V,len) / den;
end;
if value1 > 0 then begin
plot1(value1, "CMF_Hist", blue);
plot2(value1, "CMF_Line", blue);
end
else begin
plot1(value1, "CMF_Hist", red);
plot2(value1, "CMF_Line", red);
end;
plot5(0, "Mid");
The code below is the best I've come up with so far, and most of the time it works great, but randomly I get divide by 0 errors in the event log and the indicator will not display. Sometimes i can get it back by deleting all cached data and reloading the page, but it is a big problem for it to not be available.
I would be incredibly grateful if any of you could take a look through the code below and point out what the problem is - thank you in advance!!
Chris
{ Chaikin Money Flow }
inputs: len(21);
var: den(0), den2(0);
// Currencies don't always track volume, so this sets the value to zero if there isn't volume
den = summation(V,len);
den2 = H-L;
if den = 0 or den2 = 0 then begin
value1 = 0;
end
else begin
value1 = summation(((( C-L ) - ( H-C )) / ( H-L )) * V,len) / den;
end;
if value1 > 0 then begin
plot1(value1, "CMF_Hist", blue);
plot2(value1, "CMF_Line", blue);
end
else begin
plot1(value1, "CMF_Hist", red);
plot2(value1, "CMF_Line", red);
end;
plot5(0, "Mid");