message (33)
message (33)
indicator(title='X4815162342', overlay=true)
source = close
hilow = (high - low) * 100
openclose = (close - open) * 100
vol = volume / hilow
spreadvol = openclose * vol
VPT = spreadvol + ta.cum(spreadvol)
window_len = 28
v_len = 14
price_spread = ta.stdev(high - low, window_len)
v = spreadvol + ta.cum(spreadvol)
smooth = ta.sma(v, v_len)
v_spread = ta.stdev(v - smooth, window_len)
shadow = (v - smooth) / v_spread * price_spread
c = ta.ema(src, len)
//plot(c, color=color.new(color.red, 0))
o = ta.ema(src1, len)
//plot(o, color=color.new(color.blue, 0))
//h = ema(src3,len)
//l=ema(src2,len)
//
col = c > o ? color.lime : color.orange
vis = true
vl = c
ll = o
//m1 = //plot(vl, color=col, linewidth=1, transp=60)
//m2 = //plot(vis ? ll : na, color=col, linewidth=2, transp=80)
// INPUTS //
st_mult = input.float(1.9, title='SuperTrend Multiplier', minval=0, maxval=100,
step=0.01)
st_period = input.int(7, title='SuperTrend Period', minval=1)
// CALCULATIONS //
up_lev = vpt - st_mult * ta.atr(st_period)
dn_lev = vpt + st_mult * ta.atr(st_period)
up_trend = 0.0
up_trend := close[1] > up_trend[1] ? math.max(up_lev, up_trend[1]) : up_lev
down_trend = 0.0
down_trend := close[1] < down_trend[1] ? math.min(dn_lev, down_trend[1]) : dn_lev
// Plotting
//plot(st_line[1], color=trend == 1 ? color.green : color.red,
style=plot.style_cross, linewidth=2, title='SuperTrend')
buy = ta.crossover(close, st_line) and close > o
sell = ta.crossunder(close, st_line) and close < o
//plotshape(crossover( close, st_line), location = location.belowbar, color =
color.green,size=size.tiny)
//plotshape(crossunder(close, st_line), location = location.abovebar, color =
color.red,size=size.tiny)
plotshape(buy, title='buy', text='Buy', color=color.new(color.green, 0),
style=shape.labelup, location=location.belowbar, size=size.small,
textcolor=color.new(color.white, 0)) //plot for buy icon
plotshape(sell, title='sell', text='Sell', color=color.new(color.red, 0),
style=shape.labeldown, location=location.abovebar, size=size.small,
textcolor=color.new(color.white, 0)) //plot for sell icon
//
multiplier = input.float(title='TP', defval=2, minval=1)
src5 = close
len5 = input.int(title='TP length', defval=150, minval=1)
offset = 0
//
z1 = vwap1 + dev
x1 = vwap1 - dev
//plot(emaup, title='EMAUP')
//plot(emadw, title='EMADW')
donchian(len) =>
math.avg(ta.lowest(len), ta.highest(len))
conversionLine = donchian(conversionPeriods)
baseLine = donchian(basePeriods)
leadLine1 = math.avg(conversionLine, baseLine)
leadLine2 = donchian(laggingSpan2Periods)
//*****CDC-Actionzone**************************************************//
//****************************************************************************//
//Calculate Indicators
FastMA = xfixtf ?
ta.ema(f_secureSecurity(syminfo.tickerid, xtf, ta.ema(xsrc, xprd1)), xsmooth)
:
ta.ema(xPrice, xprd1)
SlowMA = xfixtf ?
ta.ema(f_secureSecurity(syminfo.tickerid, xtf, ta.ema(xsrc, xprd2)), xsmooth)
:
ta.ema(xPrice, xprd2)
//****************************************************************************//
// Define Color Zones
//****************************************************************************//
// Display color on chart
//****************************************************************************//
// Display MA lines
//****************************************************************************//
// Define Buy and Sell condition
// This is only for thebasic usage of CDC Actionzone (EMA Crossover)
// ie. Buy on first green bar and sell on first red bar
//****************************************************************************//
// Plot Buy and Sell point on chart
//****************************************************************************//
// Label
// fixed inputs //
smoothK = 3
smoothD = 3
RSIlen = 14
STOlen = 14
SRsrc = close
OSlevel = 30
OBlevel = 70
// calculations //
rsi1 = ta.rsi(SRsrc, RSIlen)
k = ta.sma(ta.stoch(rsi1, rsi1, rsi1, STOlen), smoothK)
d = ta.sma(k, smoothD)
// storsiBuySig = if bullish
// if (d < OSlevel and crossover(k,d))
// 3
// else if crossover(k,OSlevel)
// 2
// else if d > OSlevel and crossover(k,d)
// 1
// else
// 0
// else
// 0
crossover_1 = ta.crossover(k, d)
crossover_2 = ta.crossover(k, d)
iff_1 = d > OSlevel and crossover_2 ?
1 : 0
iff_2 = d < OSlevel and crossover_1 ?
2 : iff_1
storsiBuySig = bullish ? iff_2 : 0
crossunder_1 = ta.crossunder(k, d)
crossunder_2 = ta.crossunder(k, d)
iff_3 = d < OBlevel and crossunder_2 ?
1 : 0
iff_4 = d > OBlevel and crossunder_1 ?
2 : iff_3
storsiSellSig = bearish ? iff_4 : 0
//****************************************************************************//
// Alert conditions
alertcondition(buy,
title='*Buy Alert',
message='Buy {{exchange}}:{{ticker}}')
alertcondition(sell,
title='*Sell Alert',
message='Sell {{exchange}}:{{ticker}}')
alertcondition(bullish,
title='is Bullish')
alertcondition(bearish,
title='is Bearish')
alertcondition(Green,
title='is Green')
alertcondition(Blue,
title='is Blue (Strong Rally)')
alertcondition(LBlue,
title='is Light Blue (Rally)')
alertcondition(Red,
title='is Red')
alertcondition(Orange,
title='is Orange (Strong Dip)')
alertcondition(Yellow,
title='is Yellow (Dip)')
//****************************************************************************//