InvestorsHub Logo
Followers 11
Posts 2529
Boards Moderated 1
Alias Born 04/03/2009

Re: spdpro post# 1332

Thursday, 04/12/2012 9:35:34 PM

Thursday, April 12, 2012 9:35:34 PM

Post# of 3631
If you want to do something out of the norm, here's code I wrote that runs two average lengths across the volume. When they cross, the trend often changes but, knowing the direction of the trend is key. It's not always obvious. I used the usual 50 EMA and then made the second half of it (25), to get an average of the average.

I also added a volume line that can be adjusted based on the volume trend. For example, if the trend changes at 200,000 then figure that out and manually input the data.

I was never quite happy with just one "Average line." :)

Cheers,

##

input length = 50;
input length2 = 25;
input High_Volume = 1000000;

plot Vol = volume;
plot VolAvg = Average(volume, length);
plot VolAvg2 = Average(volume, length2);
plot HighVolume = High_Volume;

Vol.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Vol.SetLineWeight(3);
Vol.DefineColor("Up", Color.UPTICK);
Vol.DefineColor("Down", Color.DOWNTICK);
Vol.AssignValueColor(if close > close[1] then Vol.color("Up") else if close < close[1] then Vol.color("Down") else GetColor(1));
VolAvg.SetDefaultColor(GetColor(8));
VolAvg.SetDefaultColor(GetColor(0));
HighVolume.SetDefaultColor(GetColor(5));

Vol.HideTitle();
VolAvg.HideTitle();
VolAvg2.HideTitle();
HighVolume.HideTitle();

Join the InvestorsHub Community

Register for free to join our community of investors and share your ideas. You will also get access to streaming quotes, interactive charts, trades, portfolio, live options flow and more tools.