Volume Delta Indicator
Hello guys.
I would like to have a volume delta indicator. Just like the native to implement in a strategy.
Does anyone know how I get the ask and bid values and form the delta?
Thanks.
I found this...
Instrument inst = Instruments.Current;
Level2[] ask_level2 = inst.getAsksDepth();
double totalAsk = 0;
for (int i = 0; ask_level2.Length - 1 > i; i++)
{
totalAsk = totalAsk + ask_level2[i].Size;
}
Level2[] bid_level2 = inst.getBidsDepth();
double totalBid = 0;
for (int i = 0; bid_level2.Length - 1 > i; i++)
{
totalBid = totalBid + bid_level2[i].Size;
}
double Ask_percentual = (totalAsk / (totalBid + totalAsk))*100;
double Bid_percentual = (totalBid / (totalBid + totalAsk))*100;
string text_Ask_percentual = String.Format("{0:N2}", (Ask_percentual);
string text_Bid_percentual = String.Format("{0:N2}", (Bid_percentual);
Print("Total------------" + totalBid + " ( " + text_Bid_percentual + " %) ---- " + totalAsk + " ( " + text_Ask_percentual + " %)");