Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Is the order engine broken on historical orders? Orders stuck in working state.

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

    #16
    Hello koganam,

    I was asking for you to export and repost as the link on your first post is not working.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #17
      Originally posted by NinjaTrader_ChelseaB View Post
      Hello koganam,

      I was asking for you to export and repost as the link on your first post is not working.
      Here is the zip file.

      It looks like there is more to it than a historical overfill. When I use the settings in the picture attached, I get the VERY FIRST entry order stuck in working order, with the protective orders never even placed. The very first order, dated 10/17/2014.

      Click image for larger version

Name:	NT8TestSettings20211228.png
Views:	99
Size:	29.8 KB
ID:	1183322
      Last edited by koganam; 12-27-2021, 11:29 PM.

      Comment


        #18
        Hello koganam,

        I see there is a lot of extra log in this script, so the first thing I have done is remove all of the extra logic and left just the code for the entries, that you feel is causing the issue.

        Looking at this I am seeing code that is warned not to do in the help guide.

        _oLongEntry = EnterLong(TradeQty, "Long");

        "OnOrderUpdate() will run inside of order methods such as EnterLong() or SubmitOrderUnmanaged(), therefore attempting to assign an order object outside of OnOrderUpdate() may not return as soon as expected. If your strategy is dependent on tracking the order object from the very first update, you should try to match your order objects by the order.Name (signal name) from during the OnOrderUpdate() as the order is first updated."
        https://ninjatrader.com/support/help...rderupdate.htm

        Assigning the order to a variable (or array element) must be done from OnOrderUpdate(). See this 'ProfitChaseStopTrailExitOrdersExample_NT8' example.
        https://ninjatrader.com/support/foru...269#post802269

        Further, you have a print that appears when _oShortEntry is null, but this is in no way attached to the EnterLong() below it which will be triggered every time that line is hit from the condition above. This is because only the next command is triggered by the branching command without curly braces.

        if (/* condition */)
        Print("condition true"); <--- only printed if the condition is true
        EnterLong(); <-- always submitted as it is not within the 1 command action of the condition above

        if (/* condition */)
        {
        Print("condition true"); <-- only printed if the condition is true
        EnterLong(); <-- only submitted if the condition is true
        }

        If you are intentionally submitting these when the outer condition is true, non-reliant on the condition above, let me know.

        I had to change this before even running the test, which breaks the rest of the logic of the script, as this goes against the notes in the help guide. These notes are because of the unexpected behavior that can occur.

        However, with just the entries uncommented, I'm not seeing the first order is getting stuck.

        Below is a link to a video of testing.
        https://drive.google.com/file/d/1NJm...w?usp=drivesdk

        Placing the entries does not seem to be the issue. Before moving forward, please correct the script so that no orders are being assigned to variables outside of OnOrderUpdate().

        Then, ensure that the behavior is not caused by placing the entries as I have done first, to see if it is the additional logic causing the issue.

        Uncomment code, one line at a time to track down where the issue begins. Likely, you will find where additional orders are being submitted.
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Trader146, Today, 11:41 AM
        0 responses
        2 views
        0 likes
        Last Post Trader146  
        Started by jpapa, 04-23-2024, 07:22 AM
        2 responses
        16 views
        0 likes
        Last Post rene69851  
        Started by funk10101, Today, 11:35 AM
        0 responses
        1 view
        0 likes
        Last Post funk10101  
        Started by samish18, Today, 11:26 AM
        0 responses
        1 view
        0 likes
        Last Post samish18  
        Started by Trader146, 03-29-2024, 01:22 PM
        2 responses
        14 views
        0 likes
        Last Post Trader146  
        Working...
        X