Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy will not trade but shows historical trades on sim account

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

    Strategy will not trade but shows historical trades on sim account

    It's like there's two different trading accounts. When I woke up my strategy had turned off but there was still an open position. So I closed it. I did one more buy market then close just to test.

    Then I tried to activate my strategy again, and it removed that close I manually did as if it never existed. But for the past like 200 bars or so no trades when this strategy should be trading near constantly. Then behind that, it trades like normal.

    I take the strategy off, disconnect from the account, re-connect, open a new chart. And my original manual trades were there.

    Then I open the strategy again, gone, same thing as before. Nothing wrong in error logs, strategy page shows green.

    Strategy was working fine for 2 days straight.

    #2
    Hello unpronounceable1700,

    Thank you for your post.

    To understand why the script is behaving as it is, such as placing orders or not placing orders when expected, it is necessary to add prints to the script that print the values used for the logic of the script to understand how the script is evaluating.

    In the strategy add prints (outside of any conditions) that print the values of every variable used in every condition that places an order along with the time of that bar.

    This will print to the output window. Backtest the script and when the output from the output window appears save this by right-clicking the output window and selecting Save As... -> give the output file a name and save -> then attach the output text file to your reply.

    Output from prints will appear in the NinjaScript Output window.
    NT8: New -> NinjaScript Output

    The prints should include the time of the bar and should print all values from all variables and all hard coded values in all conditions that must evaluate as true for this action to be triggered. It is very helpful to include labels and operators in the print to understand what is being compared in the condition sets.

    Below I am providing a link to videos that demonstrate adding prints to a script to get further information about the behavior of the script.
    NT8 —


    If you are using the Strategy Builder in NinjaTrader 8, you can also build prints in the Actions window under Misc -> Print.
    NT8 Strategy Builder —



    It is also helpful to set TraceOrders to true in State.Configure as well as print the order object in OnOrderUpdate().
    TraceOrders will output to the NinjaScript Output window a message when orders are being submitted, ignored, cancelled, or rejected.
    Printing the order object in OnOrderUpdate() will allow you to track the progression of the order from submitted, to working, to filled, cancelled, or rejected.
    These tools will let you know what happens to the order.
    TraceOrders - https://ninjatrader.com/support/help...raceorders.htm
    OnOrderUpdate() - https://ninjatrader.com/support/help...rderupdate.htm

    I'm also including a link to a forum post with further suggestions on debugging a script.


    Save the output from the output window to a text file. Let me know if you need assistance creating a print or enabling TraceOrders.

    I am happy to assist with analyzing the output from prints and TraceOrders.​

    Comment


      #3
      Originally posted by NinjaTrader_Gaby View Post
      Hello unpronounceable1700,

      Thank you for your post.

      To understand why the script is behaving as it is, such as placing orders or not placing orders when expected, it is necessary to add prints to the script that print the values used for the logic of the script to understand how the script is evaluating.

      In the strategy add prints (outside of any conditions) that print the values of every variable used in every condition that places an order along with the time of that bar.

      This will print to the output window. Backtest the script and when the output from the output window appears save this by right-clicking the output window and selecting Save As... -> give the output file a name and save -> then attach the output text file to your reply.

      Output from prints will appear in the NinjaScript Output window.
      NT8: New -> NinjaScript Output

      The prints should include the time of the bar and should print all values from all variables and all hard coded values in all conditions that must evaluate as true for this action to be triggered. It is very helpful to include labels and operators in the print to understand what is being compared in the condition sets.

      Below I am providing a link to videos that demonstrate adding prints to a script to get further information about the behavior of the script.
      NT8 —


      If you are using the Strategy Builder in NinjaTrader 8, you can also build prints in the Actions window under Misc -> Print.
      NT8 Strategy Builder —



      It is also helpful to set TraceOrders to true in State.Configure as well as print the order object in OnOrderUpdate().
      TraceOrders will output to the NinjaScript Output window a message when orders are being submitted, ignored, cancelled, or rejected.
      Printing the order object in OnOrderUpdate() will allow you to track the progression of the order from submitted, to working, to filled, cancelled, or rejected.
      These tools will let you know what happens to the order.
      TraceOrders - https://ninjatrader.com/support/help...raceorders.htm
      OnOrderUpdate() - https://ninjatrader.com/support/help...rderupdate.htm

      I'm also including a link to a forum post with further suggestions on debugging a script.


      Save the output from the output window to a text file. Let me know if you need assistance creating a print or enabling TraceOrders.

      I am happy to assist with analyzing the output from prints and TraceOrders.​

      Thank you. That was pissing me off. Didn't know an output window existed. I think I got the problem solved, had my entries per direction limit set too low.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      119 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      62 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      41 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      45 views
      0 likes
      Last Post TheRealMorford  
      Started by Mindset, 02-28-2026, 06:16 AM
      0 responses
      82 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Working...
      X