namespace NinjaTrader.NinjaScript.Indicators
{
public class JSRDTBarCounter : Indicator
{
private int MyCounter;
NinjaTrader.Gui.Tools.SimpleFont myFont = new NinjaTrader.Gui.Tools.SimpleFont("Arial", 12) { Size = 8, Bold = false };
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Description = @"Numeros debajo de cada barra";
Name = "JSRDTBarCounter";
Calculate = Calculate.OnBarClose;
IsOverlay = true;
DisplayInDataBox = true;
DrawOnPricePanel = true;
DrawHorizontalGridLines = true;
DrawVerticalGridLines = true;
PaintPriceMarkers = true;
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;
}
else if (State == State.Transition)
{
}
}
protected override void OnBarUpdate()
{
if ( CurrentBar >=0)
{ if (Bars.IsFirstBarOfSession)
{
MyCounter = 1;
Draw.Text(this, "Tag"+CurrentBar, false, MyCounter.ToString(), 0, Low[0]-0.7, 5, Brushes.Black, myFont, TextAlignment.Center, Brushes.Transparent, null, 1);
}
else
Draw.Text(this,"Tag"+CurrentBar, false, MyCounter.ToString(),0, Low[0]-0.7,5, Brushes.Black, myFont, TextAlignment.Center, Brushes.Transparent, null, 1);
MyCounter = MyCounter + 1;
}
}
}
}
Comment