ADX Line on MA Line

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #47260 quote
    juanjjuanj
    Participant
    Master

    Good Day

    Is it possible to return two different types of lines in one indicator i.e. an MA and an ADX?

    I tried below but obviously, only the MA line is returned as ProBuilder probably doesn’t know against what reference to draw the ADX line;

    Was thinking maybe to use the MA line itself a the ‘zero’ line and let the ADX line rise of the MA? Any ideas how to do that?

    //variables to add:
    
    //RSIPeriod (Default: 2)
    //MAPeriod (Default: 21)
    //MAType (Default: 2)
    //RSIUpperThreshold (Default: 95)
    //RSILowerThreshold (Default: 5)
    //ADXPeriod (Default: 21)
    
    myrsi=RSI[RSIPeriod](close)
    myma=Average[MAPeriod,MAType](close)
    If myrsi>RSIUpperThreshold then
    r=255
    g=0
    b=0
    Elsif myrsi<RSILowerThreshold then
    r=0
    g=255
    b=0
    Else
    r=0
    g=0
    b=0
    endif
    
    myADX = ADX[ADXPeriod]
     
    return myma coloured(r,g,b) as "Hybrid MA", myADX coloured(0,0,0) as "Average Directional Index"
    #47266 quote
    juanjjuanj
    Participant
    Master

    I found a temporary solution playing around with colors:

    //variables to add:
    
    //RSIPeriod (Default: 2)
    //MAPeriod (Default: 21)
    //MAType (Default: 2)
    //RSIUpperThreshold (Default: 95)
    //RSILowerThreshold (Default: 5)
    //ADXPeriod (Default: 21)
    //ADXRef (Default: 2)
    //ADXMinThreshold (Default: 10)
    
    myrsi=RSI[RSIPeriod](close)
    myma=Average[MAPeriod,MAType](close)
    myADX = ADX[ADXPeriod]
    
    If myrsi>RSIUpperThreshold then
    r=255
    g=0
    b=0
    Elsif myrsi<RSILowerThreshold then
    r=0
    g=255
    b=0
    Elsif myrsi>RSIUpperThreshold and myADX > myADX[ADXRef] and myADX >= ADXMinThreshold then //ADX Rising and Overbought
    r=139
    g=0
    b=255
    Elsif myrsi<RSILowerThreshold and myADX > myADX[ADXRef] and myADX >= ADXMinThreshold then //ADX Falling and Oversold
    r=3
    g=192
    b=60
    Elsif myrsi<RSIUpperThreshold and myrsi>RSILowerThreshold and (myADX > myADX[ADXRef] and myADX >= ADXMinThreshold) then //ADX Rising
    r=0
    g=0
    b=255
    Elsif myrsi<RSIUpperThreshold and myrsi>RSILowerThreshold and (myADX < myADX[ADXRef] or myADX < ADXMinThreshold) then //ADX Falling
    r=0
    g=0
    b=0
    endif
     
    return myma coloured(r,g,b) as "Hybrid MA"
    #47273 quote
    DespairDespair
    Blocked
    Master

    The MA and ADX have completely different scales. I don’t see how you want to display them in the same indicator.

    #47274 quote
    juanjjuanj
    Participant
    Master

    Suppose I am happy with the colors one:

    //variables to add:
    
    //RSIPeriod (Default: 2)
    //MAPeriod (Default: 21)
    //MAType (Default: 2)
    //RSIUpperThreshold (Default: 95)
    //RSILowerThreshold (Default: 5)
    //ADXPeriod (Default: 21)
    //ADXRef (Default: 2)
    //ADXMinThreshold (Default: 10)
    
    myrsi=RSI[RSIPeriod](close)
    myma=Average[MAPeriod,MAType](close)
    myADX = ADX[ADXPeriod]
    
    If myrsi>RSIUpperThreshold and myADX <= myADX[ADXRef] then
    r=255
    g=0
    b=0
    Elsif myrsi<RSILowerThreshold and myADX <= myADX[ADXRef] then
    r=0
    g=255
    b=0
    Elsif myrsi>RSIUpperThreshold and myADX > myADX[ADXRef] and myADX >= ADXMinThreshold then //ADX Rising and Overbought
    r=206
    g=32
    b=41
    Elsif myrsi<RSILowerThreshold and myADX > myADX[ADXRef] and myADX >= ADXMinThreshold then //ADX Falling and Oversold
    r=3
    g=192
    b=60
    Elsif myrsi<RSIUpperThreshold and myrsi>RSILowerThreshold and (myADX > myADX[ADXRef] and myADX >= ADXMinThreshold) then //ADX Rising
    r=0
    g=0
    b=255
    Elsif myrsi<RSIUpperThreshold and myrsi>RSILowerThreshold and (myADX < myADX[ADXRef] or myADX < ADXMinThreshold) then //ADX Falling
    r=0
    g=0
    b=0
    endif
     
    return myma coloured(r,g,b) as "Hybrid MA"
    
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

ADX Line on MA Line


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
juanj @juanj Participant
Summary

This topic contains 3 replies,
has 2 voices, and was last updated by juanjjuanj
9 years ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 09/25/2017
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...