I was trying to write code for calculating sum of volume of multiple symbols.
program complied successfully but it doesn't draw or plot anything.
if you can look at it and let me know where I am going wrong , can be great help to me.
I am using ninja 8
here is the code,
{
// Get the master instrument associated with the current chart or data series
List<Instrument> instrumentList = new List<Instrument>();
foreach (Instrument instrument in Instruments)
{
if (instrument.FullName.Contains("BankNifty") && instrument.FullName.Contains("CE"))
{
instrumentList.Add(instrument);
}
}
foreach (Instrument instrument in instrumentList)
{
Print(instrument.FullName);
}
foreach (Instrument instrument in instrumentList)
{
sumVolumeDict[instrument.FullName] = 0;
}
}
else
{
// Loop through the filtered instruments and calculate the sum of volume
//foreach (Instrument instrument in instrumentList)
foreach (string symbol in sumVolumeDict.Keys)
{
double sumVolume = 0;
for (int i = BarsRequiredToPlot; i < CurrentBars[0]; i++)
{
if(symbol == Instrument.FullName && symbol.Contains("CE"))
{
sumVolume += Volume[i];
}
}
sumVolumeDict[symbol] = sumVolume;
Print("Symbol: " + symbol + ", Sum Volume: " + sumVolume);
Draw.TextFixed(this, "tag_" + symbol, symbol + ": " + sumVolume, TextPosition.TopLeft);
}
Tried to print too but not one print statement printed anything in output window
Comment