English 中文(简体)
Using if statement when input is selected in pinescript
原标题:

I have a drop down menu via inputs that should control the backgroundcolor when changed.

As a simple example, when I select the 200/200 from the drop down list, I want the background color to use the conditions from 200/200.

Right now, I am not getting any errors, but the background color doesn t change when i change the input setting. Any help or suggestions on how to fix this would be greatly appreciated.

BackGroundColor = input.string(title="Background Color", defval="45/45", options=["4SMA/45EMA", "8EMA/45EMA", "20EMA/45EMA", "45EMA/200EMA", "45/45", "200/200", "OFF"])

if BackGroundColor() == "200/200" {
  var GreenAreaCond200 = FSR > LeadingFullVib and close > EMA200
  var BlueAreaCond200 = FSR < LeadingFullVib and close > EMA200
  var RedAreaCond200 = FSR < LeadingFullVib and close < EMA200
  var OrangeAreaCond200 = FSR > LeadingFullVib and close < EMA45
}

bgcolor(GreenAreaCond45 ? color.new(color.green,80) : BlueAreaCond45 ? color.new(color.blue,80) : RedAreaCond45 ? color.new(color.red,80) : OrangeAreaCond45 ? color.new(color.orange,80) : GreenAreaCond200 ? color.new(color.green,80) : BlueAreaCond200 ? color.new(color.blue,80) : RedAreaCond200 ? color.new(color.red,80) : OrangeAreaCond200 ? color.new(color.orange,80): GreenAreaCond4S45E ? color.new(color.green,80) : BlueAreaCond4S45E ? color.new(color.blue,80) : RedAreaCond4S45E ? color.new(color.red,80) : OrangeAreaCond4S45E ? color.new(color.orange,80): GreenAreaCond8E45E ? color.new(color.green,80) : BlueAreaCond8E45E ? color.new(color.blue,80) : RedAreaCond8E45E ? color.new(color.red,80) : OrangeAreaCond8E45E ? color.new(color.orange,80): GreenAreaCond20E45E ? color.new(color.green,80) : BlueAreaCond20E45E ? color.new(color.blue,80) : RedAreaCond20E45E ? color.new(color.red,80) : OrangeAreaCond20E45E ? color.new(color.orange,80): GreenAreaCond45E200E ? color.new(color.green,80) : BlueAreaCond45E200E ? color.new(color.blue,80) : RedAreaCond45E200E ? color.new(color.red,80) : OrangeAreaCond45E200E ? color.new(color.orange,80): na)
问题回答

暂无回答




相关问题
I m trying to write pinescript to locate side by side candles

Brother candles as per image so the candles open and close values are about the same one bullish, one bearish eg. close of candle 1 = open candle 2 open candles 2 = close candle 1 hope someone may ...

Using if statement when input is selected in pinescript

I have a drop down menu via inputs that should control the backgroundcolor when changed. As a simple example, when I select the 200/200 from the drop down list, I want the background color to use the ...

为什么用文字计算错误?

我写了一个文字,比较了两种符号之间百分比差异的演变,但我可以说明为什么计算错误。

热门标签