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 charlesugo_1, 05-26-2026, 05:03 PM
          0 responses
          55 views
          0 likes
          Last Post charlesugo_1  
          Started by DannyP96, 05-18-2026, 02:38 PM
          1 response
          142 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by CarlTrading, 05-11-2026, 05:56 AM
          0 responses
          160 views
          0 likes
          Last Post CarlTrading  
          Started by CarlTrading, 05-10-2026, 08:12 PM
          0 responses
          96 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