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

Find EntryPrice Realtime

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

    Find EntryPrice Realtime

    Hello to the forum,

    I want to calculate the entry of a position and have successfully completed the historical part.
    Therefore I am aware that I have to respect different conditions for the entry signal and the sequence signal.

    Realtime I still have problems. I cannot understand which entry price I have to use.
    In my opinion, the CurrentAsk would be correct if the entry condition is given.
    Currently I work with Close [0], which is most often correct.
    This usually works but not always; attached an tick - evaluation.

    12.09.2019 13:59:00 Close[0] 12418 Close[1] 12419 Open[0] 12418,5 Open[1] 12427,5 mybid 12417,5 myask 12419 calcEntryPriceLong 12418,5 tradedEntryPriceLong 12419,5

    12.09.2019 14:06:00 Close[0] 12417,5 Close[1] 12417 Open[0] 12417,5 Open[1] 12428,5 mybid 12416,5 myask 12417,5 calcEntryPriceLong 12417,5 tradedEntryPriceLong 12417,5

    tradeEntryPriceLong equals Position.AveragePrice (green Target and Stopp)










    At 13:59, the tradedEntryPrice (Entry from NT8) is derived neither from
    the current or previous Close, the current or previous Open or from the Current ASK / BID !?

    So my question: What is the correct starting price in a real-time position?

    I am aware that the calculation of the entry price also depends on the fill of the position.
    Currently I calculate and simulate.
    I'll deal with the necessary adjustments in live trading later.
    In any case, the programming must be correct first.

    THANK YOU!



    #2
    use the OnExecutionEvent and capture it. its your best source for the executed price.
    Attached Files

    Comment


      #3
      Hello user10, thanks for your post.

      The OnExecutiaonUpdate event will let you get the entry price for your orders right when they are executed. We have a reference sample here that shows how to use OnExecutionUpdate and OnOrderUpdate.here.

      Please let me know if I can assist any further.
      Chris L.NinjaTrader Customer Service

      Comment


        #4
        Thanks for the hint.

        If I understand correctly, my problem is not solved.

        My calculations should concern both long and short strategies.
        How could onOrderUpdate (Long) help?

        Currently I'm testing with a limit order on GetCurrentBid ();
        the results will be better, but they are not always correct.

        Many thanks for the support!

        Comment


          #5
          Hello user10, thanks for your reply.

          OnExecutionUpdate has a "marketPosition" property that you can use to tell if the execution made the account long or short. You could also use the signal name to identify your orders in a more customized way. The Execution object that is passed to OnExecutionUpdate holds a Name property that can be used.

          Please let me know if I can assist any further.
          Chris L.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by rocketman7, Today, 02:12 AM
          5 responses
          23 views
          0 likes
          Last Post rocketman7  
          Started by trilliantrader, 04-18-2024, 08:16 AM
          7 responses
          28 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Started by samish18, 04-17-2024, 08:57 AM
          17 responses
          66 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Started by briansaul, Today, 05:31 AM
          1 response
          15 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by PaulMohn, Today, 03:49 AM
          1 response
          12 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Working...
          X