maxBid = MAX(Closes[1],CurrentBars[1]-EntryBar)[0];
Ah, I think you mean printing CurrentBars[1] and Entrybar separately.
I'll test that. Thanks.
Ok, it's printing CurrentBars[1], but not printing EntryBar (prints 0)
Enabling NinjaScript strategy 'BidAskIncDecr/238743945' : On starting a real-time strategy - StartBehavior=WaitUntilFlat EntryHandling=All entries EntriesPerDirection=1 StopTargetHandling=Per entry execution ErrorHandling=Stop strategy, cancel orders, close positions ExitOnSessionClose=True / triggering 30 seconds before close SetOrderQuantityBy=Strategy ConnectionLossHandling=Recalculate DisconnectDelaySeconds=10 CancelEntriesOnStrategyDisable=False CancelExitsOnStrategyDisable=False Calculate=On each tick IsUnmanaged=True MaxRestarts=4 in 5 minutes 3 11/01/2022 18:42:00 0 A 11/01/2022 18:42:00 49 B 11/01/2022 18:42:00 0 Value of property 'Period' of NinjaScript 'MAX' is 0 and not in valid range between 1 and 2147483647. Disabling NinjaScript strategy 'BidAskIncDecr/238743945'
protected override void OnBarUpdate() { //Print(BarsInProgress); //Print("2" + " " + Time[0] + " " + maxBid); if(CurrentBar<2) return; if(BarsInProgress == 1 || BarsInProgress == 2) return; if ( PositionAccount.MarketPosition == MarketPosition.Long ) { { Print("3" + " " + Time[0] + " " + maxBid); Print("A" + " " + Time[0] + " " + CurrentBars[1]); Print("B" + " " + Time[0] + " " + EntryBar); EntryBar = CurrentBars[1]; maxBid = MAX(Closes[1],CurrentBars[1]-EntryBar)[0]; maxbidBool = true; Print("4" + " " + Time[0] + " " + maxBid); } Print("5" + " " + Time[0] + " " + maxBid);
Comment