Я пытаюсь нанести сигналы на кроссовер (DIminus и DIPlus), используя индикатор, доступный в Tradingview ... ADX и DI от Masanakam.
Мои дополнительные условия к индикатору для построения стратегии и генерируемые сигналыявляются: longcondition и shortcondition
//@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"
UndeclaSmoothedTrueRange "
Необъявленный идентификатор" DIPlus "
Необъявленный идентификатор" DIMinus "
Необъявленный идентификатор" longCondition "
Необъявленный идентификатор" shortCondition "