Page 1 of 1

Multicharts - Problem with study

Posted: Tue Dec 09, 2008 8:10 pm
by ptcman
Hi.

Can anyone plot this formula on an intraday chart in multicharts?

I've been trying to plot it but I'm always receiving a floating point error or a floating point division by zero error. It seems that he detect 2 different error each time I try to plot it. :?

I'm able to open it on a daily chart but there's something wrong because it plots negative values for some bars when that shouldn't be possible.

The weird thing though is the fact that, apparently, in tradestation that error don't occur in intraday charts :?

I would appreciate some thoughts from you.
Thank you

Code: Select all

{ *Variables*}
vars : cls(0), dRng(0);
vars : inRng(true), upRng(true), dnRng(true), inBulRng(0), pctBul(0);
vars : in1Bul(0), in2Bul(0), up1Bul(0), up2Bul(0), dn1Bul(0), dn2Bul(0),bulRng(0);

{ *Variable declaration* }
cls = close[1];
inRng = high > cls and low < cls;
upRng = low >= cls;
dnRng = high <= cls;

{ *Daily Range* }
if dnRng then begin
dRng = cls - low;
end
else
if upRng then begin
dRng = high - cls;
end
else
if inRng then begin
dRng = high - low;
end;

{ *Inside Range 1st version* }
if inRng then begin
in1Bul = high - open;
in2Bul = close - low;
bulRng = (in1Bul + in2Bul) * 0.5;
end;

{ *Percentage Range }
pctBul = (1-bulRng/dRng)*100;

{ *Plot in own Window* }
plot1(pctBul);

{ *Plot in own window upRng, dnRng and inRng conditions*
plot1(high<=cls);
plot2(low>=cls);
plot3(high>cls and low<cls); }