OPEN-SOURCE SCRIPT

HTF Current/Average Range

79
The "HTF(Higher Timeframe) Current/Average Range" indicator calculates and displays the current and average price ranges across multiple timeframes, including daily, weekly, monthly, 4 hour, and user-defined custom timeframes.

Users can customize the lookback period, table size, timeframe, and font color; with the indicator efficiently updating on the final bar to optimize performance.

When the current range surpasses the average range for a given timeframe, the corresponding table cell is highlighted in green, indicating potential maximum price expansion and signaling the possibility of an impending retracement or consolidation.

For day trading strategies, the daily average range can serve as a guide, allowing traders to hold positions until the current daily range approaches or meets the average range, at which point exiting the trade may be considered.

For scalping strategies, the 15min and 5min average range can be utilized to determine optimal holding periods for fast trades.

Other strategies:
Intraday Trading - 1h and 4h Average Range
Swing Trading - Monthly Average Range
Short-term Trading - Weekly Average Range

Also using these statistics in accordance with Power 3 ICT concepts, will assist in holding trades to their statistical average range of the chosen HTF candle.

CODE

The core functionality lies in the data retrieval and table population sections.

The request.security function (e.g., [dailyHigh, dailyLow] = request.security(syminfo.tickerid, "D", [high, low], lookahead = barmerge.lookahead_off)) retrieves high and low prices from specified timeframes without lookahead bias, ensuring accurate historical data.

These values are used to compute current ranges and average ranges (ta.sma(high - low, avgLength)), which are then displayed in a dynamically generated table starting at (if barstate.islast) using table.new, with conditional green highlighting when the current range is greater than average range, providing a clear visual cue for volatility analysis.



Declinazione di responsabilità

Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.