CBK 3
CBK 3
CBK 3
0 at
https://mozilla.org/MPL/2.0/
// © Edwardyps
//@version=5
EMA10 = input(10)
SMA1 = input(10)
SMA2 = input(200)
ema = ta.ema(close, EMA10)
sma1 = ta.sma(close, SMA1)
sma2 = ta.sma(close, SMA2)
MA1_3m = input.bool(false, title='👉 Display 1m-3m MA', group='⚡ MOVING AVG ⚡ ')
MA5m = input.bool(false, title='👉 Display 5m MA', group='⚡ MOVING AVG ⚡ ')
MA15m = input.bool(false, title='👉 Display 15m MA', group='⚡ MOVING AVG ⚡ ')
MA30m = input.bool(false, title='👉 Display 30m MA', group='⚡ MOVING AVG ⚡ ')
MA1h = input.bool(false, title='👉 Display 60m MA', group='⚡ MOVING AVG ⚡ ')
MA1d = input.bool(false, title='👉 Display 1 Day MA', group='⚡ MOVING AVG ⚡ ')
MA1w = input.bool(false, title='👉 Display 1 Week MA', group='⚡ MOVING AVG ⚡ ')
MA1m = input.bool(false, title='👉 Display 1 Month MA', group='⚡ MOVING AVG ⚡ ')
//gghhgghhgghg
length = input.int(14)
k = input.float(1.,'Slope',minval=0,step=.1)
method = input.string('Atr','Slope Calculation Method',
options=['Atr','Stdev','Linreg'])
show = input(true,'Show Only Confirmed Breakouts')
//----
upper = 0.,lower = 0.
slope_ph = 0.,slope_pl = 0.
src = close
n = bar_index
//----
ph = ta.pivothigh(length,length)
pl = ta.pivotlow(length,length)
slope = switch method
'Atr' => ta.atr(length)/length*k
'Stdev' => ta.stdev(src,length)/length*k
'Linreg' => math.abs(ta.sma(src*bar_index,length)-
ta.sma(src,length)*ta.sma(bar_index,length))/ta.variance(n,length)/2*k
if ph[1]
line.delete(up_l[1])
label.delete(recent_up_break[1])
up_l := line.new(n-length-1,ph[1],n-length,upper,color=#26a69a,
extend=extend.right,style=line.style_dashed)
if pl[1]
line.delete(dn_l[1])
label.delete(recent_dn_break[1])
dn_l := line.new(n-length-1,pl[1],n-length,lower,color=#ef5350,
extend=extend.right,style=line.style_dashed)
if ta.crossover(src,upper-slope_ph*length)
label.delete(recent_up_break[1])
recent_up_break := label.new(n,low,''دخول,color=#26a69a,
textcolor=color.white,style=label.style_label_up,size=size.small)
if ta.crossunder(src,lower+slope_pl*length)
label.delete(recent_dn_break[1])
recent_dn_break := label.new(n,high,''خروج,color=#ef5350,
textcolor=color.white,style=label.style_label_down,size=size.small)
//----
plot(upper,'Upper',color = ph ? na : #26a69a,offset=-length)
plot(lower,'Lower',color = pl ? na : #ef5350,offset=-length)
alertcondition(ta.crossover(src,upper-slope_ph*length),'Upper Breakout','Price
broke upper trendline')
alertcondition(ta.crossunder(src,lower+slope_pl*length),'Lower Breakout','Price
broke lower trendline')
////////////////
//PIVOT HIGH/LOW
left_bars = input.int(title = "Left Bars", defval = 25, group = "Pivot Settings",
tooltip = "Amount of consecutive closing prices to the left of the point that must
be above/below the point for a valid zone | DOES NOT AFFECT DELAY OF ZONE")
right_bars = input.int(title = "Right Bars", defval = 25, group = "Pivot Settings",
tooltip = "Amount of consecutive closing prices to the right of the point that must
be above/below the point for a valid zone | THE AMOUNT OF BARS IT TAKES FOR THE
ZONE TO APPEAR OFF OF THE POINT IS DEPENDENT ON THIS SETTING. (i.e. if the right
bars is set to 5, it will take 5 candles into the future before it will print in
real-time)")
//CUSTOM SOURCES/CONDITIONS
use_custom_source1 = input.bool(title = "Enable Custom Source #1", defval = true,
group = "Custom Indicator Filter", tooltip = "Check the box to enable this filter.
If the box is unchecked, the filter will not apply and the indicator will calculate
based only on the pivot points")
custom_source1 = input.source(title = "Custom Indicator Source #1", defval = ohlc4,
group = "Custom Indicator Filter", tooltip = "You can select one of these built-in
sources, or you can put any 1 indicator of your choice onto the chart alongside
this indicator and will have the ability to select one of the external indicators
values/outputs as the source, therefore allowing you to create your own custom
filter")
binary_long1 = input.string(title = "Value Must Be (Above/Below/Equal) For
Support", defval = "Above", options = ["Above", "Below", "Equal"], group = "Custom
Indicator Filter", tooltip = "Choose if the Custom Indicator Value above must be
above, below, or equal to the required value below for a 'Support Zone'")
required_long1 = input.float(title = "Value Requirement For Support", defval = 100,
group = "Custom Indicator Filter", tooltip = "This is the value that the Custom
Source above must be above or below for a zone to be valid for the creation of a
'Support Zone'")
use_close_for_required_long = input.bool(title = "Use Closing Price For Requirement
For Support", defval = false, group = "Custom Indicator Filter", tooltip = "This
will override the 'Value Requirement For Support' input in the above setting,
allowing you to use indicators like 'Moving Average' for example. You can attach
the 'Moving Average' indicator onto the indicator rather than something like an rsi
and make a filter that requires the closing price to be above/below the 'Moving
Average' for the zone")
binary_short1 = input.string(title = "Value Must Be (Above/Below/Equal) For
Resistance", defval = "Below", options = ["Above", "Below", "Equal"], group =
"Custom Indicator Filter", tooltip = "Choose if the Custom Indicator Value above
must be above, below, or equal to the required value below for a 'Resistance
Zone'")
required_short1 = input.float(title = "Value Requirement For Resistance", defval =
100, group = "Custom Indicator Filter", tooltip = "This is the value that the
Custom Source above must be above or below for a zone to be valid for the creation
of a 'Resistance Zone'")
use_close_for_required_short = input.bool(title = "Use Closing Price For
Requirement For Resistance", defval = false, group = "Custom Indicator Filter",
tooltip = "This will override the 'Value Requirement For Resistance' input in the
above setting, allowing you to use indicators like 'Moving Average' for example.
You can attach the 'Moving Average' indicator onto the indicator rather than
something like an rsi and make a filter that requires the closing price to be
above/below the 'Moving Average' for the zone")
//MAIN-OP
support_top_value = close[right_bars] < open[right_bars] ? close[right_bars] :
open[right_bars]
resistance_bot_value = close[right_bars] > open[right_bars] ? close[right_bars] :
open[right_bars]
if new_support
support_top_line := line.new(x1 = bar_index[right_bars], y1 =
support_top_value, x2 = bar_index, y2 = support_top_value, xloc = xloc.bar_index,
color = support_line_color, extend = extend.none, style = line.style_solid, width =
2)
support_bot_line := line.new(x1 = bar_index[right_bars], y1 = low[right_bars],
x2 = bar_index, y2 = low[right_bars], xloc = xloc.bar_index, color =
support_line_color, extend = extend.none, style = line.style_solid, width = 2)
if new_resistance
resistance_top_line := line.new(x1 = bar_index[right_bars], y1 =
resistance_bot_value, x2 = bar_index, y2 = resistance_bot_value, xloc =
xloc.bar_index, color = resistance_line_color, extend = extend.none, style =
line.style_solid, width = 2)
resistance_bot_line := line.new(x1 = bar_index[right_bars], y1 =
high[right_bars], x2 = bar_index, y2 = high[right_bars], xloc = xloc.bar_index,
color = resistance_line_color, extend = extend.none, style = line.style_solid,
width = 2)
if barstate.isconfirmed
line.set_x2(support_top_line, bar_index)
line.set_x2(support_bot_line, bar_index)
line.set_x2(resistance_top_line, bar_index)
line.set_x2(resistance_bot_line, bar_index)
if change_colors_based_on_price
linefill.set_color(support_line_fill, support_linefill_color)
linefill.set_color(support_line_fill, resistance_linefill_color)
linefill.set_color(resistance_line_fill, support_linefill_color)
linefill.set_color(resistance_line_fill, resistance_linefill_color)
//ALERT CONDITIONS
new_support_created = new_support
new_resistance_created = new_resistance
support_top_line_value = line.get_y1(support_top_line)
support_bot_line_value = line.get_y1(support_bot_line)
resistance_top_line_value = line.get_y1(resistance_top_line)
resistance_bot_line_value = line.get_y1(resistance_bot_line)
///////////////////////////////////