[A618] Vortex Indicator Alert Screener [Noise Filtered]

Ankit_1618 · study · 94 行 · 点赞 205 · 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/
// © Ankit_1618
//
//  CREDITS FOR Ehlers 2 pole ButterWorth Filter part : @CheatCountry
//  https://www.tradingview.com/script/Pp8BJxjf-Ehlers-2-Pole-Butterworth-Filter-V2-CC/
//
//
//@version=4
study("[A618] Vortex Indicator Alert Screener [Noise Filtered]", overlay=true)
 
//Vortex Indicator Part
period_ = input(14, title="Period", minval=2)
 
VMP = sum(abs(high - low[1]), period_)
VMM = sum(abs(low - high[1]), period_)
STR = sum(atr(1), period_)
VIP = VMP / STR
VIM = VMM / STR
 
//
//EMA 50
//
 
ema50 = ema(close, 50)
pema = plot(ema50, title="EMA 50", color=color.blue)
 
//
//  ======= : CREDITS : ========
//
// Ehlers 2 pole ButterWorth Filter
// Copyright (c) 2019-present, Franklin Moormann (cheatcountry)
// Ehlers 2 Pole Butterworth Filter V2 [CC] script may be freely distributed under the MIT license.
//
 
 
src = hlc3
length = input(title="Buterworth Filter Length", type=input.integer, defval=50, minval=1)
 
pi = 2 * asin(1)
a = exp(-1.414 * pi / length)
b = 2 * a * cos(1.414 * 1.25 * pi / length)
c2 = b
c3 = -a * a
c1 = 1 - c2 - c3
 
bf = 0.0
bf := (c1 * src) + (c2 * nz(bf[1])) + (c3 * nz(bf[2]))
 
sig = src > bf ? 1 : src < bf ? -1 : 0
bfColor = color.black
 
pbf = plot(bf, title="2 pole ButterWorth Filter", color=bfColor, linewidth=2)
//
// CheatCountry Part Ends
//
 
 
//
//  PLOTTING
//
 
 
fill(pbf, pema, color=bf>ema50 ? color.green : color.red)
 
condition_green = (bf>ema50 and crossover(VIP, VIM))
condition_red = (bf< ema50 and crossunder(VIP, VIM)) 
 
condition_bf_green = crossover(bf, ema50)
condition_bf_red = crossunder(bf, ema50)
 
plotshape( condition_green, title='Vortex Up', text='↑\n↑\n↑\n↑\nVortex Up',
          color=color.green, style=shape.arrowup, location=location.belowbar)
 
plotshape( condition_red, title='Vortex Down', text='Vortex Down\n↓\n↓\n↓\n↓\n',
          color=color.red, style=shape.arrowdown, location=location.abovebar)
 
plotshape( condition_bf_green, title='Vortex Up', text='↑\n↑\n↑\n↑\nCross[BF, ema50]',
          color=color.green, style=shape.arrowup, location=location.belowbar)
 
plotshape( condition_bf_red, title='Vortex Down', text='Cross[BF, ema50]\n↓\n↓\n↓\n↓\n',
          color=color.red, style=shape.arrowdown, location=location.abovebar)
 
 
//
//  ALERT CONDITION
//
 
all_alerts = condition_green or condition_red or condition_bf_green or condition_bf_red
bull_only_alerts = condition_green or condition_bf_green
bear_only_alerts = condition_bf_red or condition_red
 
alertcondition(all_alerts, title="All Alerts Vortex", message="All Alerts Vortex")
alertcondition(bull_only_alerts, title="Bull Only Alerts Vortex", message="Bull Only Alerts Vortex")
alertcondition(bear_only_alerts, title="Bear Only Alerts Vortex", message="Bear Only Alerts Vortex")

← 返回列表