Ultimately what is happening when I debug the bot through the virtual machine is that it runs the OnStateChange method, but never runs the OnBarUpdate method. The weird thing is that it runs everything fine when running it on my local PC. Also I should mention if I create a new test strategy in the VM any breakpoint I set in the OnBarUpdate method doesn't get hit either. Breakpoints do get hit inside the OnStateChange method.
I would imagine there shouldn't be any difference between running a strategy on a local machine and a VM, but if it makes a difference I am using an Azure Windows (Windows 10 Pro) VM.
The connections I am using for local development and VM development are the same as well. I am using the 'Kinetick - END OF DAY' connection for the backtests.
Here is the code I am running for OnStateChange and OnBarUpdate. What I have seems pretty standard, but I might as well share it.
protected override void OnStateChange() { if (State == State.SetDefaults) { Description = @"FIve minute one minute micro e mini strategy."; Name = "T1V1S1V1FU"; Calculate = Calculate.OnBarClose; EntriesPerDirection = 1; EntryHandling = EntryHandling.AllEntries; IsExitOnSessionCloseStrategy = true; ExitOnSessionCloseSeconds = 30; IsFillLimitOnTouch = false; MaximumBarsLookBack = MaximumBarsLookBack.TwoHundredFiftySix; OrderFillResolution = OrderFillResolution.Standard; Slippage = 0; StartBehavior = StartBehavior.WaitUntilFlat; TimeInForce = TimeInForce.Gtc; TraceOrders = false; RealtimeErrorHandling = RealtimeErrorHandling.StopCancelClose; StopTargetHandling = StopTargetHandling.PerEntryExecution; BarsRequiredToTrade = 20; // Disable this property for performance gains in Strategy Analyzer optimizations // See the Help Guide for additional information IsInstantiatedOnEachOptimizationIteration = true; } else if (State == State.Configure) { AddDataSeries("MNQ 03-22", BarsPeriodType.Minute, 1, MarketDataType.Last); AddDataSeries("MNQ 03-22", BarsPeriodType.Minute, 5, MarketDataType.Last); PortfolioAmount = Account.Get(AccountItem.CashValue, Currency.UsDollar); } }
protected override void OnBarUpdate() { //Don't want to share all my code within OnBarUpdate. }
Maybe I'm missing something obvious here, but I am currently kind of stumped on this one.
Any help would be greatly appreciated!
Thanks,
-Parker
Comment