kindly help me with coding of below logic.
the logic is at any point if the volume is high than simply take volume and mark it.
but during live market i am getting high volumes than actual volumes once i reload the chart it is again showing actual volumes.
kindly help me in fixing the bug, i have posted the complete code below.
Thanks and Regards,
Metal15
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Description = @"Enter the description for your new custom Indicator here.";
Name = "UMove1";
Calculate = Calculate.OnBarClose;
IsOverlay = false;
DisplayInDataBox = true;
DrawOnPricePanel = false;
DrawHorizontalGridLines = true;
DrawVerticalGridLines = true;
PaintPriceMarkers = false;
ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right;
//Disable this property if your indicator requires custom values that cumulate with each new market data event.
//See Help Guide for additional information.
IsSuspendedWhileInactive = true;
Tvalue = 0;
AddPlot(new Stroke(Brushes.LimeGreen, 1), PlotStyle.Bar, "Dvol");
AddPlot(new Stroke(Brushes.Red, 1), PlotStyle.Bar, "Drol");
AddPlot(new Stroke(Brushes.Blue, 1), PlotStyle.Bar, "Dvvol");
AddPlot(new Stroke(Brushes.Yellow, 1), PlotStyle.Bar, "Drrol");
}
else if (State == State.Configure)
{
}
}
protected override void OnBarUpdate()
{
//Add your custom indicator logic here.
if( CurrentBar < 1 )return;
double curC =Close[0];
double curP = Close[1];
double curV = Volume[0];
Tvalue=SMA(volume,5)[0];
if ((curV*curC )> (3*Tvalue) )
{
if(curC> curP)
{
Dvvol[0]=(curV*curC)/10000000;
}
else if(curC<=curP)
{
Drrol[0]=(curV*curC)/10000000;
}
}
else if ((curV*curC )> Tvalue )
{
if(curC> curP)
{
Dvol[0]=(curV*curC)/10000000;
}
else if(curC<=curP)
{
Drol[0]=(curV*curC)/10000000;
}
}
}
Comment