GetAggregationPeriod equivalent for multi-timeframe indicators

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #258156 quote
    thomas2004chthomas2004ch
    Participant
    Senior

    By ThinOrSwim and TradingView they have such function to create multi-timeframe indicator.

    #258158 quote
    NicolasNicolas
    Keymaster
    Legend

    With time dependent timeframe, you can use the GETTIMEFRAME instruction that returns the current timeframe of the chart in seconds.

    Here is the link in the documentation: https://www.prorealcode.com/documentation/gettimeframe/

    There is no built-in instruction for non linear timeframe such as ticks or volumes. I will think of a coded workaround.

    #258169 quote
    NicolasNicolas
    Keymaster
    Legend

    To obtain the number of ticks in the current candle, we can use:

    if not isset($ticks[barindex]) then
    $ticks[barindex] = 0
    endif
    
    
    if islastbarupdate then
    $ticks[barindex]=$ticks[barindex]+1
    endif
    
    
    return $ticks[barindex] coloured(0,255,255) style(histogram)
    

    A minimum of 2 candles are needed to verify that the counter is correct, here a 20-tick chart.

    prorealtime-ticks-counter.png prorealtime-ticks-counter.png
    #258180 quote
    NicolasNicolas
    Keymaster
    Legend

    Below is the code that indicates the amount of volume in the candle; here is an example with a chart in 50-volumes per candlestick.

    if not isset($volumes[barindex]) then
    $volumes[barindex] = 0
    endif
    
    
    if islastbarupdate then
    diff=volume-$volumes[barindex]
    $volumes[barindex]=$volumes[barindex]+diff
    endif
    
    
    return $volumes[barindex] coloured("orchid") style(histogram,2)
    
    robertogozzi thanked this post
    prorealtime-volumes-count-per-bar.png prorealtime-volumes-count-per-bar.png
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

GetAggregationPeriod equivalent for multi-timeframe indicators


Platform Support: Charts, Data & Broker Setup

New Reply
Author
Summary

This topic contains 3 replies,
has 2 voices, and was last updated by NicolasNicolas
7 months, 2 weeks ago.

Topic Details
Forum: Platform Support: Charts, Data & Broker Setup
Language: English
Started: 02/17/2026
Status: Active
Attachments: 2 files
ProRealCode ProRealCode
Loading...