Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

simple breakout strategy

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

    simple breakout strategy

    Having trouble fixing this simple strategy.

    My goal is to reference the high and low of the first bar of a session or a bar at a specific time, and go Long/short if the next candle exceeds it by a tick. Also trying to limit it to 1 trade per day.

    Any advice?

    #2
    Hi dawil872,

    For the first High and Low of the session you can use BarsSinceSession.
    double HighFirstBarOfSession = High[Bars.BarsSinceSession];

    For a specific time, there is GetBar() method. The following sample can help with GetBar()


    Limiting trades to once per day could be done with a custom bool flag, resetting at FirstBarOfSession, or work directly with TradePerformance class, as was suggested in your previous thread on this.
    Last edited by NinjaTrader_RyanM1; 11-22-2011, 11:34 AM.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      I am looking for the code for a simple strategy to buy if prices close at or below the 7-day low.

      Comment


        #4
        Hi GeorgeO,

        You can likely build this expression in the strategy wizard. Please see here for help with common expression you can create:


        In the strategy wizard you could use crossing expressions and built in indicator MIN to get the lowest value over a series of bars. Be aware of a common pitfall here: Close can never cross below the lowest value over a series of bars, if the close bar is also included in the MIN series. To avoid this set the MIN bars ago to 1 or check when close == MIN(Low, 14) value rather than crosses below it.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by GeorgeO View Post
          I am looking for the code for a simple strategy to buy if prices close at or below the 7-day low.
          Code:
          if (Close[0] <= MIN(Low, 6)[1]) GoLong();
          where GoLong() is your function to make a long entry, however you may choose to code it.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          656 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          371 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          109 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          574 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          579 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X