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"
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"
The MA and ADX have completely different scales. I don’t see how you want to display them in the same indicator.
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"