Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Trade Enter and Exit Prices

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

    Trade Enter and Exit Prices

    Hello

    How can I get my position entry price using for a position that was executed with the EnterLong command?
    I have tried the following, however, the realEntryPrice value was set to zero. Am I doing something wrong or is it because I'm using a demo account?

    Code:
    IOrder _realEntryOrder = EnterLong();
    double _realEntryPrice = _realEntryOrder.AvgFillPrice;
    The same way I tried to get the exit value but I got the value zero again:

    Code:
    IOrder _realExitOrder = ExitLong();
    double _realExitOrder = ExitShort();
    Thanks

    #2
    Hello Kiss987,

    Where are you calling these methods from? OnBarUpdate(), OnOrderUpdate(), OnExecution()
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      OnBarUpdate

      Comment


        #4
        Hello,

        Thank you for the reply.

        Based on the code this would not report a value if you are calling this directly after the EnterLong statement.

        The order will need a chance to be submitted and filled which you would not directly see after calling it.

        You could declare the variable _realEntryOrder outside of OnBarUpdate so after it is filled you could check the value on future calls to OnBarUpdate. Or you could use OnExectuion or OnOrderUpdate to view the orders progress and values.





        I look forward to being of further assistance.

        Comment


          #5
          Are the two events triggered for orders that were made out side of the strategy (for example, on a different strategy)?

          Comment


            #6
            Hello,

            Thank you for the question.

            Each strategy is its own instance so the events in a NinjaScript file would only be related to that strategies orders. Other strategies can not provide data to this strategy, and this strategy can not see data from other strategies.

            I look forward to being of further assistance.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            558 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            324 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            101 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            545 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            547 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X