Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Enabled Strategies Don't Run When Session Starts (Sometimes)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Enabled Strategies Don't Run When Session Starts (Sometimes)

    I am running on NinjaTrader 8.1.4.1 64-bit on Windows. This issue has also occurred on prior versions. I enabled a number of strategies right after midnight and went to bed. I wake up this morning and see the strategies are still enabled, but not running (no output in the output pane). I have them output on primary bar, so I can see them running. Two connections (Schwab and Coinbase) are both green.

    What could be causing this problem?

    Last log shows the following:

    2025-04-11 00:07:56:749|1|4|Enabling NinjaScript strategy 'Strategy1/353122898' : On starting a real-time strategy - StartBehavior=WaitUntilFlat EntryHandling=All entries EntriesPerDirection=1 StopTargetHandling=By strategy position 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 bar close IsUnmanaged=False MaxRestarts=4 in 5 minutes
    2025-04-11 00:07:57:555|1|4|Enabling NinjaScript strategy 'Strategy2/353122888' : On starting a real-time strategy - StartBehavior=WaitUntilFlat EntryHandling=All entries EntriesPerDirection=1 StopTargetHandling=By strategy position 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 bar close IsUnmanaged=False MaxRestarts=4 in 5 minutes
    2025-04-11 00:07:59:118|1|4|Enabling NinjaScript strategy 'Strategy1/353122883' : On starting a real-time strategy - StartBehavior=WaitUntilFlat EntryHandling=All entries EntriesPerDirection=1 StopTargetHandling=By strategy position 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 bar close IsUnmanaged=False MaxRestarts=4 in 5 minutes
    2025-04-11 00:08:00:157|1|4|Enabling NinjaScript strategy 'Strategy1/353122894' : On starting a real-time strategy - StartBehavior=WaitUntilFlat EntryHandling=All entries EntriesPerDirection=1 StopTargetHandling=By strategy position 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 bar close IsUnmanaged=False MaxRestarts=4 in 5 minutes
    2025-04-11 00:08:01:126|1|4|Enabling NinjaScript strategy 'Strategy1/353122884' : On starting a real-time strategy - StartBehavior=WaitUntilFlat EntryHandling=All entries EntriesPerDirection=1 StopTargetHandling=By strategy position 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 bar close IsUnmanaged=False MaxRestarts=4 in 5 minutes
    2025-04-11 00:08:02:347|1|4|Enabling NinjaScript strategy 'Strategy1/353122882' : On starting a real-time strategy - StartBehavior=WaitUntilFlat EntryHandling=All entries EntriesPerDirection=1 StopTargetHandling=By strategy position 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 bar close IsUnmanaged=False MaxRestarts=4 in 5 minutes
    2025-04-11 00:08:03:513|1|4|Enabling NinjaScript strategy 'Strategy1/353122891' : On starting a real-time strategy - StartBehavior=WaitUntilFlat EntryHandling=All entries EntriesPerDirection=1 StopTargetHandling=By strategy position 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 bar close IsUnmanaged=False MaxRestarts=4 in 5 minutes
    2025-04-11 00:08:06:640|1|4|Enabling NinjaScript strategy 'Strategy1/353122893' : On starting a real-time strategy - StartBehavior=WaitUntilFlat EntryHandling=All entries EntriesPerDirection=1 StopTargetHandling=By strategy position 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 bar close IsUnmanaged=False MaxRestarts=4 in 5 minutes
    2025-04-11 00:08:08:802|1|4|Enabling NinjaScript strategy 'Strategy1/353122901' : On starting a real-time strategy - StartBehavior=WaitUntilFlat EntryHandling=All entries EntriesPerDirection=1 StopTargetHandling=By strategy position 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 bar close IsUnmanaged=False MaxRestarts=4 in 5 minutes
    2025-04-11 00:08:10:002|1|4|Enabling NinjaScript strategy 'Strategy2/353122905' : On starting a real-time strategy - StartBehavior=WaitUntilFlat EntryHandling=All entries EntriesPerDirection=1 StopTargetHandling=By strategy position 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 bar close IsUnmanaged=False MaxRestarts=4 in 5 minutes
    2025-04-11 00:08:11:092|1|4|Enabling NinjaScript strategy 'Strategy1/353122897' : On starting a real-time strategy - StartBehavior=WaitUntilFlat EntryHandling=All entries EntriesPerDirection=1 StopTargetHandling=By strategy position 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 bar close IsUnmanaged=False MaxRestarts=4 in 5 minutes

    The following log are when I started NinjaTrader right before midnight:

    2025-04-10 23:51:21:073|2|4|Session Break (Version 8.1.4.1)
    2025-04-10 23:51:33:059|1|4|Global simulation mode disabled
    2025-04-10 23:51:35:489|1|2|Using IS (is-us-nt-006.ninjatrader.com/31658)
    2025-04-10 23:51:35:503|1|4|Automated trading disabled
    2025-04-10 23:51:35:560|1|32|Order entry hot keys disabled
    2025-04-10 23:51:35:560|1|4|Auto close enabled=False
    2025-04-10 23:51:36:487|1|4|Restoring workspace 'Untitled'...
    2025-04-10 23:52:33:696|1|2|CCNinjaTrader: Primary connection=Connecting, Price feed=Connecting
    2025-04-10 23:52:35:768|1|2|Coinbase: Primary connection=Connecting, Price feed=Connecting
    2025-04-10 23:52:35:879|1|2|Coinbase: Primary connection=Connected, Price feed=Connected
    2025-04-10 23:52:35:880|1|2|Time to auto close position='12:00:00 AM', Enabled=False
    2025-04-10 23:52:35:881|1|2|Using HDS (hds-us-nt-020.ninjatrader.com/31655)
    2025-04-10 23:52:43:495|1|2|CCNinjaTrader: Primary connection=Connected, Price feed=Connected
    2025-04-10 23:52:43:576|2|2|Account 'Sim101': One or more strategies could not be restored, since the provider does not support the required instrument types.
    2025-04-10 23:52:43:597|1|2|Time to auto close position='12:00:00 AM', Enabled=False
    Last edited by gypsymoth; 04-11-2025, 11:53 AM.

    #2
    Hello gypsymoth,

    The strategies are applied to a chart and the chart is showing changing ask and bid prices and new bars are forming on the chart in real-time?

    Please add to the top of the strategy's OnBarUpdate() block Print(Time[0]);.

    When the behavior re-occurs is this print not appearing in the output window?

    While the session is open, the prints are appearing as expected?

    Are there connection losses showing on the Log tab of the Control Center?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi Chelsea,

      The charts are running and prices are ticking by. And I do have the time output on the "OnBarUpdate". It would output something like this:

      4/11/2025 10:45:00 AM Friday BTCUSD / Indicator1 - Close price crossed ABOVE Supertrend!

      That's just an example from a different chart/indicator, because I have not disabled the not working strategies as we discuss; so we can debug.

      Each of the enabled strategies should be outputing a line like above on the primary bar. Some strategies are set up to 5 min primary bars, while others are 15 min primary bars.

      I just verified that all charts are showing the latest candlestick.

      There are no disconnects in the log tab. The log tab shows the same logs I posted in my OP.

      I did replace the actual strategy name and indicate name with generic "Indicator1", etc. But if you think the actual names would be helpful, I can post them.

      The last time Strategy1 was changed was "4/1/2025 11:24 AM". The last time Strategy2 was changed was "4/10/2025 3:24 PM". I've been running these two strategies daily for a few weeks. The strategies runs during U.S. stock market normal trading session.

      This problem occurred once before during these few weeks. And it occurred again today. But as you can see from the 4/1 example, the problem is not due to code change.

      I don't know if the logs I posted above shows, but all of the enabled strategies are running on live money accounts. None are operating on simulation accounts.
      Last edited by gypsymoth; 04-11-2025, 12:40 PM.

      Comment


        #4
        Hello gypsymoth,

        May I confirm the print is the first line at the top of the OnBarUpdate() block and is not within any conditions?
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Unfortunately, it is within conditions, but here are the condensed method call order:

          protected override void OnBarUpdate()
          if (BarsInProgress == PRIMARY_BAR)
          {
          // Debug.
          // output (STRATEGY_NAME, "PRIMARY BAR");
          handlePrimaryBar ();

          ​private void handlePrimaryBar ()
          if (Bars.IsFirstBarOfSession == true)
          {
          // Reset in case this strategy runs multiple days.
          goLongToday = GoLong;
          }
          ​ if ((currentTime >= TimeToStartTrading) &&
          (currentTime < TimeToStopAcquiring))
          {
          entryConditions ();

          private void entryConditions ()
          if (CurrentBar >= BarsRequiredToTrade)
          {
          if (Position.MarketPosition == MarketPosition.Flat)
          {
          if (goLongToday)
          {
          output (STRATEGY_NAME, "Evaluating potential long entry point...");
          entryConditionsLong ();

          ​goLongToday is true, because "GoLong" is enabled via user strategy configuration. Of course, since the strategy is not running, it's a moot point.

          In addition, during the historical state, all strategies loaded up and operated correctly using this same logic path. And as mentioned before, has worked for days. The strategies does not depend on which weekday it operates on.

          For reference, this problem (or a similar one) occurred a few years ago on a prior NT version. I posted it, but didn't have time to debug back then. In that thread, I actually posted screen shot of what the output would look like running in a strategy. I've now moved on to new strategies from the one shown in the screen shot, but the method call structure are practically the same. Please reference prior thread here:

          Enabled Two Exact Same Strategy on Two Different Instruments, One Did Not Run

          Comment


            #6
            I should add that just like the "Enabled Two Exact Same Strategy on Two Different Instruments, One Did Not Run", these two new strategies should start outputing the top and bottom prices at the start of session (first four bars) based on this code:

            private void handlePrimaryBar ()
            int currentTime = ToTime (Time [0]);

            // Has to be done first to set up prices for entry.
            if ((currentTime >= EarlyRangeStartTime) &&
            (currentTime <= EarlyRangeFinalTime))
            {
            topPrice = Math.Max (CCsEarlyRange (EarlyRangeStartTime, EarlyRangeFinalTime, false, false, false).RangeHigh, High [0]);
            bottomPrice = Math.Min (CCsEarlyRange (EarlyRangeStartTime, EarlyRangeFinalTime, false, false, false).RangeLow, Low [0]);
            output (STRATEGY_NAME, "Top Price: $" + topPrice + " Bottom Price: $" + bottomPrice);
            }

            ​But there were no output after the session started for any of the enabled strategies.

            Comment


              #7
              Hello gypsymoth,

              The goal is just to confirm the script is processing data without any conditions.

              Please add to the top of the strategy's OnBarUpdate() block:
              Print(Time[0]);

              When the behavior re-occurs is this print not appearing in the output window?

              While the session is open, the prints are appearing as expected?​
              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                I understand the goal of your suggestion, Chelsea. And I will definitely be inclined to do so if we can't figure out the problem today.

                But I'll post actual code below to demonstrate, why I don't believe the strategy is "running". I will also attach a screen shot of the configuration, so you can see the time code.

                If after reviewing the code, you still believe I should put an output statement at the top of "OnBarUpdate", I'll do so. We just may not be able to continue debugging until it happens again. And plus, it will generate a lot of output when it is working, because as you can see below, it runs once per minute.

                private const int PRIMARY_BAR = 0;

                protected override void OnBarUpdate()
                {
                // NT7 vs. NT8: NinjaTrader previously used a Historical
                // bool property to notify when an indicator or strategy
                // bar was being processed historically or real-time.
                // The NinjaTrader 8 OnStateChange() approach has now
                // introduced a class level variable State where you can
                // check for State.Historical or State.Realtime in any of
                // the other event methods which will allow you to take
                // action depending on the desired state.
                /*
                if (State == State.Historical)
                {
                }
                else
                if (State >= State.Realtime)
                {
                }
                */

                if (BarsInProgress == PRIMARY_BAR)
                {
                // Debug.
                // output (STRATEGY_NAME, "PRIMARY BAR");

                handlePrimaryBar ();
                }

                // Else here is useless. Each time frame is going to
                // call this method no matter what.

                if (BarsInProgress == ONE_MINUTE_BAR)
                {
                // Debug.
                // output (STRATEGY_NAME, "ONE MINUTE BAR");

                handleOneMinuteBar ();
                }
                }​

                private void handleOneMinuteBar ()
                {
                // Debug.
                // output (STRATEGY_NAME, "handleOneMinuteBar");

                if (Position.MarketPosition != MarketPosition.Flat)
                {
                bool stopped = executeSoftStop ();
                /*
                if (stopped == false)
                {
                handleHighProfitTarget ();
                moveTargetAndStopPrice ();
                }
                */
                }
                }

                private void handlePrimaryBar ()
                {
                // Debug.
                // output (STRATEGY_NAME, "handlePrimaryBar");

                if (Bars.IsFirstBarOfSession == true)
                {
                // Reset in case this strategy runs multiple days.
                goLongToday = GoLong;
                goShortToday = GoShort;
                }
                else
                {
                detectAwesomeTrend ();
                }

                // Use Session Templates to control trade hours.

                exitConditions ();

                if ((orderInProcess != ORDER_EXIT) &&
                (! orderQueue.Contains (ORDER_EXIT)))
                {
                moveIncrementalStop ();
                moveProgressiveStop ();
                moveTrailingStop ();
                }

                int currentTime = ToTime (Time [0]);

                // Has to be done first to set up prices for entry.
                if ((currentTime >= EarlyRangeStartTime) &&
                (currentTime <= EarlyRangeFinalTime))
                {
                topPrice = Math.Max (CCsEarlyRange (EarlyRangeStartTime, EarlyRangeFinalTime, false, false, false).RangeHigh, High [0]);
                bottomPrice = Math.Min (CCsEarlyRange (EarlyRangeStartTime, EarlyRangeFinalTime, false, false, false).RangeLow, Low [0]);
                output (STRATEGY_NAME, "Top Price: $" + topPrice + " Bottom Price: $" + bottomPrice);
                }

                if ((currentTime >= TimeToStartTrading) &&
                (currentTime < TimeToStopAcquiring))
                {
                entryConditions ();
                }
                else
                {
                // Allow us to make sure the robot is running and see when it stopped.
                if (currentTime < EarlyRangeStartTime)
                {
                output (STRATEGY_NAME, "Idling while waiting for trading session to start.");
                }

                if (currentTime == TimeToStopAcquiring)
                {
                output (STRATEGY_NAME, "Trade entry period is over.");
                }
                }
                }

                ​​
                Attached Files

                Comment


                  #9
                  Hello gypsymoth,

                  If you are not able to debugging because the script is running live, you might choose to use a second device to do some testing with.

                  You can also create custom Trading hours templates with a session for the current day that starts a few minutes out into the future to test the script being enabled before the start of a session and then see if it is processing data.

                  Yes, I will still direct you to add a print of the time at the top of OnBarUpdate() outside of any conditions. This will let us know if data is being processed.
                  Chelsea B.NinjaTrader Customer Service

                  Comment


                    #10
                    I'm not sure I understand your goal for today. If I disable a strategy and re-enable it'll work and produce the correct output. Since the trade session is over for today, we'll only have the output for historical data; even if the output statement is the first statement in OnBarUpdate. But if that's really what you want, I can do that; let me know.

                    Before then, I just enabled the strategy on a different chart with simulate account and a different symbol. Here is what the output should look like for today. The first 5 lines should show no matter what, it would be like a print statement at the top of "OnBarUpdate". This output did not show for any of the enabled strategy today. But I can change the code, if you still wish, after you review this output:

                    4/11/2025 6:45:00 AM Friday EDC / Strategy1 - Top and Bottom Price Reset.
                    4/11/2025 6:45:00 AM Friday EDC / Strategy1 - Top Price: $25.15 Bottom Price: $24.62
                    4/11/2025 7:00:00 AM Friday EDC / Strategy1 - Top Price: $25.26 Bottom Price: $24.62
                    4/11/2025 7:15:00 AM Friday EDC / Strategy1 - Top Price: $25.26 Bottom Price: $24.62
                    4/11/2025 7:30:00 AM Friday EDC / Strategy1 - Top Price: $25.26 Bottom Price: $24.5
                    4/11/2025 7:45:00 AM Friday EDC / Strategy1 - Evaluating potential long entry point...
                    4/11/2025 8:00:00 AM Friday EDC / Strategy1 - Evaluating potential long entry point...
                    4/11/2025 8:15:00 AM Friday EDC / Strategy1 - Evaluating potential long entry point...
                    4/11/2025 8:45:00 AM Friday EDC / Strategy1 - Evaluating potential long entry point...
                    4/11/2025 9:15:00 AM Friday EDC / Strategy1 - Evaluating potential long entry point...
                    4/11/2025 9:30:00 AM Friday EDC / Strategy1 - Evaluating potential long entry point...
                    4/11/2025 9:45:00 AM Friday EDC / Strategy1 - Evaluating potential long entry point...
                    4/11/2025 9:45:00 AM Friday EDC / Strategy1 - Break Out Buy.
                    4/11/2025 9:45:00 AM Friday EDC / Strategy1 - Soft stop set at $25.1
                    4/11/2025 9:45:00 AM Friday EDC / Strategy1 - Submitting Long Order.
                    4/11/2025 9:45:00 AM Friday EDC / Strategy1 - Buy Executed.
                    4/11/2025 9:45:00 AM Friday EDC / Strategy1 - Cash to Invest: $1000
                    4/11/2025 9:45:00 AM Friday EDC / Strategy1 - Shares: 39
                    4/11/2025 9:45:00 AM Friday EDC / Strategy1 - Share Fill Price: $25.29
                    4/11/2025 9:45:00 AM Friday EDC / Strategy1 - Total Fill Cost: $986.31
                    4/11/2025 10:00:00 AM Friday EDC / Strategy1 - Evaluate potential long exit point . . .
                    4/11/2025 10:00:00 AM Friday EDC / Strategy1 - Moving EMA stop: $24.9044675879133
                    4/11/2025 10:00:00 AM Friday EDC / Strategy1 - Existing $25.1 stop price is higher than new $24.9044675879133 stop price. No change made.
                    4/11/2025 10:15:00 AM Friday EDC / Strategy1 - Evaluate potential long exit point . . .
                    4/11/2025 10:15:00 AM Friday EDC / Strategy1 - Moving EMA stop: $24.9927462082927
                    4/11/2025 10:15:00 AM Friday EDC / Strategy1 - Existing $25.1 stop price is higher than new $24.9927462082927 stop price. No change made.
                    4/11/2025 10:30:00 AM Friday EDC / Strategy1 - Evaluate potential long exit point . . .
                    4/11/2025 10:30:00 AM Friday EDC / Strategy1 - Moving EMA stop: $25.0431559886031
                    4/11/2025 10:30:00 AM Friday EDC / Strategy1 - Existing $25.1 stop price is higher than new $25.0431559886031 stop price. No change made.
                    4/11/2025 10:45:00 AM Friday EDC / Strategy1 - Evaluate potential long exit point . . .
                    4/11/2025 10:45:00 AM Friday EDC / Strategy1 - Moving EMA stop: $25.1189458088571
                    4/11/2025 10:45:00 AM Friday EDC / Strategy1 - Soft trailing stop set at $25.1189458088571
                    4/11/2025 11:00:00 AM Friday EDC / Strategy1 - Evaluate potential long exit point . . .
                    4/11/2025 11:00:00 AM Friday EDC / Strategy1 - Moving EMA stop: $25.1955011163376
                    4/11/2025 11:00:00 AM Friday EDC / Strategy1 - Soft trailing stop set at $25.1955011163376
                    4/11/2025 11:15:00 AM Friday EDC / Strategy1 - Evaluate potential long exit point . . .
                    4/11/2025 11:15:00 AM Friday EDC / Strategy1 - Moving EMA stop: $25.2654100042762
                    4/11/2025 11:15:00 AM Friday EDC / Strategy1 - Soft trailing stop set at $25.2654100042762
                    4/11/2025 11:45:00 AM Friday EDC / Strategy1 - Evaluate potential long exit point . . .
                    4/11/2025 11:45:00 AM Friday EDC / Strategy1 - Moving EMA stop: $25.3171536398624
                    4/11/2025 11:45:00 AM Friday EDC / Strategy1 - Soft trailing stop set at $25.3171536398624
                    4/11/2025 12:00:00 PM Friday EDC / Strategy1 - Evaluate potential long exit point . . .
                    4/11/2025 12:00:00 PM Friday EDC / Strategy1 - Moving EMA stop: $25.3631257053419
                    4/11/2025 12:00:00 PM Friday EDC / Strategy1 - Soft trailing stop set at $25.3631257053419
                    4/11/2025 12:15:00 PM Friday EDC / Strategy1 - Evaluate potential long exit point . . .
                    4/11/2025 12:15:00 PM Friday EDC / Strategy1 - Time's Up (120000): closing Long Position.
                    4/11/2025 12:15:00 PM Friday EDC / Strategy1 - Submitting Exit Order.
                    4/11/2025 12:15:00 PM Friday EDC / Strategy1 - Sell Executed.
                    4/11/2025 12:15:00 PM Friday EDC / Strategy1 - Shares: 39
                    4/11/2025 12:15:00 PM Friday EDC / Strategy1 - Share Fill Price: $25.85
                    4/11/2025 12:15:00 PM Friday EDC / Strategy1 - Total Fill Cost: $986.31
                    4/11/2025 12:15:00 PM Friday EDC / Strategy1 - Total Fill Recovered: $1008.15
                    4/11/2025 12:15:00 PM Friday EDC / Strategy1 - Profit: $21.8400000000001
                    4/11/2025 12:15:00 PM Friday EDC / Strategy1 - Gain: 2.21431395808622%
                    4/11/2025 12:55:00 PM Friday EDC / Strategy1 - Transition to real-time data.
                    Enabling NinjaScript strategy 'Strategy1/353122840' : On starting a real-time strategy - StartBehavior=WaitUntilFlat EntryHandling=All entries EntriesPerDirection=1 StopTargetHandling=By strategy position 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 bar close IsUnmanaged=False MaxRestarts=4 in 5 minutes
                    4/11/2025 12:55:00 PM Friday EDC / Strategy1 - Cash to Invest: $1000
                    4/11/2025 12:55:00 PM Friday EDC / Strategy1 - ---------------------------------------------
                    4/11/2025 12:55:00 PM Friday EDC / Strategy1 - Buying Power: $0
                    4/11/2025 12:55:00 PM Friday EDC / Strategy1 - Cash Value: $99677
                    4/11/2025 12:55:00 PM Friday EDC / Strategy1 - Total Cash Balance: $0
                    4/11/2025 12:55:00 PM Friday EDC / Strategy1 - Initial Margin: $0
                    4/11/2025 12:55:00 PM Friday EDC / Strategy1 - Intraday Margin: $0
                    4/11/2025 12:55:00 PM Friday EDC / Strategy1 - Maintenance Margin: $0
                    4/11/2025 12:55:00 PM Friday EDC / Strategy1 - Position Margin: $0
                    4/11/2025 12:55:00 PM Friday EDC / Strategy1 - Gross Realized Profit/Loss: $0
                    4/11/2025 12:55:00 PM Friday EDC / Strategy1 - Realized Profit/Loss: $0
                    4/11/2025 12:55:00 PM Friday EDC / Strategy1 - Unrealized Profit/Loss: $0
                    4/11/2025 12:55:00 PM Friday EDC / Strategy1 - Commission: $0
                    4/11/2025 12:55:00 PM Friday EDC / Strategy1 - Fee: $0
                    4/11/2025 12:55:00 PM Friday EDC / Strategy1 - ---------------------------------------------


                    Comment


                      #11
                      Hello gypsymoth,

                      I can see something is making output.

                      I'm suspect that there is a connection loss and this is causing OnBarUpdate() to stop processing data.

                      The information I've requested would confirm this.

                      The prints you have are in conditions. I cannot confirm the conditions are evaluating as true.

                      I look forward to receiving the requested information so I may assist further.
                      Chelsea B.NinjaTrader Customer Service

                      Comment


                        #12
                        Ok. I'll do so. Can I do this in any other strategy and just enable it on a simulation? Or does it have to be this exact strategy on any symbol on any chart on a simulation account?

                        Comment


                          #13
                          Hello gypsymoth,

                          You could create a new test script and test that first.

                          If it is able to reproduce, then it's not a script issue but a platform / connection issue.

                          If the new test script is not able to reproduce then see if the other script does, which might indicate an issue with that specific script.
                          Chelsea B.NinjaTrader Customer Service

                          Comment


                            #14
                            Ok, I copied Strategy1 into Strategy3 and put in the code you asked for. Then I ran it on another chart with a simulated account. All my charts run with 30 days of back data. The following is the output for today. Let me know if this is what you are looking for, or if you wanted something else.

                            The output exceeded forum post limit by 300 characters, so I'll post it next.

                            Comment


                              #15
                              4/11/2025 6:31:00 AM
                              4/11/2025 6:35:00 AM
                              4/11/2025 6:35:00 AM Friday WTIU / Strategy3 - Top Price: $6.53 Bottom Price: $6.53
                              4/11/2025 6:44:00 AM
                              4/11/2025 6:45:00 AM
                              4/11/2025 6:45:00 AM Friday WTIU / Strategy3 - Top Price: $6.53 Bottom Price: $6.44
                              4/11/2025 6:54:00 AM
                              4/11/2025 6:55:00 AM
                              4/11/2025 6:55:00 AM Friday WTIU / Strategy3 - Evaluating potential long entry point...
                              4/11/2025 7:00:00 AM
                              4/11/2025 7:00:00 AM Friday WTIU / Strategy3 - Evaluating potential long entry point...
                              4/11/2025 7:00:00 AM
                              4/11/2025 7:01:00 AM
                              4/11/2025 7:03:00 AM
                              4/11/2025 7:05:00 AM
                              4/11/2025 7:05:00 AM Friday WTIU / Strategy3 - Evaluating potential long entry point...
                              4/11/2025 7:07:00 AM
                              4/11/2025 7:10:00 AM
                              4/11/2025 7:10:00 AM Friday WTIU / Strategy3 - Evaluating potential long entry point...
                              4/11/2025 7:12:00 AM
                              4/11/2025 7:15:00 AM
                              4/11/2025 7:15:00 AM Friday WTIU / Strategy3 - Evaluating potential long entry point...
                              4/11/2025 7:18:00 AM
                              4/11/2025 7:19:00 AM
                              4/11/2025 7:20:00 AM
                              4/11/2025 7:20:00 AM Friday WTIU / Strategy3 - Evaluating potential long entry point...
                              4/11/2025 7:21:00 AM
                              4/11/2025 7:22:00 AM
                              4/11/2025 7:25:00 AM
                              4/11/2025 7:25:00 AM Friday WTIU / Strategy3 - Evaluating potential long entry point...
                              4/11/2025 7:25:00 AM
                              4/11/2025 7:27:00 AM
                              4/11/2025 7:29:00 AM
                              4/11/2025 7:30:00 AM
                              4/11/2025 7:30:00 AM Friday WTIU / Strategy3 - Evaluating potential long entry point...
                              4/11/2025 7:31:00 AM
                              4/11/2025 7:33:00 AM
                              4/11/2025 7:34:00 AM
                              4/11/2025 7:35:00 AM
                              4/11/2025 7:35:00 AM Friday WTIU / Strategy3 - Evaluating potential long entry point...
                              4/11/2025 7:35:00 AM
                              4/11/2025 7:36:00 AM
                              4/11/2025 7:40:00 AM
                              4/11/2025 7:40:00 AM Friday WTIU / Strategy3 - Evaluating potential long entry point...
                              4/11/2025 7:40:00 AM
                              4/11/2025 7:45:00 AM
                              4/11/2025 7:45:00 AM Friday WTIU / Strategy3 - Evaluating potential long entry point...
                              4/11/2025 7:45:00 AM
                              4/11/2025 7:54:00 AM
                              4/11/2025 7:55:00 AM
                              4/11/2025 7:55:00 AM Friday WTIU / Strategy3 - Evaluating potential long entry point...
                              4/11/2025 8:00:00 AM
                              4/11/2025 8:00:00 AM Friday WTIU / Strategy3 - Evaluating potential long entry point...
                              4/11/2025 8:00:00 AM
                              4/11/2025 8:03:00 AM
                              4/11/2025 8:04:00 AM
                              4/11/2025 8:05:00 AM
                              4/11/2025 8:05:00 AM Friday WTIU / Strategy3 - Evaluating potential long entry point...
                              4/11/2025 8:08:00 AM
                              4/11/2025 8:09:00 AM
                              4/11/2025 8:10:00 AM
                              4/11/2025 8:10:00 AM Friday WTIU / Strategy3 - Evaluating potential long entry point...
                              4/11/2025 8:12:00 AM
                              4/11/2025 8:13:00 AM
                              4/11/2025 8:15:00 AM
                              4/11/2025 8:15:00 AM Friday WTIU / Strategy3 - Evaluating potential long entry point...
                              4/11/2025 8:15:00 AM
                              4/11/2025 8:20:00 AM
                              4/11/2025 8:20:00 AM Friday WTIU / Strategy3 - Evaluating potential long entry point...
                              4/11/2025 8:20:00 AM
                              4/11/2025 8:21:00 AM
                              4/11/2025 8:25:00 AM
                              4/11/2025 8:25:00 AM Friday WTIU / Strategy3 - Evaluating potential long entry point...
                              4/11/2025 8:38:00 AM
                              4/11/2025 8:40:00 AM
                              4/11/2025 8:40:00 AM Friday WTIU / Strategy3 - Evaluating potential long entry point...
                              4/11/2025 8:42:00 AM
                              4/11/2025 8:45:00 AM
                              4/11/2025 8:45:00 AM Friday WTIU / Strategy3 - Evaluating potential long entry point...
                              4/11/2025 8:45:00 AM
                              4/11/2025 8:51:00 AM
                              4/11/2025 8:55:00 AM
                              4/11/2025 8:55:00 AM Friday WTIU / Strategy3 - Evaluating potential long entry point...
                              4/11/2025 8:56:00 AM
                              4/11/2025 9:00:00 AM
                              4/11/2025 9:00:00 AM Friday WTIU / Strategy3 - Evaluating potential long entry point...
                              4/11/2025 9:12:00 AM
                              4/11/2025 9:15:00 AM
                              4/11/2025 9:15:00 AM Friday WTIU / Strategy3 - Evaluating potential long entry point...
                              4/11/2025 9:19:00 AM
                              4/11/2025 9:20:00 AM
                              4/11/2025 9:20:00 AM Friday WTIU / Strategy3 - Evaluating potential long entry point...
                              4/11/2025 9:22:00 AM
                              4/11/2025 9:23:00 AM
                              4/11/2025 9:25:00 AM
                              4/11/2025 9:25:00 AM Friday WTIU / Strategy3 - Evaluating potential long entry point...
                              4/11/2025 9:25:00 AM
                              4/11/2025 9:27:00 AM
                              4/11/2025 9:30:00 AM
                              4/11/2025 9:30:00 AM Friday WTIU / Strategy3 - Evaluating potential long entry point...
                              4/11/2025 9:32:00 AM
                              4/11/2025 9:34:00 AM
                              4/11/2025 9:35:00 AM
                              4/11/2025 9:35:00 AM Friday WTIU / Strategy3 - Evaluating potential long entry point...
                              4/11/2025 9:37:00 AM
                              4/11/2025 9:39:00 AM
                              4/11/2025 9:40:00 AM
                              4/11/2025 9:40:00 AM Friday WTIU / Strategy3 - Evaluating potential long entry point...
                              4/11/2025 9:40:00 AM Friday WTIU / Strategy3 - Break Out Buy.
                              4/11/2025 9:40:00 AM
                              4/11/2025 9:42:00 AM
                              4/11/2025 9:45:00 AM
                              4/11/2025 9:45:00 AM Friday WTIU / Strategy3 - Evaluating potential long entry point...
                              4/11/2025 9:45:00 AM
                              4/11/2025 9:46:00 AM
                              4/11/2025 9:50:00 AM
                              4/11/2025 9:50:00 AM Friday WTIU / Strategy3 - Evaluating potential long entry point...
                              4/11/2025 9:51:00 AM
                              4/11/2025 9:55:00 AM
                              4/11/2025 9:55:00 AM Friday WTIU / Strategy3 - Evaluating potential long entry point...
                              4/11/2025 9:56:00 AM
                              4/11/2025 9:57:00 AM
                              4/11/2025 9:59:00 AM
                              4/11/2025 10:00:00 AM
                              4/11/2025 10:00:00 AM Friday WTIU / Strategy3 - Evaluating potential long entry point...
                              4/11/2025 10:02:00 AM
                              4/11/2025 10:04:00 AM
                              4/11/2025 10:05:00 AM
                              4/11/2025 10:05:00 AM Friday WTIU / Strategy3 - Evaluating potential long entry point...
                              4/11/2025 10:05:00 AM
                              4/11/2025 10:07:00 AM
                              4/11/2025 10:09:00 AM
                              4/11/2025 10:10:00 AM
                              4/11/2025 10:10:00 AM Friday WTIU / Strategy3 - Evaluating potential long entry point...
                              4/11/2025 10:22:00 AM
                              4/11/2025 10:23:00 AM
                              4/11/2025 10:24:00 AM
                              4/11/2025 10:25:00 AM
                              4/11/2025 10:25:00 AM Friday WTIU / Strategy3 - Evaluating potential long entry point...
                              4/11/2025 10:26:00 AM
                              4/11/2025 10:30:00 AM
                              4/11/2025 10:30:00 AM Friday WTIU / Strategy3 - Evaluating potential long entry point...
                              4/11/2025 10:31:00 AM
                              4/11/2025 10:35:00 AM
                              4/11/2025 10:35:00 AM Friday WTIU / Strategy3 - Evaluating potential long entry point...
                              4/11/2025 10:39:00 AM
                              4/11/2025 10:40:00 AM
                              4/11/2025 10:40:00 AM Friday WTIU / Strategy3 - Evaluating potential long entry point...
                              4/11/2025 10:41:00 AM
                              4/11/2025 10:42:00 AM
                              4/11/2025 10:44:00 AM
                              4/11/2025 10:45:00 AM
                              4/11/2025 10:45:00 AM Friday WTIU / Strategy3 - Evaluating potential long entry point...
                              4/11/2025 10:45:00 AM
                              4/11/2025 10:47:00 AM
                              4/11/2025 10:50:00 AM
                              4/11/2025 10:50:00 AM Friday WTIU / Strategy3 - Evaluating potential long entry point...
                              4/11/2025 10:50:00 AM
                              4/11/2025 10:53:00 AM
                              4/11/2025 10:55:00 AM
                              4/11/2025 10:55:00 AM Friday WTIU / Strategy3 - Evaluating potential long entry point...
                              4/11/2025 10:57:00 AM
                              4/11/2025 10:58:00 AM
                              4/11/2025 10:59:00 AM
                              4/11/2025 11:00:00 AM
                              4/11/2025 11:00:00 AM Friday WTIU / Strategy3 - Evaluating potential long entry point...
                              4/11/2025 11:02:00 AM
                              4/11/2025 11:03:00 AM
                              4/11/2025 11:05:00 AM
                              4/11/2025 11:05:00 AM Friday WTIU / Strategy3 - Evaluating potential long entry point...
                              4/11/2025 11:20:00 AM
                              4/11/2025 11:20:00 AM Friday WTIU / Strategy3 - Evaluating potential long entry point...
                              4/11/2025 11:20:00 AM
                              4/11/2025 11:21:00 AM
                              4/11/2025 11:23:00 AM
                              4/11/2025 11:25:00 AM
                              4/11/2025 11:25:00 AM Friday WTIU / Strategy3 - Evaluating potential long entry point...
                              4/11/2025 11:35:00 AM
                              4/11/2025 11:35:00 AM Friday WTIU / Strategy3 - Evaluating potential long entry point...
                              4/11/2025 11:35:00 AM
                              4/11/2025 11:40:00 AM
                              4/11/2025 11:40:00 AM Friday WTIU / Strategy3 - Evaluating potential long entry point...
                              4/11/2025 11:40:00 AM
                              4/11/2025 11:46:00 AM
                              4/11/2025 11:49:00 AM
                              4/11/2025 11:50:00 AM
                              4/11/2025 11:50:00 AM Friday WTIU / Strategy3 - Evaluating potential long entry point...
                              4/11/2025 11:59:00 AM
                              4/11/2025 12:00:00 PM
                              4/11/2025 12:00:00 PM Friday WTIU / Strategy3 - Trade entry period is over.
                              4/11/2025 12:04:00 PM
                              4/11/2025 12:05:00 PM
                              4/11/2025 12:07:00 PM
                              4/11/2025 12:08:00 PM
                              4/11/2025 12:09:00 PM
                              4/11/2025 12:10:00 PM
                              4/11/2025 12:10:00 PM
                              4/11/2025 12:11:00 PM
                              4/11/2025 12:12:00 PM
                              4/11/2025 12:15:00 PM
                              4/11/2025 12:18:00 PM
                              4/11/2025 12:19:00 PM
                              4/11/2025 12:20:00 PM
                              4/11/2025 12:20:00 PM
                              4/11/2025 12:23:00 PM
                              4/11/2025 12:24:00 PM
                              4/11/2025 12:25:00 PM
                              4/11/2025 12:25:00 PM
                              4/11/2025 12:27:00 PM
                              4/11/2025 12:28:00 PM
                              4/11/2025 12:29:00 PM
                              4/11/2025 12:30:00 PM
                              4/11/2025 12:33:00 PM
                              4/11/2025 12:34:00 PM
                              4/11/2025 12:35:00 PM
                              4/11/2025 12:35:00 PM
                              4/11/2025 12:36:00 PM
                              4/11/2025 12:39:00 PM
                              4/11/2025 12:40:00 PM
                              4/11/2025 12:41:00 PM
                              4/11/2025 12:45:00 PM
                              4/11/2025 12:46:00 PM
                              4/11/2025 12:50:00 PM
                              4/11/2025 12:51:00 PM
                              4/11/2025 12:53:00 PM
                              4/11/2025 12:54:00 PM
                              4/11/2025 12:55:00 PM
                              4/11/2025 12:55:00 PM Friday WTIU / Strategy3 - Transition to real-time data.
                              Enabling NinjaScript strategy 'Strategy3/353122907' : On starting a real-time strategy - StartBehavior=WaitUntilFlat EntryHandling=All entries EntriesPerDirection=1 StopTargetHandling=By strategy position 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 bar close IsUnmanaged=False MaxRestarts=4 in 5 minutes
                              4/11/2025 12:55:00 PM Friday WTIU / Strategy3 - Cash to Invest: $1000
                              4/11/2025 12:55:00 PM Friday WTIU / Strategy3 - ---------------------------------------------
                              4/11/2025 12:55:00 PM Friday WTIU / Strategy3 - Buying Power: $0
                              4/11/2025 12:55:00 PM Friday WTIU / Strategy3 - Cash Value: $99677
                              4/11/2025 12:55:00 PM Friday WTIU / Strategy3 - Total Cash Balance: $0
                              4/11/2025 12:55:00 PM Friday WTIU / Strategy3 - Initial Margin: $0
                              4/11/2025 12:55:00 PM Friday WTIU / Strategy3 - Intraday Margin: $0
                              4/11/2025 12:55:00 PM Friday WTIU / Strategy3 - Maintenance Margin: $0
                              4/11/2025 12:55:00 PM Friday WTIU / Strategy3 - Position Margin: $0
                              4/11/2025 12:55:00 PM Friday WTIU / Strategy3 - Gross Realized Profit/Loss: $0
                              4/11/2025 12:55:00 PM Friday WTIU / Strategy3 - Realized Profit/Loss: $0
                              4/11/2025 12:55:00 PM Friday WTIU / Strategy3 - Unrealized Profit/Loss: $0
                              4/11/2025 12:55:00 PM Friday WTIU / Strategy3 - Commission: $0
                              4/11/2025 12:55:00 PM Friday WTIU / Strategy3 - Fee: $0

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by argusthome, 03-08-2026, 10:06 AM
                              0 responses
                              60 views
                              0 likes
                              Last Post argusthome  
                              Started by NabilKhattabi, 03-06-2026, 11:18 AM
                              0 responses
                              39 views
                              0 likes
                              Last Post NabilKhattabi  
                              Started by Deep42, 03-06-2026, 12:28 AM
                              0 responses
                              21 views
                              0 likes
                              Last Post Deep42
                              by Deep42
                               
                              Started by TheRealMorford, 03-05-2026, 06:15 PM
                              0 responses
                              23 views
                              0 likes
                              Last Post TheRealMorford  
                              Started by Mindset, 02-28-2026, 06:16 AM
                              0 responses
                              51 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Working...
                              X