This weekend, I was comparing my volume chart to Roland's and discovered I made an error and an omission. I omitted the case when the open = close (gray vol bar). Also, I discovered that the intra-day use of the EasyLanguage word 'volume' refers to 'up-volume' only. To get what we want, we need to use the ES word 'ticks'. I've changed my code and made a new picture of the second example of Roland's divergence.
I'm sorry for the error. Funny, I was using it Friday and made money....
Jim
Inputs: AverageLength(10);
vars: color(Green),sdvol(10), avgVol(0);
sdvol = standarddev(Ticks, AverageLength,2);
sdvol = standarddev(Ticks, AverageLength,2);
avgVol = average(Ticks, averagelength);Plot1(Ticks, "Vol");Plot2(avgVol, "Avg");
color = LightGray;
if open data1 > close data1 then
color = LightGray;
if open data1 > close data1 then
begin
if Ticks > Ticks[1] then color = Red
else color = darkred;
end;
if open data1 <>
SetPlotColor(1,color);
if Ticks > avgVol then SetPlotWidth(1,2);
if open data1 <>
begin if Ticks > Ticks[1] then color = Green
else color = DarkGreen;
end;
SetPlotColor(1,color);
SetPlotWidth(1,1);
if Ticks > avgVol then SetPlotWidth(1,2);
if Ticks > avgVol + sdVol then SetPlotWidth(1,3);
if Ticks > avgVol + 2 * sdVol then SetPlotWidth(1,4);
SetPlotColor(2,white);
1 comment:
Brilliant coding on varying the bar width, Jim!
Post a Comment