当我将“NA”变量放入“AND”逻辑时,我的脚本没有按预期工作。
// ON/OFF Indicator
// Buy Condition
MACDonoffbuy = useMACD ? macdLine > 0 : na
ADXonfoffbuy = useADX ? ADX > thradx : na
RSIonoffbuy = useRSI ? rsi >= overbought : na
Williamonoffbuy = useWilliam ? percentR >= -25 : na
Squeezeronoffbuy = useSqueezer ? sqzOff : na
// Sell Condition
MACDonoffsell = useMACD ? macdLine < 0 : na
ADXonfoffsell = useADX ? ADX > thradx : na
RSIonoffsell = useRSI ? rsi <= overbought : na
Williamonoffsell = useWilliam ? percentR <= -25 : na
Squeezeronoffsell = useSqueezer ? sqzOff : na
// Final Combination
buy = MACDonoffbuy and ADXonfoffbuy and RSIonoffbuy and Williamonoffbuy and Squeezeronoffbuy
sell = MACDonoffsell and ADXonfoffsell and RSIonoffsell and Williamonoffsell and Squeezeronoffsell
我的期望是,如果其中一个表达式在“AND”逻辑上为“NA”,则另一个表达式仍在计算中。