本页源码来自 TradingView 公开发布的开源脚本,版权归原作者所有, 请遵循其原始许可(Pine 脚本常见 CC BY-NC-SA / MPL-2.0 / MIT)。 本项目仅用于研究检索与许可范围内的移植。
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Amphibiantrading
//@version=5
indicator("Pullback Warning", overlay = true)
//constants
EMA9 = ta.ema(close, 9)
EMA20 = ta.ema(close, 20)
SMA50 = ta.sma(close, 50)
//inputs
sensitivity = input.string('Normal', 'Sensitivity', options = ['Normal', 'More', 'Less'])
bgFill = input.bool(true, 'Highlight Backgrond', inline = '1')
bgCol = input.color(color.new(color.red,85), ' ', inline = '1')
showShape = input.bool(true, 'Show Symbol', inline = '2')
shapeLocation = input.string('Above Bar', ' ', options = ['Above Bar', 'Below Bar', 'Bottom', 'Top'], inline = '2')
//switches
senseNum = switch sensitivity
'Normal' => 6
'More' => 5
'Less' => 7
loc = switch shapeLocation
'Above Bar' => location.abovebar
'Below Bar' => location.belowbar
'Bottom' => location.bottom
'Top' => location.top
//calculations
distMa1 = math.round(((close / EMA9) -1 ) *100, 1)
distMas = math.round(((EMA9 / EMA20) - 1) * 100, 1)
dist50 = math.round(((close / SMA50) -1 ) *100, 1)
//condition
extended = distMa1 > distMas and dist50 >= senseNum
//plots
plotshape(extended and showShape ? 1 : 0, 'Extended', loc == location.abovebar or loc == location.top ? shape.triangledown : shape.triangleup,
loc, color.red, display = display.pane)
bgcolor(bgFill and extended ? bgCol : na)