Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy leaves ghost orders

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

    Strategy leaves ghost orders

    My strategy is leaving ghost orders in SIM accounts.
    Could do this in real accounts otr in prop firms accounts?
    I am using unnmanaged orders (I have years of experience doing this things).
    Regards! Click image for larger version

Name:	20250110GO.jpg
Views:	192
Size:	275.1 KB
ID:	1330718 .

    #2
    Hello,

    It's difficult to say without knowing the strategy's logic. While stuck orders can sometimes occur on the Sim account, this many would suggest these orders are not being closed within the strategy's internal logic. Keep in mind when using the Unmanaged Approach, there are no internal rules to handle order submission or behavior, so all order handling needs to done within your strategy's internal logic.

    I first recommend debugging the strategy to analyze the strategy's behavior.

    To understand why the script is behaving as it is, 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 date time of the bar and all values compared in every condition that places an order.

    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 important to include a text label for each value and for each comparison operator in the print to understand what is being compared in the condition sets.

    The debugging print output should clearly show what the condition is, what time the conditions are being compared, all values being compared, and how they are being compared.

    Prints will appear in the NinjaScript Output window (New > NinjaScript Output window).

    Further, enable TraceOrders which will let us know if any orders are being ignored and not being submitted when the condition to place the orders is evaluating as true.

    After enabling TraceOrders remove the instance of the strategy from the Configured list in the Strategies window and add a new instance of the strategy from the Available list.

    I am happy to assist you with analyzing the output from the output window.

    Run or 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.

    Below is a link to a support article that demonstrates using informative prints to understand behavior and includes a link to a video recorded using the Strategy Builder to add prints.

    https://support.ninjatrader.com/s/ar...nd-TraceOrders

    Comment


      #3
      In general, these orders appear when the script performs an operation (random sequence, it can be at 2,3,45, 6th trade... and leaves them when you place the three orders (entry, and the 2 stops)). ghost orders, my script correctly manages the orders (there are OCO orders), I have it registered in the output, since this always happens. That I do it on simulated accounts doesn't worry me so much, but I do worry that I do it on a test account and they cancel it.

      This is the output generated from the Strategy Analizer
      There are many entries but as you can see there are cases of taking profits and the corresponding cancellation of the stop (from OnOrderUpdate()) and others where I force the closing of the position (due to the schedule).
      If you have any questions, I am at your disposal.​ NinjaScript Output 13_1_2025 17_30.txt
      Attached Files

      Comment


        #4
        Hello,

        If you are testing in the Strategy Analyzer, have you implemented 1-tick intrabar granularity for accuracy? And Tick Replay if you are using Calculate.OnEachTick or OnPriceChange?

        Additionally, the output does not have any descriptive prints. 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 important to include a text label for each value and for each comparison operator in the print to understand what is being compared in the condition sets.

        The debugging print output should clearly show what the condition is, what time the conditions are being compared, all values being compared, and how they are being compared.

        If you need assistance creating a print please let me know. ​

        Comment


          #5
          I;m sending an example of ghost orders from a new order generated.
          Unfortunately there is no event that can track the creation of these orders, therefore I cannot print it.

          My orders are sent to the market on Close bars in minute format.

          The ghost orders that are shown are generated at the same time that mine are sent to the market, I don't know where the prices at which they are created come from, I have to reset the account every day to delete them.

          Click image for larger version

Name:	20250114GO1.jpg
Views:	192
Size:	184.4 KB
ID:	1330853

          Comment


            #6
            Hello,

            Unfortunately a screenshot is not enough to determine what could be happening. Prints can be made from within OnBarUpdate(). Below is a link to a support article that demonstrates using informative prints to understand behavior.

            https://support.ninjatrader.com/s/ar...nd-TraceOrders

            We would need the debugging output in order to determine the cause of the issue. Without the debugging output we have no information on why the strategy is placing orders as it currently is.

            You can also contact a professional NinjaScript Consultant who would be eager to create or modify this script at your request or assist you with your script. The NinjaTrader Ecosystem has affiliate contacts who provide educational as well as consulting services.

            Please let me know if you would like a list of affiliate consultants who would be happy to create this script or any others at your request or provide one on one educational services.

            Comment


              #7
              Terrible support. Pure garbage.

              Comment


                #8
                Hi

                I have found the error, the problem is the following: (I hope it helps other developers), in my opinion it's a platform error.
                I have three order type variables, where I place the entry, the stoploss and the profit.
                The problem is that I was not initializing them when a new trade was started and that meant that when I entered the market with a new position, Ninja would submit these ghost orders (profit and stop), assigning them the value null to the new cycle solved the problem.


                Regards

                Comment


                  #9
                  Originally posted by mbcito View Post
                  The problem is that I was not initializing them when a new trade was started
                  Order variables should be set to null when the state is filled or canceled.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                  0 responses
                  624 views
                  0 likes
                  Last Post Geovanny Suaza  
                  Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                  0 responses
                  359 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by Mindset, 02-09-2026, 11:44 AM
                  0 responses
                  105 views
                  0 likes
                  Last Post Mindset
                  by Mindset
                   
                  Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                  0 responses
                  562 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by RFrosty, 01-28-2026, 06:49 PM
                  0 responses
                  567 views
                  1 like
                  Last Post RFrosty
                  by RFrosty
                   
                  Working...
                  X