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

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 Nicholewatkinsi, Yesterday, 10:53 PM
          0 responses
          6 views
          0 likes
          Last Post Nicholewatkinsi  
          Started by dward123, 01-02-2024, 09:59 PM
          4 responses
          175 views
          0 likes
          Last Post Lancer
          by Lancer
           
          Started by ETFVoyageur, Yesterday, 04:00 PM
          2 responses
          19 views
          0 likes
          Last Post ETFVoyageur  
          Started by AaronKTradingForum, Yesterday, 03:44 PM
          1 response
          14 views
          0 likes
          Last Post AaronKTradingForum  
          Started by Felix Reichert, 04-26-2024, 02:12 PM
          11 responses
          80 views
          0 likes
          Last Post Felix Reichert  
          Working...
          X