OPEN-SOURCE SCRIPT
ERL & IRL (Swing Levels) Sunnat

//version=5
indicator("ERL & IRL (Swing Levels)", overlay=true)
// Inputs
left_bars = input.int(5, "Left bars (swing strength)", minval=1)
right_bars = input.int(5, "Right bars (swing strength)", minval=1)
line_len = input.int(10, "Line length (bars)", minval=1) // short line
// Detect swing high (ERL) and swing low (IRL)
swingHigh = ta.pivothigh(high, left_bars, right_bars)
swingLow = ta.pivotlow(low, left_bars, right_bars)
// Draw ERL when swing high is found
if not na(swingHigh)
line.new(bar_index - right_bars, swingHigh,
bar_index - right_bars + line_len, swingHigh,
xloc=xloc.bar_index, extend=extend.none,
color=color.aqua, width=2)
label.new(bar_index - right_bars + line_len, swingHigh, "ERL",
xloc=xloc.bar_index, yloc=yloc.price,
color=color.new(color.aqua, 0), textcolor=color.black)
// Draw IRL when swing low is found
if not na(swingLow)
line.new(bar_index - right_bars, swingLow,
bar_index - right_bars + line_len, swingLow,
xloc=xloc.bar_index, extend=extend.none,
color=color.orange, width=2)
label.new(bar_index - right_bars + line_len, swingLow, "IRL",
xloc=xloc.bar_index, yloc=yloc.price,
color=color.new(color.orange, 0), textcolor=color.black)
indicator("ERL & IRL (Swing Levels)", overlay=true)
// Inputs
left_bars = input.int(5, "Left bars (swing strength)", minval=1)
right_bars = input.int(5, "Right bars (swing strength)", minval=1)
line_len = input.int(10, "Line length (bars)", minval=1) // short line
// Detect swing high (ERL) and swing low (IRL)
swingHigh = ta.pivothigh(high, left_bars, right_bars)
swingLow = ta.pivotlow(low, left_bars, right_bars)
// Draw ERL when swing high is found
if not na(swingHigh)
line.new(bar_index - right_bars, swingHigh,
bar_index - right_bars + line_len, swingHigh,
xloc=xloc.bar_index, extend=extend.none,
color=color.aqua, width=2)
label.new(bar_index - right_bars + line_len, swingHigh, "ERL",
xloc=xloc.bar_index, yloc=yloc.price,
color=color.new(color.aqua, 0), textcolor=color.black)
// Draw IRL when swing low is found
if not na(swingLow)
line.new(bar_index - right_bars, swingLow,
bar_index - right_bars + line_len, swingLow,
xloc=xloc.bar_index, extend=extend.none,
color=color.orange, width=2)
label.new(bar_index - right_bars + line_len, swingLow, "IRL",
xloc=xloc.bar_index, yloc=yloc.price,
color=color.new(color.orange, 0), textcolor=color.black)
סקריפט קוד פתוח
ברוח TradingView אמיתית, היוצר של הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יכולים לבדוק ולאמת את הפונקציונליות שלו. כל הכבוד למחבר! למרות שאתה יכול להשתמש בו בחינם, זכור שפרסום מחדש של הקוד כפוף לכללי הבית שלנו.
כתב ויתור
המידע והפרסומים אינם אמורים להיות, ואינם מהווים, עצות פיננסיות, השקעות, מסחר או סוגים אחרים של עצות או המלצות שסופקו או מאושרים על ידי TradingView. קרא עוד בתנאים וההגבלות.
סקריפט קוד פתוח
ברוח TradingView אמיתית, היוצר של הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יכולים לבדוק ולאמת את הפונקציונליות שלו. כל הכבוד למחבר! למרות שאתה יכול להשתמש בו בחינם, זכור שפרסום מחדש של הקוד כפוף לכללי הבית שלנו.
כתב ויתור
המידע והפרסומים אינם אמורים להיות, ואינם מהווים, עצות פיננסיות, השקעות, מסחר או סוגים אחרים של עצות או המלצות שסופקו או מאושרים על ידי TradingView. קרא עוד בתנאים וההגבלות.