Accurate Trend Band Trading System
Accurate Trend Band Trading System
0 at
https://mozilla.org/MPL/2.0/
// ? noop42
//@version=5
indicator(title='Accurate trend band trading system', shorttitle='Accurate trend
band trading system', overlay=true)
//no1=input.string("Multi Oscillators Price Levels ",title =
"=================indicator1=============")
// Input parameters
src =close// input(close, title='Source')
src_ind = 'RSI'//input.string(title='Source indicator', defval='RSI',
options=['Stochastic RSI', 'Stochastic CCI', 'RSI', 'CCI'], group='Options')
custom_timeframe = ''//input.timeframe(title='Timeframe', defval='',
group='Options')
// Drawing options
show_sup = true//input.bool(title='Show supports', defval=true, group='Drawings')
show_res = true//input.bool(title='Show resistances', defval=true,
group='Drawings')
lines_width = 3//input.int(title='Lines width', defval=3 , group='Drawings')
sup_src = low //input.source(title='Draw supports on', defval=low,
group='Drawings')
res_src = high//input.source(title='Draw resistances on', defval=high,
group='Drawings')
extend_level = 'None'//input.string('None', title='Extend levels',
options=['Right', 'Left', 'Both', 'None'], group='Drawings')
sup_col = #34eb3a//input.color(title='Supports color', defval=#34eb3a,
group='Drawings')
res_col =#eb4731// input.color(title='Resistances color', defval=#eb4731,
group='Drawings')
// Indicators
smoothKD =3// input.int(3, 'K & D smoothing', minval=1, group='Stoch RSI/CCI')
lengthStoch =14// input.int(14, 'Stochastic Length', minval=1, group='Stoch
RSI/CCI')
stoch_low = 20//input.int(20, title='Stoch Oversold Level', group='Stoch RSI/CCI')
stoch_high = 80//input.int(80, title='Stoch Overbought Level', group='Stoch
RSI/CCI')
// Indicators Data
rsi_tf = request.security(syminfo.tickerid, custom_timeframe, ta.rsi(src,
lengthRSI))
cci_tf = request.security(syminfo.tickerid, custom_timeframe, ta.cci(src,
lengthCCI))
// Extreme zones
srsi_ob = avgsrsi > stoch_high
srsi_os = avgsrsi < stoch_low
// Price lines
sup_final_src = request.security(syminfo.tickerid, custom_timeframe, sup_src)
res_final_src = request.security(syminfo.tickerid, custom_timeframe, res_src)
// Draw current
if show_sup and (not os) and os[1]
sup := line.new(bar_index[1], support, bar_index, support, extend=ext,
color=sup_col, width=lines_width)
else
line.set_x2(sup, line.get_x2(sup) +1)
if show_res and (not ob) and ob[1]
res := line.new(bar_index[1], resistance, bar_index, resistance, extend=ext,
color=res_col, width=lines_width)
else
line.set_x2(res, line.get_x2(res) +1)
//no2=input.string("EMAS",title = "=================indicator2=============")
ema1=5//input.int(5,title = "EMA1")
ema2=13//input.int(13,title = "EMA2")
ema3=34//input.int(34,title = "EMA3")
ema4=200//input.int(200,title = "过滤 EMA4")
EMAP1=ta.ema(close,ema1)
EMAP2=ta.ema(close,ema2)
EMAP3=ta.ema(close,ema3)
EMAP4=ta.ema(close,ema4)
plot(EMAP1)
plot(EMAP2)
plot(EMAP3,linewidth = 3,color = close>EMAP3?#34eb3a:close<EMAP3?color.red:na)
emabuy=close>EMAP1 and close >EMAP2 and close >EMAP3 and open< EMAP1 and open
<EMAP2 and open <EMAP3
emabuy2=close > EMAP4 and emabuy
// plotshape(emabuy2,title = "trend band trading",style =shape.arrowup,size
=size.large ,location=location.belowbar)
plotshape(emabuy2, title='trend band trading', text=' BUY ', style=shape.labelup,
location=location.belowbar, color=#34eb3a, textcolor=color.new(color.white,
0),size=size.small)//⇧
plotchar(emabuy2,char="⇧", title='trend band
trading',location=location.belowbar,size=size.large,precision=3,color=#34eb3a)
//no3=input.string("MACD-Divergence_bear_bull",title =
"=================indicator3=============")
//indicator(title='MACD-Divergence_bear_bull', timeframe='')
// Getting inputs
//------------------------------------------------------------------------------
// Regular Bullish
// Osc: Higher Low
//------------------------------------------------------------------------------
// Hidden Bullish
// Osc: Lower Low
oscLL = osc[lbR] < ta.valuewhen(plFound, osc[lbR], 1) and _inRange(plFound[1])
//------------------------------------------------------------------------------
// Regular Bearish
// Osc: Lower High
bearCond = plotBear and priceHH and oscLH and phFound and bearzero
//------------------------------------------------------------------------------
// Hidden Bearish
// Osc: Higher High