ADX Trend Filter

traderharikrishna · study · 18 行 · 点赞 2,125 · TradingView 原页

本页源码来自 TradingView 公开发布的开源脚本,版权归原作者所有, 请遵循其原始许可(Pine 脚本常见 CC BY-NC-SA / MPL-2.0 / MIT)。 本项目仅用于研究检索与许可范围内的移植。

Pine Script

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © traderharikrishna
 
//@version=5
indicator("ADX Trend Filter")
[p,m,a]=ta.dmi(14,14)
plot(a,style = plot.style_area,color=color.red)
m1=ta.ema(close,12)
m2=ta.ema(close,50)
mcolor=m1>m2?color.rgb(79, 163, 81):color.rgb(77, 23, 28)
plot(p,color=color.rgb(4, 104, 1),style = plot.style_columns,title='Buy')
plot(m,color=color.rgb(163, 2, 2),style = plot.style_columns,title='Sell')
barcolor(p>m and a>20?color.rgb(4, 104, 1):p<m and a>20?color.rgb(163, 2, 2):color.rgb(247, 222, 4))
plot(20,style = plot.style_area,color=mcolor,title='MA BAND')
plotshape(ta.crossover(p,m) and p>m?20:na,title = 'ADX up',color=color.rgb(3, 136, 8),style = shape.triangleup,size=size.tiny)
plotshape(ta.crossunder(p,m) and p<m?20:na,title = 'ADX Down',color=color.rgb(243, 38, 11),style = shape.triangledown,size=size.tiny)
alertcondition(ta.crossover(p,m) and p>m,title='ADX Up',message = 'ADX Crossed Up')
alertcondition(ta.crossunder(p,m) and p<m,title='ADX Down',message = 'ADX Crossed Down')

← 返回列表