Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Unmanaged order entry overfill issues

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

    Unmanaged order entry overfill issues

    Very strange results with my strategy based off of the unmanaged rithmic friendly multiple entry example. I have some conditons that trigger a golong/goshort bool. This bool then triggers my code. I've also programmed an order Entry button (order button example posted here) that when pressed set's the golong/goshort bool via a button press. Which of course then triggers the same entry code.

    When the conditions code triggers the golong/goshort i get overfills quite often. If I press the Entry button, which trigges the exact same code it fills with the correct amount every single time.

    I have prints on every single line of code but so much to try to digest. Any thoughts on what I've posted here so far? ​

    #2
    Hello abandonedBaby,

    Thank you for your post.

    To understand why the script is behaving as it is, such as placing orders or not placing orders or drawing objects 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 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.



    Also note that you can choose to ignore overfills when using the unmanaged approach. The default behavior for handling over fills is to attempt to stop, cancel and close. The strategy will disable, try to cancel active orders, and close positions it has created. The goal is to prevent the strategy from leaving an unprotected position due to the overfill.

    Setting IgnoreOverfill to true will prevent the default behavior from occurring, and you can then check for orders with HasOverfill set to true in OnOrderUpdate to trap the occurrence and handle on your own.

    https://ninjatrader.com/support/helpGuides/nt8/ignoreoverfill.htm
    Last edited by NinjaTrader_Gaby; 10-01-2024, 09:17 AM.

    Comment


      #3
      That did help. I noticed that my conditions were triggering multiple times before my limiting condition ...= flat was registering as still flat so some extra orders were getting through. Or at least that's how i understood it. I solved this by creating an inTrade bool = false. I then set the bool to true after my condition was met. To reset the bool to false, i placed it in the OnBarExecution section just after my first Long entry string was detected. I tried it in other locations but it wouldn't get set to false fast enough to stop processing my conditions. Oh, i set my conditions to require the bool be false. Not sure if there was another solution but this completely stopped all my overfills.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by NullPointStrategies, Today, 05:17 AM
      0 responses
      52 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      130 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      70 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      44 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      48 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X