多个警报条件不起作用 - alertcondition(condition=((rsiValue > 70) and (close > upper)) or ((rsiValue < 30) and (close < lower))
Multiple alert criteria not working - alertcondition(condition=((rsiValue > 70) and (close > upper)) or ((rsiValue < 30) and (close < lower))
警报应触发一次:
// Set up alert
alertcondition(condition=((rsiValue > 70) and (close > upper)) or ((rsiValue < 30) and (close < lower)),
message="alert")
它会提醒,但只有一次价格 returns 超卖或超买,而不是在价格满足上述条件的情况下。有什么线索吗?
1 秒的时间范围有助于加快测试速度。
//@version=4
study(title="TDIcrossingAlert", overlay=true)
rsiValue = rsi(close, 11)
length = input(50, minval=1)
mult = input(3.0, "Multiplier")
src = input(close, title="Source")
exp = input(true, "Use Exponential MA")
BandsStyle = input("Average True Range", options = ["Average True Range", "True Range", "Range"], title="Bands Style")
atrlength = input(1000, "ATR Length")
esma(source, length)=>
s = sma(source, length)
e = ema(source, length)
exp ? e : s
ma = esma(src, length)
rangema = BandsStyle == "True Range" ? tr(true) : BandsStyle == "Average True Range" ? atr(atrlength) : rma(high - low, length)
upper = ma + rangema * mult
lower = ma - rangema * mult
u = plot(upper, color=#363A45, title="Upper")
l = plot(lower, color=#363A45, title="Lower")
// Set up alert
alertcondition(condition=((rsiValue > 70) and (close > upper)) or ((rsiValue < 30) and (close < lower)),
message="alert")
所以您的警报没有在您想要的位置触发,因为我们需要将您在那里使用的 TDIGM 指标集成到脚本中作为一个来捕获这些条件!它不是此振荡器中的常规 RSI,添加了一些平滑。我为您将这两个脚本放在一起,并添加了您可能喜欢的另一个触发器。每个都有一个 plotshape,可以直观地看到触发相同警报条件的位置(也包括在内)。保留其他脚本的 plotshape 进行测试!加油保重!
//@version=4
study(title="TDIcrossingAlert", overlay=true)
length = input(50, minval=1)
mult = input(3.0, "Multiplier")
src = input(close, title="Source")
exp = input(true, "Use Exponential MA")
BandsStyle = input("Average True Range", options = ["Average True Range", "True Range", "Range"], title="Bands Style")
atrlength = input(1000, "ATR Length")
rsiPeriod = input(11, minval = 1, title = "RSI Period")
bandLength = input(11, minval = 1, title = "Band Length")
lengthrsipl = input(2, minval = 0, title = "Fast MA on RSI")
lengthtradesl = input(6, minval = 1, title = "Slow MA on RSI")
esma(source, length)=>
s = sma(source, length)
e = ema(source, length)
exp ? e : s
ma = esma(src, length)
rangema = BandsStyle == "True Range" ? tr(true) : BandsStyle == "Average True Range" ? atr(atrlength) : rma(high - low, length)
upper = ma + rangema * mult
lower = ma - rangema * mult
u = plot(upper, color=#363A45, title="Upper")
l = plot(lower, color=#363A45, title="Lower")
// TDIGM incorporated into the script to mimic the conditions oof your oscilator
r = rsi(src, rsiPeriod) // RSI of Close
ma2 = sma(r, bandLength) // Moving Average of RSI [current]
offs = (1.6185 * stdev(r, bandLength)) // Offset
up = ma2 + offs // Upper Bands
dn = ma2 - offs // Lower Bands
mid = (up + dn) / 2 // Average of Upper and Lower Bands
fastMA = sma(r, lengthrsipl) // Moving Average of RSI 2 bars back
slowMA = sma(r, lengthtradesl) // Moving Average of RSI 7 bars back
con1 = fastMA > 70 and crossunder(close,upper)
con2 = fastMA > 70 and crossunder(fastMA,slowMA) and (close > upper)[1]
con3 = fastMA < 30 and crossover(close,lower)
con4 = fastMA < 30 and crossover(fastMA,slowMA) and (close < lower)[1]
plotshape(con1, style=shape.xcross, location=location.abovebar, color=color.yellow, title="Above")
plotshape(con2, style=shape.triangledown, location=location.abovebar, color=color.red, title="Overbought")
plotshape(con3, style=shape.xcross, location=location.belowbar, color=color.yellow, title="Above")
plotshape(con4, style=shape.triangleup, location=location.belowbar, color=color.green, title="Overbought")
// Set up alert
alertcondition(con1, "Overbought", 'Overbought on {{interval}} chart. Price is {{close}}')
alertcondition(con2, "Overbought Cross", 'Overbought Cross on {{interval}} chart. Price is {{close}}')
alertcondition(con3, "Oversold", 'Oversold on {{interval}} chart. Price is {{close}}')
alertcondition(con4, "Oversold Cross", 'Oversold Cross on {{interval}} chart. Price is {{close}}')
警报应触发一次:
// Set up alert
alertcondition(condition=((rsiValue > 70) and (close > upper)) or ((rsiValue < 30) and (close < lower)),
message="alert")
它会提醒,但只有一次价格 returns 超卖或超买,而不是在价格满足上述条件的情况下。有什么线索吗?
1 秒的时间范围有助于加快测试速度。
//@version=4
study(title="TDIcrossingAlert", overlay=true)
rsiValue = rsi(close, 11)
length = input(50, minval=1)
mult = input(3.0, "Multiplier")
src = input(close, title="Source")
exp = input(true, "Use Exponential MA")
BandsStyle = input("Average True Range", options = ["Average True Range", "True Range", "Range"], title="Bands Style")
atrlength = input(1000, "ATR Length")
esma(source, length)=>
s = sma(source, length)
e = ema(source, length)
exp ? e : s
ma = esma(src, length)
rangema = BandsStyle == "True Range" ? tr(true) : BandsStyle == "Average True Range" ? atr(atrlength) : rma(high - low, length)
upper = ma + rangema * mult
lower = ma - rangema * mult
u = plot(upper, color=#363A45, title="Upper")
l = plot(lower, color=#363A45, title="Lower")
// Set up alert
alertcondition(condition=((rsiValue > 70) and (close > upper)) or ((rsiValue < 30) and (close < lower)),
message="alert")
所以您的警报没有在您想要的位置触发,因为我们需要将您在那里使用的 TDIGM 指标集成到脚本中作为一个来捕获这些条件!它不是此振荡器中的常规 RSI,添加了一些平滑。我为您将这两个脚本放在一起,并添加了您可能喜欢的另一个触发器。每个都有一个 plotshape,可以直观地看到触发相同警报条件的位置(也包括在内)。保留其他脚本的 plotshape 进行测试!加油保重!
//@version=4
study(title="TDIcrossingAlert", overlay=true)
length = input(50, minval=1)
mult = input(3.0, "Multiplier")
src = input(close, title="Source")
exp = input(true, "Use Exponential MA")
BandsStyle = input("Average True Range", options = ["Average True Range", "True Range", "Range"], title="Bands Style")
atrlength = input(1000, "ATR Length")
rsiPeriod = input(11, minval = 1, title = "RSI Period")
bandLength = input(11, minval = 1, title = "Band Length")
lengthrsipl = input(2, minval = 0, title = "Fast MA on RSI")
lengthtradesl = input(6, minval = 1, title = "Slow MA on RSI")
esma(source, length)=>
s = sma(source, length)
e = ema(source, length)
exp ? e : s
ma = esma(src, length)
rangema = BandsStyle == "True Range" ? tr(true) : BandsStyle == "Average True Range" ? atr(atrlength) : rma(high - low, length)
upper = ma + rangema * mult
lower = ma - rangema * mult
u = plot(upper, color=#363A45, title="Upper")
l = plot(lower, color=#363A45, title="Lower")
// TDIGM incorporated into the script to mimic the conditions oof your oscilator
r = rsi(src, rsiPeriod) // RSI of Close
ma2 = sma(r, bandLength) // Moving Average of RSI [current]
offs = (1.6185 * stdev(r, bandLength)) // Offset
up = ma2 + offs // Upper Bands
dn = ma2 - offs // Lower Bands
mid = (up + dn) / 2 // Average of Upper and Lower Bands
fastMA = sma(r, lengthrsipl) // Moving Average of RSI 2 bars back
slowMA = sma(r, lengthtradesl) // Moving Average of RSI 7 bars back
con1 = fastMA > 70 and crossunder(close,upper)
con2 = fastMA > 70 and crossunder(fastMA,slowMA) and (close > upper)[1]
con3 = fastMA < 30 and crossover(close,lower)
con4 = fastMA < 30 and crossover(fastMA,slowMA) and (close < lower)[1]
plotshape(con1, style=shape.xcross, location=location.abovebar, color=color.yellow, title="Above")
plotshape(con2, style=shape.triangledown, location=location.abovebar, color=color.red, title="Overbought")
plotshape(con3, style=shape.xcross, location=location.belowbar, color=color.yellow, title="Above")
plotshape(con4, style=shape.triangleup, location=location.belowbar, color=color.green, title="Overbought")
// Set up alert
alertcondition(con1, "Overbought", 'Overbought on {{interval}} chart. Price is {{close}}')
alertcondition(con2, "Overbought Cross", 'Overbought Cross on {{interval}} chart. Price is {{close}}')
alertcondition(con3, "Oversold", 'Oversold on {{interval}} chart. Price is {{close}}')
alertcondition(con4, "Oversold Cross", 'Oversold Cross on {{interval}} chart. Price is {{close}}')