NYSA TREND
NYSA TREND
NYSA TREND
//////////////////PARABOLIC
///////////////////
////////////
ma3_len = input(8, "Length", group='EMA')
src3 = input(close, "Source")
res3 = input.timeframe('1W', "Resolution", title="wma9Periyod")
htf_ma3 = ta.ema(src3, ma3_len)
out3 = request.security(syminfo.tickerid, res3, htf_ma3)
// plot(out1, color=color.rgb(21, 252, 4), linewidth=2, title='WMA-9HAFTALIK')
//////////////////////////////////////////
//////////////HAFTALIK
// Calculate MACD on the weekly timeframe
[macdLine, signalLine, _] = request.security(syminfo.tickerid, "1W", ta.macd(close,
12, 26, 9))
//////////////RSI
////////////////
// Calculate RSI on the weekly timeframe
rsiValue = request.security(syminfo.tickerid, "1W", ta.rsi(close, 14))
///////////////EKLEME
// Check for RSI being above its 14-period SMA and crossing above 50 on the weekly
timeframe
rsiAboveSMA = rsiValue > rsiSMA
rsiAbove50 = ta.crossover(rsiValue, 50)
// Plot "R" label when RSI is above its SMA and crosses above 50
plotshape(rsiAboveSMA and rsiAbove50, color=color.new(#4400ff, 0),
style=shape.labelup, title="RSI-HAF", textcolor=color.new(color.white, 0), text="R-
H", location=location.belowbar)
////////////////////AYLIK
//////////////RSI
////////////////
// Calculate RSI on the AYLIK timeframe
rsiValue1 = request.security(syminfo.tickerid, "1M", ta.rsi(close, 14))
///////////////EKLEME
// Check for RSI being above its 14-period SMA and crossing above 50 on the weekly
timeframe
rsiAboveSMA1 = rsiValue1 > rsiSMA1
rsiAbove501 = ta.crossover(rsiValue1, 50)
// Plot "R" label when RSI is above its SMA and crosses above 50
plotshape(rsiAboveSMA1 and rsiAbove501, color=color.new(#4400ff, 0),
style=shape.labelup, title="RSI-AYLIK", textcolor=color.new(color.white, 0),
transp=0, text="R-A", location=location.belowbar)
///////////////////////////////TREND KANALI
source_high = high
source_low = low
atan2(y, x) =>
var float angle = 0.0
if x > 0
angle := math.atan(y / x)
else
if x < 0 and y >= 0
angle := math.atan(y / x) + math.pi
else
if x < 0 and y < 0
angle := math.atan(y / x) - math.pi
else
if x == 0 and y > 0
angle := math.pi / 2
else
if x == 0 and y < 0
angle := -math.pi / 2
angle
min_max_volume(src) =>
out = (src - ta.lowest(src, 100))/(ta.highest(src, 100) - ta.lowest(src, 100))
* 100
math.max(math.min(100, out), 0)
volume_normalized()=>
min_max_volume(ta.wma(volume, 21))
simple_moving_average(source)=>
var float sum = na
var int count = na
count := nz(count[1]) + 1
sum := nz(sum[1]) + source
sum/count
liquidity_break()=>
vol = volume_normalized()
avg = simple_moving_average(vol)
rank = ta.percentile_nearest_rank(vol, 75, 100)
avg_rank = simple_moving_average(rank)
colour = vol < avg ? "LV" : (vol > avg and vol < avg_rank ? "MV" : "HV")
volume_score = volume_normalized()
if extend
line.set_extend(down_trend_top, extend.right)
line.set_extend(down_trend_bottom, extend.right)
line.set_extend(down_trend_top_zone, extend.right)
line.set_extend(down_trend_bottom_zone, extend.right)
line.set_extend(down_trend_center, extend.right)
line.set_extend(up_trend_top, extend.right)
line.set_extend(up_trend_bottom, extend.right)
line.set_extend(up_trend_top_zone, extend.right)
line.set_extend(up_trend_bottom_zone, extend.right)
line.set_extend(up_trend_center, extend.right)
line.set_extend(down_trend_top_zone_mid, extend.right)
line.set_extend(down_trend_bottom_zone_mid, extend.right)
line.set_extend(up_trend_top_zone_mid, extend.right)
line.set_extend(up_trend_bottom_zone_mid, extend.right)
else
line.set_extend(down_trend_top, extend.none)
line.set_extend(down_trend_bottom, extend.none)
line.set_extend(down_trend_top_zone, extend.none)
line.set_extend(down_trend_bottom_zone, extend.none)
line.set_extend(down_trend_center, extend.none)
line.set_extend(up_trend_top, extend.none)
line.set_extend(up_trend_bottom, extend.none)
line.set_extend(up_trend_top_zone, extend.none)
line.set_extend(up_trend_bottom_zone, extend.none)
line.set_extend(up_trend_center, extend.none)
line.set_extend(down_trend_top_zone_mid, extend.none)
line.set_extend(down_trend_bottom_zone_mid, extend.none)
line.set_extend(up_trend_top_zone_mid, extend.none)
line.set_extend(up_trend_bottom_zone_mid, extend.none)
var down_dydx = 0.
var up_dydx = 0.
atr_10 = ta.atr(10) * 6
var down_count = 0
var up_count = 0
if (not na(prev_pivot_low)
and not na(last_pivot_low))
and prev_pivot_low != prev_pivot_low[1]
and atan2(last_pivot_low - prev_pivot_low, last_pivot_low_index -
prev_pivot_low_index) >= 0
and up_count == 0
and (wait ? down_count != 1 : true)
and barstate.isconfirmed
up_count := 1
offset = atr_10
line.set_xy1(up_trend_top, prev_pivot_low_index - length,
math.round_to_mintick(prev_pivot_low + offset + offset/7))
line.set_xy2(up_trend_top, last_pivot_low_index - length,
math.round_to_mintick(last_pivot_low + offset + offset/7))
line.set_color(up_trend_top, top_color)
line.set_xy1(up_trend_top_zone, prev_pivot_low_index - length,
math.round_to_mintick(prev_pivot_low + offset - offset/7))
line.set_xy2(up_trend_top_zone, last_pivot_low_index - length,
math.round_to_mintick(last_pivot_low + offset - offset/7))
line.set_xy1(up_trend_top_zone_mid, prev_pivot_low_index - length,
math.round_to_mintick(prev_pivot_low + offset))
line.set_xy2(up_trend_top_zone_mid, last_pivot_low_index - length,
math.round_to_mintick(last_pivot_low + offset))
line.set_xy1(up_trend_bottom, prev_pivot_low_index - length,
math.round_to_mintick(prev_pivot_low - offset/7))
line.set_xy2(up_trend_bottom, last_pivot_low_index - length,
math.round_to_mintick(last_pivot_low - offset/7))
line.set_color(up_trend_bottom, bottom_color)
line.set_xy1(up_trend_bottom_zone, prev_pivot_low_index - length,
math.round_to_mintick(prev_pivot_low + offset/7))
line.set_xy2(up_trend_bottom_zone, last_pivot_low_index - length,
math.round_to_mintick(last_pivot_low + offset/7))
line.set_xy1(up_trend_bottom_zone_mid, prev_pivot_low_index - length,
math.round_to_mintick(prev_pivot_low))
line.set_xy2(up_trend_bottom_zone_mid, last_pivot_low_index - length,
math.round_to_mintick(last_pivot_low))
up_dydx := (last_pivot_low - prev_pivot_low) / (last_pivot_low_index -
prev_pivot_low_index)
// Set center line for up trend
line.set_xy1(up_trend_center, prev_pivot_low_index - length,
math.round_to_mintick((prev_pivot_low + prev_pivot_low + offset) / 2))
line.set_xy2(up_trend_center, last_pivot_low_index - length,
math.round_to_mintick((last_pivot_low + last_pivot_low + offset) / 2))
line.set_color(up_trend_center, center_color)
label.set_text(up_break_label, "")
label.set_color(up_break_label, color.new(color.black, 100))
// Blank previous channel
if not show
line.set_xy1(down_trend_bottom, na, na)
line.set_xy2(down_trend_bottom, na, na)
line.set_xy1(down_trend_top, na, na)
line.set_xy2(down_trend_top, na, na)
line.set_xy1(down_trend_center, na, na)
line.set_xy2(down_trend_center, na, na)
line.set_xy1(down_trend_bottom_zone, na, na)
line.set_xy2(down_trend_bottom_zone, na, na)
line.set_xy1(down_trend_bottom_zone_mid, na, na)
line.set_xy2(down_trend_bottom_zone_mid, na, na)
line.set_xy1(down_trend_top_zone, na, na)
line.set_xy2(down_trend_top_zone, na, na)
line.set_xy1(down_trend_top_zone_mid, na, na)
line.set_xy2(down_trend_top_zone_mid, na, na)
label.set_text(down_break_label, "")
label.set_color(down_break_label, color.new(color.black, 100))
liquidity_score = liquidity_break()
volume_color_high = color.new(top_color, 60 + (100 - volume_score)/5)
volume_color_low = color.new(bottom_color, 60 + (100 - volume_score)/5)
atr_20 = ta.atr(20)/1.5
if down_count == 1
if enable_liquid
linefill.set_color(down_trend_top_zone_mid_fill, volume_color_high)
linefill.set_color(down_trend_bottom_zone_mid_fill, volume_color_low)
if not extend
line.set_y2(down_trend_top, line.get_y2(down_trend_top) + down_dydx)
line.set_y2(down_trend_bottom, line.get_y2(down_trend_bottom) + down_dydx)
line.set_y2(down_trend_top_zone, line.get_y2(down_trend_top_zone) +
down_dydx)
line.set_y2(down_trend_bottom_zone, line.get_y2(down_trend_bottom_zone) +
down_dydx)
line.set_y2(down_trend_top_zone_mid, line.get_y2(down_trend_top_zone_mid) +
down_dydx)
line.set_y2(down_trend_bottom_zone_mid,
line.get_y2(down_trend_bottom_zone_mid) + down_dydx)
line.set_y2(down_trend_center, line.get_y2(down_trend_center) + down_dydx)
line.set_x2(down_trend_top, bar_index)
line.set_x2(down_trend_bottom, bar_index)
line.set_x2(down_trend_top_zone, bar_index)
line.set_x2(down_trend_bottom_zone, bar_index)
line.set_x2(down_trend_top_zone_mid, bar_index)
line.set_x2(down_trend_bottom_zone_mid, bar_index)
line.set_x2(down_trend_center, bar_index)
if up_count == 1
if enable_liquid
linefill.set_color(top_trend_top_zone_mid_fill, volume_color_high)
linefill.set_color(top_trend_bottom_zone_mid_fill, volume_color_low)
if not extend
line.set_y2(up_trend_top, line.get_y2(up_trend_top) + up_dydx)
line.set_y2(up_trend_bottom, line.get_y2(up_trend_bottom) + up_dydx)
line.set_y2(up_trend_top_zone, line.get_y2(up_trend_top_zone) + up_dydx)
line.set_y2(up_trend_bottom_zone, line.get_y2(up_trend_bottom_zone) +
up_dydx)
line.set_y2(up_trend_top_zone_mid, line.get_y2(up_trend_top_zone_mid) +
up_dydx)
line.set_y2(up_trend_bottom_zone_mid, line.get_y2(up_trend_bottom_zone_mid)
+ up_dydx)
line.set_y2(up_trend_center, line.get_y2(up_trend_center) + up_dydx)
line.set_x2(up_trend_top, bar_index)
line.set_x2(up_trend_bottom, bar_index)
line.set_x2(up_trend_top_zone, bar_index)
line.set_x2(up_trend_bottom_zone, bar_index)
line.set_x2(up_trend_top_zone_mid, bar_index)
line.set_x2(up_trend_bottom_zone_mid, bar_index)
line.set_x2(up_trend_center, bar_index)