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.
ברוח TradingView אמיתית, מחבר הסקריפט הזה פרסם אותו בקוד פתוח, כך שסוחרים יוכלו להבין ולאמת אותו. כל הכבוד למחבר! אתה יכול להשתמש בו בחינם, אבל השימוש החוזר בקוד זה בפרסום כפוף לכללי הבית. אתה יכול להכניס אותו למועדפים כדי להשתמש בו בגרף.
המידע והפרסומים אינם אמורים להיות, ואינם מהווים, עצות פיננסיות, השקעות, מסחר או סוגים אחרים של עצות או המלצות שסופקו או מאושרים על ידי TradingView. קרא עוד בתנאים וההגבלות.