满足条件时指示器中的背景颜色
在此指标结合了Walter Bresserts Double随机和RSI中,我一直在尝试添加背景颜色。
当满足“短”条件时,我希望在“长”条件下满足“长”条件时变成绿色:
long =((RSI< 15或RSI [1]< 15或RSI [2]< 15) and(dds10< 25))
short =((RSI> 85或RSI [1]> 85或RSI [2]> 85)> 85)和(DDS10> 85))
是否有人知道该怎么做?
提前致谢, 菲利普
//@version=5
indicator('RSI & DT Bressert')
HighlightBreaches = input(true, title='Highlight Oversold/Overbought?')
period = input.int(defval=13, title='Period', minval=1, maxval=16)
top = 85
bot = 25
len = input.int(2, minval=1, title='Length')
src = input(close, 'Source')
up = ta.rma(math.max(ta.change(src), 0), len)
down = ta.rma(-math.min(ta.change(src), 0), len)
rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - 100 / (1 + up / down)
plot(rsi, 'RSI', color=color.new(#C0C0C0, 0))
period10 = input(title='Periodes', defval=10)
period5 = input(title='Periodes', defval=5)
stochastic10 = ta.ema((close - ta.lowest(low, period10)) / (ta.highest(high, period10) - ta.lowest(low, period10)) * 100, 3)
dds10 = ta.ema((stochastic10 - ta.lowest(stochastic10, period10)) / (ta.highest(stochastic10, period10) - ta.lowest(stochastic10, period10)) * 100, 3)
stochastic5 = ta.ema((close - ta.lowest(low, period5)) / (ta.highest(high, period5) - ta.lowest(low, period5)) * 100, 3)
dds5 = ta.ema((stochastic5 - ta.lowest(stochastic5, period5)) / (ta.highest(stochastic5, period5) - ta.lowest(stochastic5, period5)) * 100, 3)
hline(title='OB', price=top, color=color.black)
hline(title='OS', price=bot, color=color.black)
plot(series=dds10, color=dds10[1] < dds10 ? color.green : color.red, linewidth=2)
plot(series=dds5, color=dds5[1] < dds5 ? color.blue : color.navy, linewidth=2)
I have been trying to add background colors when certain conditions are met in this indicator that combines Walter Bresserts double stochastic and the RSI.
I want the background color to turn green when "long" conditions are met and red when "short" conditions are met:
long = ((rsi < 15 or rsi[1] < 15 or rsi[2] < 15) and (dds10 < 25))
short = ((rsi > 85 or rsi[1] > 85 or rsi[2] > 85) and (dds10 > 85))
Does anyone here know how to do that?
Thanks in advance,
Philip
//@version=5
indicator('RSI & DT Bressert')
HighlightBreaches = input(true, title='Highlight Oversold/Overbought?')
period = input.int(defval=13, title='Period', minval=1, maxval=16)
top = 85
bot = 25
len = input.int(2, minval=1, title='Length')
src = input(close, 'Source')
up = ta.rma(math.max(ta.change(src), 0), len)
down = ta.rma(-math.min(ta.change(src), 0), len)
rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - 100 / (1 + up / down)
plot(rsi, 'RSI', color=color.new(#C0C0C0, 0))
period10 = input(title='Periodes', defval=10)
period5 = input(title='Periodes', defval=5)
stochastic10 = ta.ema((close - ta.lowest(low, period10)) / (ta.highest(high, period10) - ta.lowest(low, period10)) * 100, 3)
dds10 = ta.ema((stochastic10 - ta.lowest(stochastic10, period10)) / (ta.highest(stochastic10, period10) - ta.lowest(stochastic10, period10)) * 100, 3)
stochastic5 = ta.ema((close - ta.lowest(low, period5)) / (ta.highest(high, period5) - ta.lowest(low, period5)) * 100, 3)
dds5 = ta.ema((stochastic5 - ta.lowest(stochastic5, period5)) / (ta.highest(stochastic5, period5) - ta.lowest(stochastic5, period5)) * 100, 3)
hline(title='OB', price=top, color=color.black)
hline(title='OS', price=bot, color=color.black)
plot(series=dds10, color=dds10[1] < dds10 ? color.green : color.red, linewidth=2)
plot(series=dds5, color=dds5[1] < dds5 ? color.blue : color.navy, linewidth=2)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在代码末尾添加类似的内容。它使用 bgcolor()
You can add something like this at the end of your code. It uses bgcolor()