pine-script - 谁能检查一下为什么我没有收到信号并收到“未声明的标识符”错误
问题描述
我正在尝试使用 Tradingview 中可用的指标绘制交叉信号(DIminus 和 DIPlus)。Masanakam 的 ADX 和 DI。
我对指标构建策略和生成信号的附加条件是:长期条件和短期条件
//@version=3
strategy("ADX and DI", overlay=true)
len = input(title="Length", type=integer, defval=14)
th = input(title="threshold", type=integer, defval=20)
TrueRange = max(max(high-low, abs(high-nz(close[1]))), abs(low-nz(close[1])))
DirectionalMovementPlus = high-nz(high[1]) > nz(low[1])-low ? max(high-nz(high[1]), 0): 0
DirectionalMovementMinus = nz(low[1])-low > high-nz(high[1]) ? max(nz(low[1])-low, 0): 0rueRange = max(max(high-low, abs(high-nz(close[1]))), abs(low-nz(close[1])))
DirectionalMovementPlus = high-nz(high[1]) > nz(low[1])-low ? max(high-nz(high[1]), 0): 0
DirectionalMovementMinus = nz(low[1])-low > high-nz(high[1]) ? max(nz(low[1])-low, 0): 0
SmoothedTrueRange = nz(SmoothedTrueRange[1]) - (nz(SmoothedTrueRange[1])/len) + TrueRange
SmoothedDirectionalMovementPlus = nz(SmoothedDirectionalMovementPlus[1]) - (nz(SmoothedDirectionalMovementPlus[1])/len) + DirectionalMovementPlus
SmoothedDirectionalMovementMinus = nz(SmoothedDirectionalMovementMinus[1]) - (nz(SmoothedDirectionalMovementMinus[1])/len) + DirectionalMovementMinus
DIPlus = SmoothedDirectionalMovementPlus / SmoothedTrueRange * 100
DIMinus = SmoothedDirectionalMovementMinus / SmoothedTrueRange * 100
DX = abs(DIPlus-DIMinus) / (DIPlus+DIMinus)*100
ADX = sma(DX, len)
longCondition = crossover(DIPlus, DIMinus)
if (longCondition and time>timestamp(2019, 01, 01, 09, 30))
strategy.entry("My Long Entry Id", strategy.long)
shortCondition = crossover(DIMinus, DIPlus)
if (shortCondition and time>timestamp(2019, 01, 01, 09, 30))
strategy.entry("My Short Entry Id", strategy.short)
我得到的错误是:
未声明标识符“SmoothedDirectionalMovementPlus”
未声明标识符“SmoothedDirectionalMovementMinus”
未声明标识符“SmoothedTrueRange”
未声明标识符“DIPlus”
未声明标识符“DIMinus”
未声明标识符“longCondition”
未声明标识符“shortCondition”
解决方案
推荐阅读
- python - 将 Python 变量导入 HTML
- ios - Xcode 10.1 中的指针验证码是什么?
- c# - 如何在 UWP 上与 OneDrive 同步数据
- ios - 从嵌入的tableviewcontroller执行Segue时如何保留NavigationController
- c - Mac OS:在 C 中打印访问控制列表 (ACL)
- excel - 设置“新 InternetExplorer”会生成自动化错误:-2125463506 (8150002e)
- jsf-2 - JSF 2.0 中 faces-config.xml 中的多个资源包
- javascript - 检查Angular中是否处于“模式”可见打印或隐藏打印
- javascript - 视频需要很长时间才能在 html 和 php 中缓冲
- python - 从树莓派发出请求时未收到套接字数据