Hi, I’m new in the ProRealCode.
I’m looking for the Directional Movement formula to Prorealotime.
If someone can help me..
Alessandro.
Buongiorno, sono appena iscritto a ProRealCode sto cercando la formula per prorealtime del Directional Movment, purtroppo non la riesco a reperire in rete. Se qualcuno può darmi indicazioni.. grazie
Oh i’m sorry Alex, I didn’t see your message earlier. I’ll code it and post it here, no worry.
Hello Alex,
At least, here is the code of DMI (which is part of ADX):
REM Let's compute +DM & -DM
plusDM = max(high-high[1], 0)
minusDM = max(low[1]-low, 0)
IF plusDM > minusDM THEN
minusDM = 0
ENDIF
IF plusDM < minusDM THEN
plusDM = 0
ENDIF
IF plusDM = minusDM THEN
plusDM = 0
minusDM = 0
ENDIF
REM Let's compute the directional indicators
plusDI = wilderAverage[p](plusDM)
minusDI = wilderAverage[p](minusDM)
REM Let's compute the ADX indicator
DX = ABS(plusDI - minusDI) / (plusDI + minusDI) * 100
myADX = wilderAverage[p](DX)
RETURN myADX as "ADX", 25
This code is already embedded into the platform (ADX code example). Hope it helps.
Hello Nicolas. how can i reply ADX [7000] in your code?
Thank you a lot.
What do you want to get exactly? :
- the ADX value from 7000 periods ago?
- the ADX calculated within 7000 bars?
Hello Nicolás. I need Adx calculated within 7000 bars
Regards
Just add :
p = 7000
At the top of the code and verify you have at least 7000 bars already loaded to calculate the ADX indicator:
if barindex>p then
// all codes
endif
Please find below the whole code modified:
p = 7000 //calculation periods
if barindex>p then
REM Let's compute +DM & -DM
plusDM = max(high-high[1], 0)
minusDM = max(low[1]-low, 0)
IF plusDM > minusDM THEN
minusDM = 0
ENDIF
IF plusDM < minusDM THEN
plusDM = 0
ENDIF
IF plusDM = minusDM THEN
plusDM = 0
minusDM = 0
ENDIF
REM Let's compute the directional indicators
plusDI = wilderAverage[p](plusDM)
minusDI = wilderAverage[p](minusDM)
REM Let's compute the ADX indicator
DX = ABS(plusDI - minusDI) / (plusDI + minusDI) * 100
myADX = wilderAverage[p](DX)
endif
RETURN myADX as "ADX", 25
Of course you’ll need to have at least 7000+ units (candlesticks) displayed on your chart. Let me know if it’s ok.
Oh!!!, It works absolutely perfect. Thank you very much for your support.
I have find that the original ADX[7000] stop with a dax 5 mm strategy, but running your code works fine.
Thank you again.
Eduardo.