This script automatically detects and updates key Support & Resistance (S/R) levels using a higher timeframe (MTF) approach. By leveraging volume confirmation, levels are only identified when significant volume (relative to the SMA of volume) appears. Each level is drawn horizontally in real time, and whenever the market breaks above a resistance level (and retests it), the script automatically converts that resistance into support. The opposite occurs if the market breaks below a support level.
Key Features:
Multi-Timeframe (MTF) Data Select a higher timeframe for more robust S/R calculations. The script fetches High, Low, Volume, and SMA of Volume from the chosen timeframe.
Automatic Role Reversal Resistance becomes Support if a breakout retest occurs. Support becomes Resistance if a breakdown retest occurs.
Dynamic Line Width & Labeling Each S/R line’s thickness increases with additional touches, making frequently tested levels easier to spot. Labels automatically display the number of touches (e.g., “R 3” or “S 2”) and can have adjustable text size.
Volume Threshold Only significant pivots (where volume exceeds a specified multiplier of average volume) are plotted, reducing noise.
Horizontal Offset for Clarity Lines are drawn with timestamps instead of bar_index, ensuring that old levels remain visible without chart limitations.
Adjustable Maximum Levels Maintain a clean chart by limiting how many S/R lines remain at once.
How It Works:
Pivot Detection: The script identifies swing highs and lows from the higher timeframe (timeframeSR).
Volume Check: Only pivots with volume ≥ (SMA Volume * volumeThreshold) qualify.
Line Creation & Updates: New lines are drawn at these pivots, labeled “R #” or “S #,” indicating how many times they’ve been touched.
Role Reversal: If price breaks above a resistance and retests it from above, that line is removed from the resistance array and re-created in the support array (and vice versa).
Inputs:
Timeframe for S/R: Choose the higher timeframe for S/R calculations. Swing Length: Number of bars to consider in a pivot calculation.
Minimum Touches: Minimum required touches before drawing or updating a level.
Volume Threshold (Multiplier): Determines how much volume (relative to SMA) is needed to confirm a pivot.
Maximum Number of Levels: Caps how many S/R lines can be shown at once.
Color for Resistance & Color for Support: Customize your preferred colors for lines and labels.
Label Size: Select from "tiny", "small", "normal", "large", or "huge" to resize the labels.
Disclaimer:
This script is intended for educational purposes and should not be interpreted as financial or investment advice. Always conduct your own research or consult a qualified professional before making trading decisions.
Siguiendo fielmente el espíritu de TradingView, el autor de este script lo ha publicado en código abierto, permitiendo que otros traders puedan entenderlo y verificarlo. ¡Olé por el autor! Puede utilizarlo de forma gratuita, pero tenga en cuenta que la reutilización de este código en la publicación se rige por las Normas internas. Puede añadir este script a sus favoritos y usarlo en un gráfico.
La información y las publicaciones que ofrecemos, no implican ni constituyen un asesoramiento financiero, ni de inversión, trading o cualquier otro tipo de consejo o recomendación emitida o respaldada por TradingView. Puede obtener información adicional en las Condiciones de uso.