//version=5 indicator("Equal High/Low with Connected Lines", overlay=true)
// Set tolerance for price fluctuation tolerance = input.float(0.5, title="Tolerance", tooltip="Allowed difference for equal highs/lows")
// Set a threshold for significant candles (total candle range) min_candle_range = input.float(10, title="Minimum Candle Range", tooltip="Minimum range of candle high to low")
// Calculate candle range (difference between high and low) candle_range = high - low
// Check for equal highs and lows with a tolerance and filter for larger candles equal_high = math.abs(high - high[1]) <= tolerance and candle_range >= min_candle_range equal_low = math.abs(low - low[1]) <= tolerance and candle_range >= min_candle_range
// Declare variables to store the last equal high/low points and their bar indices var float last_high = na var int last_high_index = na var float last_low = na var int last_low_index = na
// Declare lines for connecting equal highs and lows var line high_line = na var line low_line = na
// If an equal high is found, connect it with the last equal high if (equal_high) if (not na(last_high) and not na(last_high_index)) line.new(x1=last_high_index, y1=last_high, x2=bar_index, y2=high, color=color.green, width=2, style=line.style_solid) // Connect the points last_high := high // Update the last high last_high_index := bar_index // Update the bar index of the last high
// If an equal low is found, connect it with the last equal low if (equal_low) if (not na(last_low) and not na(last_low_index)) line.new(x1=last_low_index, y1=last_low, x2=bar_index, y2=low, color=color.red, width=2, style=line.style_solid) // Connect the points last_low := low // Update the last low last_low_index := bar_index // Update the bar index of the last low
// Optional: Highlight the background when significant equal highs or lows occur bgcolor(equal_high ? color.new(color.green, 80) : na) bgcolor(equal_low ? color.new(color.red, 80) : na)
הערות שחרור
//version=5 indicator("Equal High/Low with Two-Candle Connection", overlay=true)
// Set tolerance for price fluctuation tolerance = input.float(0.5, title="Tolerance", tooltip="Allowed difference for equal highs/lows")
// Set a threshold for significant candles (total candle range) min_candle_range = input.float(10, title="Minimum Candle Range", tooltip="Minimum range of candle high to low")
// Calculate candle range (difference between high and low) candle_range = high - low
// Check for equal highs and lows with a tolerance and filter for larger candles equal_high = math.abs(high - high[1]) <= tolerance and candle_range >= min_candle_range equal_low = math.abs(low - low[1]) <= tolerance and candle_range >= min_candle_range
// Declare variables to store the last equal high/low points and their bar indices var float last_high = na var int last_high_index = na var float last_low = na var int last_low_index = na
// Declare lines for connecting equal highs and lows var line high_line = na var line low_line = na
// If an equal high is found, connect it with the previous candle's high if it also had an equal high if (equal_high and equal_high[1]) line.new(x1=bar_index[1], y1=high[1], x2=bar_index, y2=high, color=color.green, width=2, style=line.style_solid)
// If an equal low is found, connect it with the previous candle's low if it also had an equal low if (equal_low and equal_low[1]) line.new(x1=bar_index[1], y1=low[1], x2=bar_index, y2=low, color=color.red, width=2, style=line.style_solid)
// Optional: Highlight the background when significant equal highs or lows occur bgcolor(equal_high ? color.new(color.green, 80) : na) bgcolor(equal_low ? color.new(color.red, 80) : na)
ברוח TradingView אמיתית, מחבר הסקריפט הזה פרסם אותו בקוד פתוח, כך שסוחרים יוכלו להבין ולאמת אותו. כל הכבוד למחבר! אתה יכול להשתמש בו בחינם, אבל השימוש החוזר בקוד זה בפרסום כפוף לכללי הבית. אתה יכול להכניס אותו למועדפים כדי להשתמש בו בגרף.
רוצה להשתמש בסקריפ זה בגרף?
כתב ויתור
המידע והפרסומים אינם אמורים להיות, ואינם מהווים, עצות פיננסיות, השקעות, מסחר או סוגים אחרים של עצות או המלצות שסופקו או מאושרים על ידי TradingView. קרא עוד בתנאים וההגבלות.