But, I only see the number 1 as the number of "ticks". I tried some solutions that I found here on the forum with the "Tick Replay" function enabled, but the result was the same.
I'm using one of those CQG Demo accounts that ninjatrader provides at the beginning of the registration, is that the problem?
Does anyone know how to count how many ticks there are in a bar?
Thanks
public class barcounter : Indicator { string filePath = @"C:\Intel\bar.txt"; private List<string> bars = new List<string>(); protected override void OnStateChange() { if (State == State.SetDefaults) { Description = @""; Name = "barcounter"; Calculate = Calculate.OnEachTick; IsOverlay = false; DisplayInDataBox = false; DrawOnPricePanel = false; DrawHorizontalGridLines = false; DrawVerticalGridLines = false; 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; } else if (State == State.Configure) { } } protected override void OnBarUpdate() { bars.Add(Time[0] + "," + Time[0].DayOfWeek + "," + Bars.TickCount.ToString()); File.WriteAllLines(filePath, bars); } }
Comment