【发布时间】:2020-05-03 05:46:49
【问题描述】:
我有一个可以正常工作的下拉选项,但不知道如何获取 If else 声明工作。为所有这些都尝试了如果,那么如果没有,则没有任何效果。否则(typ4 == rma)
Pine 给出以下错误,任何帮助都非常感激 不匹配的输入“wma”期望“行尾没有续行”。
//@version=4
strategy("Testing", overlay=true)
showSMA2 = input(title="Toggle WMA/RMA/VWMA/VWAP/HullMA", type=input.bool, defval=true)
typ4 = input(title="Choice", defval="WMA", options=["WMA", "RMA", "VWMA", "VWAP", "HullMA"])
len4 = input(9, minval=1, maxval=8, title="Length")
src4 = input(title="Source OHLC", type=input.source, defval=close)
out = if (typ4 == wma)
wma(src4, len4)
if typ4 == rma
rma(src4, len4)
if (typ4 == vwma)
vwma(src4, len4)
if (typ4 == vwap)
vwap(src4, len4)
if (typ4 == hullma)
hullma(src4, len4)
plot(out, title="Custom", color=iff(showSMA2, color.green, na))
下面也试过了,行尾错误out4 不匹配的输入“WMA1”期望“行尾没有续行”。
WMA1 = wma(src4, len4)
RMA1 = rma(src4, len4)
VWMA1 = vwma(src4, len4)
VWAP1 = vwap(src4, len4)
HullMA = wma(src4, len4)
out4 = if (typ4 == WMA) WMA1
if (typ4 == RMA) RMA1
if (typ4 == VWMA) VWMA1
if (typ4 == VWAP) VWAP1
if (typ4 == HullMA) HullMA1
【问题讨论】: