Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Script wont place orders after trying to Increase order size

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

    Script wont place orders after trying to Increase order size

    Hi. I have written some code in my strategy to try and have the order size increase based of if there is a flip in my position direction. So on the first switch to longs if we were previously short we increase the size by +1. And visa versa for shorts. After adding all my logic, the script is no longer placing in trades when I test it in the script analyzer and backtest it. Can anyone help me figure out what Might be causing this? Thanks
    Attached Files

    #2
    Hello agclub,

    The TraceOrders would tell why orders are being ignored or automatically cancelled.

    Enable TraceOrders in State.Configure and save the output to text file and include this with your next post.

    Below is a link to a support article on using TraceOrders and Print() to understand behavior.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_ChelseaB View Post
      Hello agclub,

      The TraceOrders would tell why orders are being ignored or automatically cancelled.

      Enable TraceOrders in State.Configure and save the output to text file and include this with your next post.

      Below is a link to a support article on using TraceOrders and Print() to understand behavior.
      https://support.ninjatrader.com/s/ar...nd-TraceOrders
      Hi chelsea. Thanks for the reply. I have added some print statements and the TraceOrders line as per the article, but I see no output of any kind in my NinjaScript Output window. What would you suggest trying next?

      Comment


        #4
        Hello agclub,

        May I confirm you have set TraceOrders = true; in State.Configure and not in State.SetDefaults?

        Have you opened the NinjaScript Output window making the change and compiling and then reloaded the script?
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_ChelseaB View Post
          Hello agclub,

          May I confirm you have set TraceOrders = true; in State.Configure and not in State.SetDefaults?

          Have you opened the NinjaScript Output window making the change and compiling and then reloaded the script?
          Correct. And still no output when i compile. Kindly see the images

          Click image for larger version

Name:	image.png
Views:	35
Size:	16.2 KB
ID:	1298707Click image for larger version

Name:	image.png
Views:	42
Size:	100.6 KB
ID:	1298706

          Comment


            #6
            Hello agclub,

            May I confirm you have reloaded the script after making the changes and compiling?

            Are there errors appearing on the Log tab of the Control Center when enabling the script?

            Add Print(Time[0]); to the top of OnBarUpdate and reload the script, do you see this print appearing in the output window?

            Is the Strategy showing with the Enabled checkbox checked on the Strategies tab of the Control Center?
            Chelsea B.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by NullPointStrategies, 03-13-2026, 05:17 AM
            0 responses
            87 views
            0 likes
            Last Post NullPointStrategies  
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            151 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            80 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            53 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            62 views
            0 likes
            Last Post TheRealMorford  
            Working...
            X