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 charlesugo_1, 05-26-2026, 05:03 PM
            0 responses
            58 views
            0 likes
            Last Post charlesugo_1  
            Started by DannyP96, 05-18-2026, 02:38 PM
            1 response
            143 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by CarlTrading, 05-11-2026, 05:56 AM
            0 responses
            161 views
            0 likes
            Last Post CarlTrading  
            Started by CarlTrading, 05-10-2026, 08:12 PM
            0 responses
            97 views
            0 likes
            Last Post CarlTrading  
            Started by Hwop38, 05-04-2026, 07:02 PM
            0 responses
            276 views
            0 likes
            Last Post Hwop38
            by Hwop38
             
            Working...
            X