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 charlesugo_1, 05-26-2026, 05:03 PM
          0 responses
          66 views
          0 likes
          Last Post charlesugo_1  
          Started by DannyP96, 05-18-2026, 02:38 PM
          1 response
          149 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by CarlTrading, 05-11-2026, 05:56 AM
          0 responses
          162 views
          0 likes
          Last Post CarlTrading  
          Started by CarlTrading, 05-10-2026, 08:12 PM
          0 responses
          99 views
          0 likes
          Last Post CarlTrading  
          Started by Hwop38, 05-04-2026, 07:02 PM
          0 responses
          286 views
          0 likes
          Last Post Hwop38
          by Hwop38
           
          Working...
          X