AlgoRyze Pro-Sol
AlgoRyze Pro-Sol
AlgoRyze Pro-Sol
// INDICATOR SETTINGS
show_weak = input.bool (false, 'Weak Buys/Sells (Swing Mode)',
group = 'Signals')
swing_length = 10 //input.int (10, 'Swing High/Low Length', group =
'Settings', minval = 1, maxval = 50)
//-----<WTO>-------------------------------------------------//
//Swing = input.bool(true, 'Show Algo Osc Signals', group='Oscillator
Divergence')
wto_channel = 10 //input.int(10, 'ARO Channel', minval=1, group='Oscillator
Divergence')
wto_len = 21 //input.int(21, 'ARO Length', minval=1, group='Oscillator
Divergence')
RightBars = 5 //input.int(5, 'Right Bars', minval=1, group='Oscillator
Divergence')
LeftBars = 5 //input.int(5, 'Left Bars', minval=1, group='Oscillator
Divergence')
show_reg_div = input.bool (true, "Regular ",
group='Divergences', inline="Divergence")
show_hid_lab = input.bool (false, "Hidden ",
group='Divergences', inline="Divergence")
//////////Colors
color ForrestGreen = color.new(#228B22,0)
color Lime = color.new(#00FF00,0)
color Red = color.new(#FF0000,0)
color Crimson = color.new(#DC143C,0)
AR_Down_Dark = color.new(#1da11f, 0)
AR_Down_Bright = color.new(#1ddd33, 0)
AR_Up_Dark = color.new(#8a00ff, 0)
AR_Up_Bright = color.new(#be80ff, 0)
AgloRyzeColor = color.new(#6FC4AF, 0)
color sw_color_up = Crimson
color sw_color_down = ForrestGreen
//END SETTINGS
//VARS/FUNCTIONS
var int Trend = 0
else if swing_type == -1
if array.get(array, 0) >= array.get(array, 1)
label_text := 'HL'
else
label_text := 'LL'
//label.new(bar_index - swing_length, array.get(array,0), text =
label_text, style=label.style_label_up, textcolor = swing_type_col, color =
color.new(swing_type_col, 100), size = size.small)
label.new(bar_index - swing_length, array.get(array,0), text = label_text,
style=label.style_label_up, textcolor = sw_color_down, color =
color.new(sw_color_down,100), size = size.normal)
for i = 0 to array.size(box_array) - 1
top = box.get_top(array.get(box_array, i))
bottom = box.get_bottom(array.get(box_array, i))
poi = (top + bottom) / 2
if box_type == 1
box_top := array.get(value_array, 0)
box_bottom := box_top - atr_buffer
poi := (box_top + box_bottom) / 2
else if box_type == -1
box_bottom := array.get(value_array, 0)
box_top := box_bottom + atr_buffer
poi := (box_top + box_bottom) / 2
if zone_type == 1
for i = 0 to array.size(box_array) - 1
level_to_break = box.get_top(array.get(box_array,i))
// if ta.crossover(close, level_to_break)
if close >= level_to_break
if show_broken
copied_box = box.copy(array.get(box_array,i))
f_array_add_pop(bos_array, copied_box)
mid = (box.get_top(array.get(box_array,i)) +
box.get_bottom(array.get(box_array,i))) / 2
box.set_top(array.get(bos_array,0), mid)
box.set_bottom(array.get(bos_array,0), mid)
box.set_extend( array.get(bos_array,0), extend.none)
box.set_right( array.get(bos_array,0), bar_index)
box.set_border_color(array.get(bos_array,0), bos_color_top)
box.set_bgcolor(array.get(bos_array,0), bos_color_top)
box.set_border_style(array.get(bos_array,0), line.style_dotted)
// box.set_text( array.get(bos_array,0), 'BOS' )
box.set_text_color( array.get(bos_array,0), bos_label_col)
box.set_text_size( array.get(bos_array,0), size.small)
box.set_text_halign( array.get(bos_array,0), text.align_right)
box.set_text_valign( array.get(bos_array,0), text.align_center)
box.delete(array.get(box_array, i))
line.delete(array.get(line_array, i))
if zone_type == -1
for i = 0 to array.size(box_array) - 1
level_to_break = box.get_bottom(array.get(box_array,i))
// if ta.crossunder(close, level_to_break)
if close <= level_to_break
if show_broken
copied_box = box.copy(array.get(box_array,i))
f_array_add_pop(bos_array, copied_box)
mid = (box.get_top(array.get(box_array,i)) +
box.get_bottom(array.get(box_array,i))) / 2
box.set_top(array.get(bos_array,0), mid)
box.set_bottom(array.get(bos_array,0), mid)
box.set_extend( array.get(bos_array,0), extend.none)
box.set_right( array.get(bos_array,0), bar_index)
box.set_border_color(array.get(bos_array,0), bos_color_bot)
box.set_bgcolor(array.get(bos_array,0), bos_color_bot)
box.set_border_style(array.get(bos_array,0), line.style_dotted)
// box.set_text( array.get(bos_array,0), 'BOS' )
box.set_text_color( array.get(bos_array,0), bos_label_col)
box.set_text_size( array.get(bos_array,0), size.small)
box.set_text_halign( array.get(bos_array,0), text.align_right)
box.set_text_valign( array.get(bos_array,0), text.align_center)
box.delete(array.get(box_array, i))
line.delete(array.get(line_array, i))
for i = 0 to array.size(box_array) - 1
box.set_right(array.get(box_array, i), bar_index + 100)
//END FUNCTIONS
//CALCULATIONS
// CALCULATE ATR
atr = ta.atr(50)
if show_sd
f_supply_demand(swing_low_values, swing_low_bns, current_demand_box,
current_demand_poi, -1, atr)
if show_sd
f_sd_to_bos(current_supply_box, supply_bos, current_supply_poi, 1)
f_sd_to_bos(current_demand_box, demand_bos, current_demand_poi, -1)
f_Extend_Zone_endpoint(current_supply_box)
f_Extend_Zone_endpoint(current_demand_box)
//ZIG ZAG
h = ta.highest(high, swing_length * 2 + 1)
l = ta.lowest(low, swing_length * 2 + 1)
f_isMin(len) =>
l == low[len]
f_isMax(len) =>
h == high[len]
f_drawLine() =>
_li_color = show_zigzag ? zigzag_col : color.new(#ffffff,100)
line.new(timeHigh - swing_length, lastHigh, timeLow - swing_length, lastLow,
xloc.bar_index, color=_li_color, width=2)
if dirUp
if f_isMin(swing_length) and low[swing_length] < lastLow
lastLow := low[swing_length]
timeLow := bar_index
line.delete(li)
li := f_drawLine()
li
if not dirUp
if f_isMax(swing_length) and high[swing_length] > lastHigh
lastHigh := high[swing_length]
timeHigh := bar_index
line.delete(li)
li := f_drawLine()
li
if f_isMin(swing_length) and low[swing_length] < lastHigh
lastLow := low[swing_length]
timeLow := bar_index
dirUp := true
li := f_drawLine()
if f_isMax(swing_length) and high[swing_length] > lastLow
lastHigh := high[swing_length]
timeHigh := bar_index
dirUp := false
li := f_drawLine()
li
ma2_difference = ma1-ma2
ma2_diff_avg = ta.sma(ma2_difference, diff_len)
ma2_diff_stdev = ta.stdev(ma2_difference, diff_len)*mult
ma2_top_val = ma1 > ma2 ? ma2+ma2_diff_stdev : ma2
ma2_bot_val = ma1 > ma2 ? ma2 : ma2-ma2_diff_stdev
ma2_top_top_color = ma1_color_up
ma2_top_bottom_color = ma2_color_up
ma2_bottom_top_color = ma2_color_dn
ma2_bottom_bottom_color = ma1_color_dn
bullish_bearish = ma1 > ma2 ? 1 : -1
change = ma1 > ma1[1] ? 1 : ma1 < ma1[1] ? -1 : 0
chart_color = color.from_gradient(ma1, ma2_bot_val, ma2_top_val, bottom_color =
bullish_bearish == 1 ? ma2_top_bottom_color : ma2_bottom_bottom_color,
top_color=bullish_bearish == 1 ? ma2_top_top_color : ma2_bottom_top_color)
//WTO stuff
wtSource =hlc3
wt(ap,n1,n2) =>
esa = ta.ema(ap, n1)
d = ta.ema(math.abs(ap - esa), n1)
ci = (ap - esa) / (0.015 * d)
tci = ta.ema(ci, n2)
wt1 = tci
wt2 = ta.sma(wt1,4)
//scale to 0-100
wt3 = math.avg(wt2,wt1)
[wt1,wt2, wt3]
[wt1,wt2, wt3] = wt(wtSource,wto_channel,wto_len)
//Signals
Trend := ma1 > ma2 ? 1 : ma1 < ma2 ? -1 : Trend
// '♦'
// '△' '▽'
//alerts
// alertcondition(Swing_BUY, title='Swing Buy', message='Swing Buy')
// alertcondition(Swing_SELL, title='Swing Sell', message='Swing Sell')
// alertcondition(Swing_BUY_W, title='Weak Swing Buy', message='Weak Swing Buy')
// alertcondition(Swing_SELL_W,title='Weak Swing Sell',message='Weak Swing Sell')
//Alerts
alertSwings = input.bool (true, 'Swing Buy/Sell',
group='Alerts')
alertWeaK = input.bool (false, 'Weak Swing Buy/Sell',
group='Alerts')
alertScalps = input.bool (false, 'Scalp Buy/Sell',
group='Alerts')
type bar
float difference
color color_gradient
int direction
int change
bar_1m = bar.new()
bar_3m = bar.new()
bar_5m = bar.new()
bar_15m = bar.new()
bar_30m = bar.new()
bar_60m = bar.new()
bar_120m = bar.new()
bar_240m = bar.new()
bar_360m = bar.new()
bar_720m = bar.new()
bar_1440m = bar.new()
bar_1m_lower_string = (timeframe.isminutes and timeframe.multiplier > 1) or
timeframe.isdaily ? "1" : na
[diff_1m_array, color_1m_array, bb_1m_array, change_1m_array] =
request.security_lower_tf(syminfo.tickerid, bar_1m_lower_string,
Moving_Average_Distance(ma1, ma2, diff_len, mult, ma1_color_up, ma1_color_dn,
ma2_color_up, ma2_color_dn))
bar_1m_higher_string = timeframe.isminutes and timeframe.multiplier <= 1 or
timeframe.isseconds ? "1" : na
[diff_1m_value, color_1m_value, bb_1m_value, change_1m_value] =
request.security(syminfo.tickerid, bar_1m_higher_string,
Moving_Average_Distance(ma1, ma2, diff_len, mult, ma1_color_up, ma1_color_dn,
ma2_color_up, ma2_color_dn))
if barstate.islast
if timeframe.isminutes or timeframe.isdaily
if (timeframe.multiplier > 1 or timeframe.isdaily) and
array.size(diff_1m_array) > 0
bar_1m := bar.new(array.last(diff_1m_array),
array.last(color_1m_array), array.last(bb_1m_array), array.last(change_1m_array))
if (timeframe.multiplier > 3 or timeframe.isdaily) and
array.size(diff_3m_array) > 0
bar_3m := bar.new(array.last(diff_3m_array),
array.last(color_3m_array), array.last(bb_3m_array), array.last(change_3m_array))
if (timeframe.multiplier > 5 or timeframe.isdaily) and
array.size(diff_5m_array) > 0
bar_5m := bar.new(array.last(diff_5m_array),
array.last(color_5m_array), array.last(bb_5m_array), array.last(change_5m_array))
if (timeframe.multiplier > 15 or timeframe.isdaily) and
array.size(diff_15m_array) > 0
bar_15m := bar.new(array.last(diff_15m_array),
array.last(color_15m_array), array.last(bb_15m_array),
array.last(change_15m_array))
if (timeframe.multiplier > 30 or timeframe.isdaily) and
array.size(diff_30m_array) > 0
bar_30m := bar.new(array.last(diff_30m_array),
array.last(color_30m_array), array.last(bb_30m_array),
array.last(change_30m_array))
if (timeframe.multiplier > 60 or timeframe.isdaily) and
array.size(diff_60m_array) > 0
bar_60m := bar.new(array.last(diff_60m_array),
array.last(color_60m_array), array.last(bb_60m_array),
array.last(change_60m_array))
if (timeframe.multiplier > 120 or timeframe.isdaily) and
array.size(diff_120m_array) > 0
bar_120m := bar.new(array.last(diff_120m_array),
array.last(color_120m_array), array.last(bb_120m_array),
array.last(change_120m_array))
if (timeframe.multiplier > 240 or timeframe.isdaily) and
array.size(diff_240m_array) > 0
bar_240m := bar.new(array.last(diff_240m_array),
array.last(color_240m_array), array.last(bb_240m_array),
array.last(change_240m_array))
if (timeframe.multiplier > 360 or timeframe.isdaily) and
array.size(diff_360m_array) > 0
bar_360m := bar.new(array.last(diff_360m_array),
array.last(color_360m_array), array.last(bb_360m_array),
array.last(change_360m_array))
if (timeframe.multiplier > 720 or timeframe.isdaily) and
array.size(diff_720m_array) > 0
bar_720m := bar.new(array.last(diff_720m_array),
array.last(color_720m_array), array.last(bb_720m_array),
array.last(change_720m_array))
if (timeframe.multiplier > 1440 or timeframe.isdaily) and
array.size(diff_1440m_array) > 0
bar_1440m := bar.new(array.last(diff_1440m_array),
array.last(color_1440m_array), array.last(bb_1440m_array),
array.last(change_1440m_array))
build_text_color(_bb_value)=>
color text_color = _bb_value > 0 ? color.lime : _bb_value < 0 ? color.red :
color.yellow
text_color
build_dot_color(_change_value, _bb_value)=>
dot_color = color.new(color.aqua, 0)
if _bb_value > 0
if _change_value > 0
dot_color := color.new(color.green, 0)
if _change_value < 0
dot_color := color.new(color.green, 75)
if _change_value == 0
dot_color:= color.new(color.yellow, 50)
if _bb_value < 0
if _change_value > 0
dot_color := color.new(color.red, 75)
if _change_value < 0
dot_color := color.new(color.red, 0)
if _change_value == 0
dot_color:= color.new(color.yellow, 50)
dot_color
//Table Header
//col row
table.cell(Dashboard_table, 0, 0, text="📈 Trend Table",
text_halign=text.align_center, text_color=AgloRyzeColor)
table.cell(Dashboard_table, 1, 0, text=na, text_halign=text.align_center,
text_color=color.white)
//Merge header to center title
table.merge_cells(Dashboard_table, 0, 0, 1, 0)
//Table Data
var ph_time = 0
var pl_time = 0
///////////////////Signals
// Pivots
PH = ta.pivothigh(wt3, LeftBars, RightBars)
PL = ta.pivotlow(wt3, LeftBars, RightBars)
PH_fn = fixnan(PH)
PL_fn = fixnan(PL)
bear_color = ma1_color_dn
bull_color = ma1_color_up
regular_style = line.style_solid
hidden_style = line.style_dotted
// var divergence_lines = array.new_line(250)
var divergence_labels = array.new_label(100)
//---------------------------------------------------------------------------------
-------------------------------------------------}
//супер тренд + свечи
//---------------------------------------------------------------------------------
------------------------------------{
// ** ---> Inputs ------------- {
var bool positive = false
var bool negative = false
string RSI_group = "RMI Settings"
string mom_group = "Range Vales"
string visual = "Visuals"
int Length = input(14,"RMI Length ",inline = "RMI",group =
RSI_group)
int pmom = input(66," Positive above",inline =
"rsi1",group =RSI_group )
int nmom = input(30,"Negative below",inline =
"rsi1",group =RSI_group )
bool filleshow = input(false,"Show Range MA ",inline =
"002",group =visual )
color bull = input(#00bcd4,"",inline = "002",group =visual
)
color bear = input(#ff5252,"",inline = "002",group =visual
)
float BarRange = high - low
//------------------- }
if p_mom
positive:= true
negative:= false
if n_mom
positive:= false
negative:= true
//
method _Band(int len)=>
math.min (ta.atr (len) * 0.3, close * (0.3/100)) [20] /2 * 8
Band = _Band(30)
type pivot
string pivType
int x1
float y1
int x2
float y2
// arrays
var line[] dtlArray = array.new_line()
var line[] utlArray = array.new_line()
//functions
createLine(ptype, x1, y1, x2, y2)=>
piv = pivot.new(ptype, x1, y1, x2, y2)
trendline = line.new(x1, y1, x2, y2, extend = extendLine ? extend.right :
extend.none, color = ptype == 'ph' ? dtlColor : utlColor, width = 2)
if ptype == 'ph'
dtlArray.unshift(trendline)
else if ptype == 'pl'
utlArray.unshift(trendline)
piv
getSlope(line)=>
slopePh = (line.get_y2(line) - line.get_y1(line))/(line.get_x2(line) -
line.get_x1(line))
extendedPh = line.get_y2(line) - slopePh * (line.get_x2(line) - bar_index)
extendedPh
getSlopeLog(line)=>
slopePh = (math.log(line.get_y2(line)) -
math.log(line.get_y1(line)))/(line.get_x2(line) -line.get_x1(line))
extendedPh = math.exp(math.log(line.get_y2(line)) - slopePh *
(line.get_x2(line) - bar_index))
extendedPh
// variables
ph = ta.pivothigh(high, pivLen, pivLen)
pl = ta.pivotlow(low, pivLen, pivLen)
var int utlX1 = na, var float utlY1 = na
var int utlX2 = na, var float utlY2 = na
var int dtlX2 = na, var float dtlY2 = na
var int dtlX1 = na, var float dtlY1 = na
if pl
utlX1 := utlX2, utlY1 := utlY2
utlX2 := bar_index[pivLen], utlY2 := low[pivLen]
if utlY1 < utlY2
createLine('pl', utlX1, utlY1, utlX2, utlY2)
if ph
dtlX1 := dtlX2, dtlY1 := dtlY2
dtlX2 := bar_index[pivLen], dtlY2 := high[pivLen]
if dtlY1 > dtlY2
createLine('ph', dtlX1, dtlY1, dtlX2, dtlY2)
for l in utlArray
src = crossSrc == 'Close' ? close : low
first = l == utlArray.get(0)
extended = not isLog ? getSlope(l) : getSlopeLog(l)
l.set_xy2(bar_index, extended)
if l.get_x2() - l.get_x1() > maxLineLen
l.delete()
if src > line.get_price(l, bar_index) and not first and onlyLast
l.delete()
var line [] tempUtl = array.new_line(maxLines/2)
var label [] tempUL = array.new_label(maxLines/2)
if src < line.get_price(l, bar_index)
newLine = line.new(line.get_x1(l), line.get_y1(l), line.get_x2(l),
line.get_y2(l), color = pastColor, style = line.style_dashed, width = 1)
crossLabel = showCross ? label.new(bar_index, low, ' ', yloc =
yloc.belowbar, color = crossDown, style = label.style_xcross, size = size.tiny) :
na
alert(str.tostring(syminfo.ticker) + ' crossing below trendline',
alert.freq_once_per_bar)
line.delete(l)
tempUtl.unshift(newLine)
tempUL.unshift(crossLabel)
if tempUtl.size() > (maxLines/2)
line.delete(tempUtl.pop())
label.delete(tempUL.pop())
for l in dtlArray
first = l == dtlArray.get(0)
src = crossSrc == 'Close' ? close : high
extended = not isLog ? getSlope(l) : getSlopeLog(l)
l.set_xy2(bar_index, extended)
if l.get_x2() - l.get_x1() > maxLineLen
l.delete()
if src < line.get_price(l, bar_index) and not first and onlyLast
l.delete()
var line [] tempDtl = array.new_line(maxLines/2)
var label [] tempDL = array.new_label(maxLines/2)
if src > line.get_price(l, bar_index)
newLine = line.new(line.get_x1(l), line.get_y1(l), line.get_x2(l),
line.get_y2(l), color = pastColor, style = line.style_dashed, width = 1)
crossLabel = showCross ? label.new(bar_index, high, '', yloc =
yloc.abovebar, style = label.style_xcross, color = crossUp, size = size.tiny) : na
alert(str.tostring(syminfo.ticker) + ' crossing above trendline',
alert.freq_once_per_bar)
line.delete(l)
tempDtl.unshift(newLine)
tempDL.unshift(crossLabel)
if tempDtl.size() > (maxLines/2)
line.delete(tempDtl.pop())
label.delete(tempDL.pop())
//----------------}
//fib
//-----------------------------------------{
// Fibonacci Levels
fib_0 = input.float(0.382, "Fib Level 0")
fib_1 = input.float(0.618, "Fib Level 1")
// RSI
rsi_length = input(14, "RSI Length")
rsi_overbought = input(70, "RSI Overbought Level")
rsi_oversold = input(30, "RSI Oversold Level")
//-----------------------------------------}