Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Obtaining separate data, working with different Time-Frames.

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

    Obtaining separate data, working with different Time-Frames.

    Hello,
    I am working on an indicator that uses 2 timeframes (1 tick and 1 minute) and I would like to know how to extract separate data from either timeframe. That is, the indicator runs on ticks (as the main timeframe, Calculate.OnEachTick) and I would like to check the value of a certain number of EMA-s from a 1-minute candle to the previous one and I would need the Time[0] and Time[1] in 1 minute. How could I get them?
    Thanks in advance.​

    #2
    Data series are stored in an array of arrays in the "Closes" varible. So if you only have one data series you could reference the data as either.

    Close[0] or Closes[0][0] (logically equivalent)

    So by extension if you have <n> data series

    Closes[0][0] (primary)
    Closes[1][0] (second)
    .....

    Closes[<n>][0] (nth)

    So if you want an EMA on a 1 min candle you would

    1. Add the 1 min timeframe

    AddDataSeries(Data.BarsPeriodType.Minute, 1)

    2. Instantiate an EMA for the added timeframe

    ema = EMA(Closes[1], 14)

    3. Now ema[0] is giving you the EMA for a 1 min timeframe inside your wrapping indicator
    Last edited by zundradaniel; 11-26-2024, 07:21 AM.

    Comment


      #3
      Thank you very much zundradaniel for your prompt response.
      Access to candle price features was clear to me. The problem is when I want to access the closing dates of 1 tick or 1 minute bars or the CurrentBar values ​​of both Time Frames. That's when I don't know how to proceed.​

      Comment


        #4
        Hello BIOK.NT,

        It would be the same process to get times, you use the Times series with the BarsInProgress index and bars ago you want just like the price series as shown in post 2. To get the current bar for either series you can use CurrentBars[1] where 1 is the BarsInProgress you want the current bar for.

        Comment


          #5
          Ok. Perfect.
          Thank you very much for the help.​

          Comment

          Latest Posts

          Collapse

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