Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Last Trade AveFillPrice in Condition Set

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

    Last Trade AveFillPrice in Condition Set

    Can someone point me to a link or reference that shows how to use the entry price (AvgFillPrice) of the last trade in a condition set?
    I found references to Last Trade in Help, but nothing on how to apply AvgFillPrice to the last trade. In Trade Class (Help) it mentions Entry Gets an IExecution object representing the entry, but that didn't lead anywhere.
    I also found this in Help, Functions

    double AvgFillPrice(string orderId)
    Gets the average entry price for the specified orderId.


    But, I only want to apply it to the LAST TRADE.


    The way I want to use it in a Condition set is:

    "If AvgFillPrice of the last trade = X AND ......... then ......"

    Maybe this one is way over my head?? I won't be offended if you tell me so.
    Thanks,
    Joe

    #2
    Joe,

    Please do not confuse the functions for ATI interfaces with NinjaScript functions.

    IExecution is for NinjaScript and AvgFillPrice() is part of the ATI interface. Which one are you using?
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Oh. Well, I don't know what ATI is (some interface??) but I'm strictly using Ninjascript. (NT and Zenfire).

      If the answer is easy then I would love to see it, but if it's complicated just let me know. I sure don't want to bother you too much, especially after you helping me so much with the Realized PnL and ATM problem.

      This Last Trade entry price will be applied to the same strategy and is the absolute last part of it, and at that, it isn't totally critical. It would just prevent me from manually having to stop the strategy after a trade is made on one condition, then start it again when the 2nd condition shows up. That might even goof up the PnL totals. Ideally, it shouldn't take more than one trade per condition at a time.
      In other words, Take a trade on Condition A then don't take any trades until Condition B shows up. If it trades on Condition B, then don't take any trades until Condition A shows up again. I can do this by using the Entry Price of the last trade (if I knew the code to get the entry price of the last trade I could put that into a variable, like you just taught me how to do!!)
      Thanks!
      Joe

      Comment


        #4
        If you are using NinjaScript you should not be using AvgFillPrice(). To get the fill price you can access it via Position.AvgPrice. While you have a position open, it will give you the average fill price for the current open position. If you want to save this value for later use you will need to assign it to another variable.

        Code:
        someVariable = Position.AvgPrice;
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Excellent! I'll give it shot. The ATMCreate stuff is really throwing me off on how to do things versus a plain old Ninjascript that doesn't use ATM.
          Thanks, I won't bother you any more today!!
          Joe

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          633 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          364 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          105 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          567 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          568 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X