Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Current Bid >= Last Fill + (0.5 x ATR)

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

    Current Bid >= Last Fill + (0.5 x ATR)

    How would I create the following condition in Condition Builder?

    "Current bid is greater than or equal to last fill price plus 1/2 of the Average True Range (ATR)?"

    #2
    Unfortunately you can't. You can do it very easily with NinjaScript though. By last fill price I am assuming you mean last traded price.
    Code:
    if (GetCurrentBid() >= Close[0] + 0.5 * ATR(14)[0])
    {
         // Do something
    }
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Thanks, Josh.

      I kind of thought you couldn't create the condition in Condition Builder, but I wanted to make sure.

      Regarding your formula, by last fill, I mean the last price at which I personally bought or sold a unit (not the last price at which anyone bought or sold a unit).

      What I'm trying to do is scale into a position by buying or selling an additional unit each time the price increases (or decreases) by half of the average true range (ATR) relative to the previous unit I bought or sold.

      For example, if the 20-day ATR of crude oil is $2.60, and I purchase (or sell) a unit at $90, I would purchase an additional unit at $91.30
      [$90 + (1/2 x $2.60)] if going long or sell an additional unit at $88.70
      [$90 - (1/2 x $2.60)] if going short.

      Comment


        #4
        This can be done easily in NT6.5 which is currently in beta but its an advanced concept. There is a new OnExecution() method call for each incoming fill generated by orders in your strategy. You can monitor this to get the last fill for example.
        RayNinjaTrader Customer Service

        Comment


          #5
          Thanks, Ray.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          571 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          331 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
          549 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          549 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X