Gaps indicator (similar to TradingView)

Forums ProRealTime English forum ProBuilder support Gaps indicator (similar to TradingView)

Viewing 1 post (of 1 total)
  • #249243

    Parameters/inputs:

    • close gap partially: (boolean, YES or NO)
    • minimal deviation: as volatility multiple
      nATR := vol = AverageTrueRange[periodATR] / Close, threshold = x
    • limit max gap trail length: (boolean)
      • if = 1, then length = y
    • up gaps and down gaps colors

    A gap is a visible empty space between two candles.
    Mathematically: Close(t−1) ≠ Open(t), where t defines the time when the gapping candle occurs.

    If
    |Close(t−1) - Open(t)| ≥ x * Vol(t−1)
    then the gap is considered significant.

    If that empty space gets partially or fully filled between t and t+n, the gap must be updated to reflect the remaining unfilled space on the chart.


    Example:

    • Close(t−1) = 5
    • Open(t) = 10
    • Vol(t−1) = 0.1
    • x = 2

    Then:
    |5 - 10| = 5
    2 * 0.1 * 5 = 1
    Since 5 ≥ 1 → gap is significant.

    If in t+1 the candle low reaches 8, then the remaining gap is from 5 to 8.
    Same applies if, in t, the gapping candle has low < open. That portion is considered filled and must be removed.

    General rule:
    0 ≤ unfilled space ≤ |Close(t−1) - Open(t)| := gap


    Here is the Pine Script version


    Note: The version we want is slightly different — it detects gaps using Close(t−1) instead of High(t−1) which is more accurate.

Viewing 1 post (of 1 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login