Professional Documents
Culture Documents
//@version=5
indicator("Dynamic Regression-EMA-PD level-Alpha trend", overlay=true,
max_lines_count=500, max_boxes_count=500)
var start_index = 1
lengthInput = bar_index - start_index + 1
[s, a, i] = calcSlope(close, lengthInput)
startPrice = i + s * (lengthInput - 1)
endPrice = i
//Multiple EMA
//indicator("Multiple EMA", overlay = true)
/// PLOT
//plot(close)
// This source code is subject to the terms of the Mozilla Public License 2.0 at
https://mozilla.org/MPL/2.0/
//@version=5
//indicator("Litt Institutional Levels", overlay = true)
timeChange(period) =>
ta.change(time(period))
is_new_period = timeChange(time_period)
var first_bar_in_period = 0
first_bar_in_period := is_new_period ? time : first_bar_in_period[1]
if daily_levels
institution_function("D",daily_line_color, daily_text_color, "Y")
if weekly_levels
institution_function("W",weekly_line_color, weekly_text_color, "LW")
if monthly_levels
institution_function("M",monthly_line_color, monthly_text_color, "LM")
if qtr_levels
institution_function("3M",qtr_line_color, qtr_text_color, "LQ")
if yearly_levels
institution_function("12M",yearly_line_color, yearly_text_color, "LY")
//TABLE
show_dashboard = input.bool(title='Color Legend', defval=true, inline='1',
group='Dashboard Settings')
LabelSize = input.string(defval='Medium', options=['Small', 'Medium', 'Large'],
title='Dashboard Size', inline='2', group='Dashboard Settings')
label_size = LabelSize == 'Small' ? size.small : LabelSize == 'Medium' ?
size.normal : LabelSize == 'Large' ? size.large : size.small
positioning = position.top_right
var table t = table.new(positioning, 5, 1,frame_color=color.new(#000000, 100),
frame_width=0, border_color=color.new(#000000,100), border_width=0)
if barstate.islast and show_dashboard
//Column 1
table.cell(t, 0, 0, text='D', width=0, bgcolor=daily_line_color,
text_color=color.white, text_size=label_size, text_halign=text.align_center)
table.cell(t, 1, 0, text='W', width=0, bgcolor=weekly_line_color,
text_color=color.white, text_size=label_size, text_halign=text.align_center)
table.cell(t, 2, 0, text='M', width=0, bgcolor=monthly_line_color,
text_color=color.white, text_size=label_size, text_halign=text.align_center)
table.cell(t, 3, 0, text='Q', width=0, bgcolor=qtr_line_color,
text_color=color.white, text_size=label_size, text_halign=text.align_center)
table.cell(t, 4, 0, text='Y', width=0, bgcolor=yearly_line_color,
text_color=color.white, text_size=label_size, text_halign=text.align_center)
// This source code is subject to the terms of the Mozilla Public License 2.0 at
https://mozilla.org/MPL/2.0/
// author © KivancOzbilgic
// developer © KivancOzbilgic
//@version=5
//indicator('AlphaTrend', shorttitle='AT', overlay=true, format=format.price,
precision=2, timeframe='')
coeff = input.float(1, 'Multiplier', step=0.1)
AP = input(14, 'Common Period')
ATR = ta.sma(ta.tr, AP)
src = input(close)
showsignalsk = input(title='Show Signals?', defval=true)
novolumedata = input(title='Change calculation (no volume data)?', defval=false)
upT = low - ATR * coeff
downT = high + ATR * coeff
AlphaTrend = 0.0
AlphaTrend := (novolumedata ? ta.rsi(src, AP) >= 50 : ta.mfi(hlc3, AP) >= 50) ? upT
< nz(AlphaTrend[1]) ? nz(AlphaTrend[1]) : upT : downT > nz(AlphaTrend[1]) ?
nz(AlphaTrend[1]) : downT
K1 = ta.barssince(buySignalk)
K2 = ta.barssince(sellSignalk)
O1 = ta.barssince(buySignalk[1])
O2 = ta.barssince(sellSignalk[1])