Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Offset Breakout

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

    Offset Breakout

    OK i want to create a simple strategy

    -Find the maximum on a daily basis of ( Close- Low) and (High-Close) of the prior day
    -Create the 3 day average of the maximum
    -Add this average to the current open of the session
    -go long when prices penetrate the barrier
    -trade is closed at close


    When using RTH for ES ##-## not all of the signals are correct when double checking the chart. The print option of the average shows unstable numbers.

    See attachment
    Attached Files

    #2
    Originally posted by markus1000 View Post
    OK i want to create a simple strategy

    -Find the maximum on a daily basis of ( Close- Low) and (High-Close) of the prior day
    -Create the 3 day average of the maximum
    -Add this average to the current open of the session
    -go long when prices penetrate the barrier
    -trade is closed at close


    When using RTH for ES ##-## not all of the signals are correct when double checking the chart. The print option of the average shows unstable numbers.

    See attachment
    Do you get any output at all form that? I would expect it to fail initially at the this line:

    Code:
    double MaxOffsetAvg = (myDataSeries3[0] + myDataSeries3[1]+myDataSeries3[2])/3;
    seeing as how you are trying to access an index of 2, which would not exist until the third bar.

    Comment


      #3
      Originally posted by koganam View Post
      Do you get any output at all form that? I would expect it to fail initially at the this line:

      Code:
      double MaxOffsetAvg = (myDataSeries3[0] + myDataSeries3[1]+myDataSeries3[2])/3;
      seeing as how you are trying to access an index of 2, which would not exist until the third bar.

      the data series is based on daily bars, so that shouldn't be a big problem. i could use calculate bars on close (but it doesn't have any effect).

      of course when running the strategy from lets say 2000, and my historical data begins at that same time, i would need to wait three days in order to get useful values

      The strategy is kind of working you can add it to ninja and try it, but the values are not accurate and i dont know why

      Comment


        #4
        Hello markus1000,
        The SMA is not being calculated for the secondary (daily) series as the data series (dataSeries3) is referenced for the primary bar only.

        Please refer to this sample code which demonstrates how to sync a secondary data series
        Note: In NinjaTrader 8 It is no longer needed to use an indicator to sync a secondary series. This can be done directly from the Series<T> (https://ninjatrader.com/support/helpGuides/nt8/NT%20HelpGuide%20English.html?seriest.htm) constructor. This post is left for historical purposes. Series objects are useful for
        JoydeepNinjaTrader Customer Service

        Comment


          #5
          but myDataSeries3.Set(Math.Max(Closes[1][0] -Lows[1][0], Highs[1][0] -Closes[1][0])); does not address any data from the first series

          Closes[0][0] would address the first but Closes[1][0] the second. i could even substitute Closes[1][0] by PriorDayOHLC().PriorClose[0], but that doesnt solve the problem

          but i will take a look at the sample script addressing this problem

          Comment


            #6
            Hello markus1000,
            Its not the value rather the data points which matters.

            Say you are loading 5 days of data. Thus the daily bar will have only 5 data points

            However the intraday (5 minute) bar will have much more data points (60 / 5 * 24 * 5 data points).

            Thus the SMA will be calculated on that data points and not on 5 data points.

            This sample code demonstrates how to calculate/reference a data series based on the secondary data series
            Note: In NinjaTrader 8 It is no longer needed to use an indicator to sync a secondary series. This can be done directly from the Series<T> (https://ninjatrader.com/support/helpGuides/nt8/NT%20HelpGuide%20English.html?seriest.htm) constructor. This post is left for historical purposes. Series objects are useful for
            JoydeepNinjaTrader Customer Service

            Comment


              #7
              that makes sense, still learning. i checked out the script which helped me a lot. thanks

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              661 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              375 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              110 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
              580 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X