Directional Movement

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #6902 quote
    Alex975
    Participant
    Average

    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

    #7055 quote
    Alex975
    Participant
    Average

    someone? ))

    #7056 quote
    Nicolas
    Keymaster
    Master

    Oh i’m sorry Alex, I didn’t see your message earlier. I’ll code it and post it here, no worry.

    #7158 quote
    Alex975
    Participant
    Average

    thanks a lot Nicolas

    #8110 quote
    Nicolas
    Keymaster
    Master

    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.

    #17679 quote
    Eduardo M
    Participant
    Junior

    Hello Nicolas.  how can i reply ADX [7000] in your code?

    Thank you a lot.

    #17689 quote
    Nicolas
    Keymaster
    Master

    What do you want to get exactly? :

    1. the ADX value from 7000 periods ago?
    2. the ADX calculated within 7000 bars?
    #17710 quote
    Eduardo M
    Participant
    Junior

    Hello Nicolás.  I need Adx calculated within 7000 bars

    Regards

    #17711 quote
    Nicolas
    Keymaster
    Master

    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.

    #17729 quote
    Eduardo M
    Participant
    Junior

    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.

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.

Directional Movement


ProBuilder support

New Reply
Author
author-avatar
Alex975 @alex975 Participant
Summary

This topic contains 9 replies,
has 3 voices, and was last updated by Eduardo M
9 years, 1 month ago.

Topic Details
Forum: ProBuilder support
Language: English
Started: 05/12/2016
Status: Active
Attachments: No files
Logo Logo
Loading...