View Full Version : BuySellVolume indicator
grd974
08-28-2007, 07:54 AM
I don't quite understand what is the rationale behind that indicator. In order to find out how it works, I modified the Initialize() code this way :
protected override void Initialize()
{
Add(new Plot(new Pen(Color.Red, 2), PlotStyle.Square, "Sells"));
Add(new Plot(new Pen(Color.Green, 2), PlotStyle.Square, "Buys"));
CalculateOnBarClose = false;
DisplayInDataBox = false;
// PaintPriceMarkers = false;
PlotsConfigurable = true;
}
I then opened a Time & Sales window to trace the trades and the pricemarkers which yielded to this figures :
Time: Green trade: Red trade: Green pricemarker: Red pricemarker:
18:53:16 start time 9719 980
18:53:17 0 64 9783 1044
18:53:19 11 21 9815 1065
It looks like volume traded at a price <= current bid is added to red pricemarker ("Sells" plot) which is common sense but it is also added to green pricemarker ("Buys" plot) as well as volume traded at a price >= current ask which get me confused since I would wait for the "Buys" plot to tally only volume traded at a price >= current ask.
Did I miss something ?
Gérard
NinjaTrader_Ray
08-28-2007, 08:18 AM
Very observant. This is correct. The purpose of this indicator is NOT to display absolute values but to display a histogram relationship. In order to get the desired visual display, I had to create one bar (buys) that has the total buys and sells. Then I put the sells bars in front of it which only has the sells volume and hides the sells portion of the buys bar so what you see is a green one bar split with green and red color.
jojojo
08-31-2007, 10:02 AM
Hello
A question to the cracks . May it be possible to code something like this?
It's just showing the number of contracts traded at the bid versus number of contracts traded at the ask , so called marketdelta. It's from tradestation.
regs
Jojo
NinjaTrader_Ray
08-31-2007, 10:10 AM
Technically this is possible but it is far outside of the scope of what is officially supported.
Perphaps this product may do the trick or, the developer of this product is capable of custom coding this indicator for a fee.
http://fin-alg.com/tpoandvolumechart.html
grd974
09-01-2007, 02:50 PM
I modified the BuySellVolume indicator so as to watch one red pricemarker and one green pricemarker displaying red trade volume and green trade volume from the Time & Sales window. The code is :
if (firstPaint)
firstPaint = false;
else
{
double tradeVol = previousVol == 0 ? Volume[0] : Volume[0] - previousVol;
if (Close[0] >= GetCurrentAsk())
{
buys += tradeVol;
positive.Set(tradeVol);
negative.Set(0);
}
else if (Close[0] <= GetCurrentBid())
{
sells += tradeVol;
negative.Set(tradeVol);
positive.Set(0);
}
}
previousVol = Volume[0];
if (!firstPaint && !Historical)
{
Values[0].Set(negative[0]);
Values[1].Set(positive[0]);
}
It went Ok then I wanted to get those trade volume displayed for a limited number of ticks; so I modified the two above lines this way :
if(CurrentBar < period)
return;
Values[0].Set(SUM(negative, period)[0]);
Values[1].Set(SUM(positive, period)[0]);
The result is very disappointing : using Market Replay, as the T&S window shows green volume = 1 and red volume = 250, the green pricemarker is 345K and the red pricemarker is 1 !
I welcome any help.
Gérard
gmoulder
09-05-2007, 06:52 PM
Ninjatrader Ray,
Could you please post that volume indicator. I would really like to have something like that.
Thanks,
Geoff
NinjaTrader_Ray
09-06-2007, 06:49 AM
Unfortunately I do not have an indicator to post :(
wiseguy
10-25-2007, 08:31 AM
I was just wondering if its possible to save this data for the next time i open the program?
Also is it possible to set the larger bar on top, instead of the green all the time? it would make it a whole lot easier to see which side produced the higher volume.
NinjaTrader_Ray
10-25-2007, 09:11 AM
Unfortunately not on both items.
NinjaCustomer
02-01-2008, 03:26 PM
since the green column is buys+sells, not buys like I had first thought, could someone explain how to read (interpret) this indicator properly? thanks.
NinjaTrader_Ray
02-01-2008, 03:51 PM
Green column represents buys but is consctructed of buy + sells since once the red bar is show, it sits in front of the green bar. Thus, what is left visually on the green bar is the buys. Its a visual trick. The values in the databox really serve no purpose and would give you the total value of buys + sells.