Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Exit order size doesn't match with entry order size

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

    #16
    Hello linkcou,

    Thanks for your notes.

    In the screenshot you shared on post # 13 I see that your ExitLongLimit() order is using a variable called "Qty" but I do not see where you are defining this value.

    Instead of using "Qty", I suggest using the sumFilled amount for the exit orders as seen in the reference sample on the forum thread linked below.

    Hello, I see in the documentation you have fixed: 15048 Added Adapter, Rithmic Updated Rithmic API to version 11.3.0.0 Can you elaborate on that please? Will OnOrderUpdate() OnExecutionUpdate() and OnPositionUpdate() be called in the expected order?
    Brandon H.NinjaTrader Customer Service

    Comment


      #17
      Hi Brandon,

      Thanks for your message. "Qty" is a fixed input with the number of contracts that I want to enter the limit order.

      Actually the print output that i shared before are with the SumFilledLong / SumFilledShort quantities. See the screenshot below. I added the ChangeOrder condition if ExitLimitL is not null but i am still having troubles...

      See below the code:
      Click image for larger version

Name:	image.png
Views:	45
Size:	119.0 KB
ID:	1280704

      Comment


        #18
        Hello linkcou,

        Thanks for your notes.

        To clarify, what broker and connection are you using when testing this? (NinjaTrader, Interactive Brokers, Rithmic, etc.)

        Please create and share with us a reduced test script that demonstrates the behavior you are reporting and the steps you are taking to reproduce the behavior using the test script so we may investigate this matter further.

        Note that a reduced copy refers to a copy of the script that contains the minimum amount of code needed to reproduce the issue. All other code is commented out or removed.

        To create a copy of your script to modify, open a New > NinjaScript Editor, select your script, right-click in the Editor, select 'Save as', name the script, and click OK.​

        To export the script to share, go to Tools > Export > NinjaScript AddOn.
        Brandon H.NinjaTrader Customer Service

        Comment


          #19
          Hello Brandon, thanks for your support!

          I'm using Rithmic as part of a funded account from Topstep.

          Attaching the test as mentioned. Let me know if you need anything else.

          Thanks!!
          Attached Files

          Comment


            #20
            Hello linkcou,

            Thanks for your notes.

            Rithmic still uses separate feeds for Order/Execution/Position events and these events still do not have a deterministic order in NinjaTrader. You will want to be mindful to handle these events separately and not rely on Order information in OnExectuionUpdate where you would want to handle stop and target submission.

            From the OnExecutionUpdate() help guide: "Rithmic and Interactive Brokers Users: When using a NinjaScript strategy it is best practice to only work with passed by value data from OnExecution. Instances of multiple fills at the same time for the same instrument might result in an incorrect OnPositionUpdate, as sequence of events are not guaranteed due to provider API design."

            The RithmicIBFriendlyExamples scripts shared by my colleague Jim on the forum thread below demonstrates how to program a strategy for Rithmic with OnExecutionUpdate/OnOrderUpdate.

            https://forum.ninjatrader.com/forum/...72#post1206372

            Please study the ManagedRithmicIBFriendlyExample script from the forum thread linked above and compare the logic to your script to see where differences might be.
            Brandon H.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by DJ888, Today, 10:57 PM
            0 responses
            6 views
            0 likes
            Last Post DJ888
            by DJ888
             
            Started by MacDad, 02-25-2024, 11:48 PM
            7 responses
            158 views
            0 likes
            Last Post loganjarosz123  
            Started by Belfortbucks, Today, 09:29 PM
            0 responses
            7 views
            0 likes
            Last Post Belfortbucks  
            Started by zstheorist, Today, 07:52 PM
            0 responses
            7 views
            0 likes
            Last Post zstheorist  
            Started by pmachiraju, 11-01-2023, 04:46 AM
            8 responses
            151 views
            0 likes
            Last Post rehmans
            by rehmans
             
            Working...
            X