Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

NT8 Backteting Multi TimeFrame - How to Calculate Parabolic SAR on Bar Open or Tick

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

    NT8 Backteting Multi TimeFrame - How to Calculate Parabolic SAR on Bar Open or Tick

    I am using NT8
    My primary timeframe is set to 1 Min
    Secondary Time Frame is Set up to 1 Tick

    When back testing my strategy on historical data
    I would like to recalculate 1 Minute based Sar indicator on each Tick.

    Even just a recalculation of Sar on opening of 1 min bar would be a good starting point.

    So as I receive each tick within a new minute,
    I collect new tick values and keep in my variables the actual
    high and low of new uncompleted, 1 minute bar, which is still developing.

    At any tick I would like to launch Sar calculation and pass to it the value of newly developing, not yet completed 1 min bars.
    Parabolic Sar uses bar high and bar low for its calculations.

    I am unable to pass my barlow and barhigh to Sar indicator and need suggestions on how to do that and how to adjust sar formula itself

    I adjusted Sar indicator and added two attributes

    in strategy code
    ...
    if (BarsInProgress == 1)
    {
    // TICK DATA Analysis

    as reciving new ticks keep adjusting barHigh and barLow variables
    ...
    //recalculate Sar - 1 min Sar
    sar = Sar2(BarsArray[0], Init, Max, Delta
    barHigh, barLow
    )[1]; <- not sure if I need to reference previous bar;
    [0] would be incorrect as it refers to 1 min bar which is in the future at the time when I process tick data

    in sar indicator


    - I added two attributes Barlow and BarHigh and in my call to sar from strategy I pass my barLow and barHigh to the indicator

    somewhere in the sar indicator code
    I need to replace Low[0] and High[0] references with
    Barlow and BarHigh

    that has to be done only for the LAST 1 Minute Bar

    I am not sure how to identify in sar indicator code that I am processing last bar
    when I globaly replaced all refrences in indicator from Low[0] to LowBar and High[0] to BarHig attributes all got wrong.

    so please suggest:
    1 how to pass a value to 1 min based bar indicator from secondary time frame
    2. how to tell the indicator to only recalculate last bar ( as I can see all history is recalculated)
    3 how to identify in indicator that I am processing last bar?

    I would appreciate any suggestions
    as I have no idea how to resolve those problems
    Last edited by astef; 11-25-2015, 03:45 PM.

    #2
    Hello astef,

    Thank you for your post.

    First, we coudln't pass the value as the 1 minute bar. You would need to have the SAR base it's calculations on a Data Series. Using the Data Series as the input for the SAR.
    The Data Series would be synced to the 1 Minute bar series, and this is where it gets a bit tricky.

    So first you need the doubles of whatever OHLC you need, whether that is just your barLow and barHigh or all four OHLC values.
    Now each one of these needs to be updated on the Tick bar series you added. You need to pass this as the DataSeries[bar index 0]. So MyDataSeries[0] = barLow.
    You would need a DataSeries for each OHLC double you want to use.

    Now you would use the 0 barsIndex as the most recent or currently forming bar. Yet, use the SAR[bars index 1] to call the most recent closed bar.

    Please let me know if you have any questions.

    Comment


      #3
      I created custom series within my indicator
      in the strategy
      I am trying to set up the values and retrieve the vaule of indicator

      Strategy:

      OnBarUpdate:

      ...

      if (BarsInProgress == 1) // process tick data
      {
      if (Close[0] < barLow)
      barLow = Close[0];

      if (Close[0] > barHigh)
      barHigh = Close[0];


      // call indicator passing curret high and low to the TWO custom data series
      MyCustomIndicator().CustHigh[0] = barHigh;
      MyCustomIndicator().CustLow[0] = barLow;

      // call indicator - call indicator from primary series
      // I just want the value of the indicator as it would be calculated in 1 min timeframe, with only last bar high and low passed to the indicator from the non completed, still forming bar

      and this is tricky - I cannot call it ....

      indicatorValue = MyCustomIndicator(BarsArray[0])[1];

      how to call indicator successfully?
      Last edited by astef; 11-30-2015, 05:19 AM. Reason: changed

      Comment


        #4
        looks like tick replay was an answer....
        rather then custom data series

        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
        330 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
        548 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