public class HAticktest : Strategy { private int tickcounter; protected override void OnStateChange() { if (State == State.SetDefaults) { Description = @"Enter the description for your new custom Strategy here."; Name = "HAticktest"; Calculate = Calculate.OnBarClose; EntriesPerDirection = 1; EntryHandling = EntryHandling.AllEntries; MaximumBarsLookBack = MaximumBarsLookBack.TwoHundredFiftySix; OrderFillResolution = OrderFillResolution.Standard; Slippage = 0; StartBehavior = StartBehavior.WaitUntilFlat; TimeInForce = TimeInForce.Day; TraceOrders = false; RealtimeErrorHandling = RealtimeErrorHandling.StopCancelClose; BarsRequiredToTrade = 20; // Disable this property for performance gains in Strategy Analyzer optimizations // See the Help Guide for additional information IsInstantiatedOnEachOptimizationIteration = true; //inputs //variables tickcounter = 0; } else if (State == State.Configure) { AddDataSeries(Data.BarsPeriodType.Tick, 1); } } protected override void OnBarUpdate() { if (BarsInProgress == 0) { Print(string.Format("{0};{1};{2};{3};{4}", Time[0], "X", tickcounter, "X", "X")); tickcounter = 0; } if (BarsInProgress == 1) { tickcounter++; } }
my thought was that the tickcounter prints should be 1000 every time. not the case. see the attached screen.
why the vast difference in tick counts?
Comment