Nicolas

MACD RSI Adaptive

Category: Indicators By: Nicolas Created: November 9, 2017, 2:35 PM
November 9, 2017, 2:35 PM
Indicators
5 Comments
MACD RSI Adaptive

Just a simple MACD (Moving Aveage Convergence Divergence) indicator made of RSI, but this time with adaptive period for the moving averages.

As usual, you can play with settings to find your best parameters to your own trading style.

Converted from a MQL4 version to prorealtime, by a request in the Spanish forum.

 

//PRC_MACD_RSI_Adaptive | indicator
//09.11.2017
//Nicolas @ www.prorealcode.com
//Sharing ProRealTime knowledge
//translated from MQL4 code

// --- settings 
//FastPeriod      = 14
//SlowPeriod      = 34
//SignalPeriod    =  9
//SignalMethod    = 1 //moving average type (1=EMA)
//RsiPeriod       = 14
// --- end of settings 

rrsi = rsi[RsiPeriod](close)
price = average[1](close)

if barindex>SlowPeriod then 
 //fastRema
 RSvoltl=abs(rrsi-50)+1.0
 multi=(5.0+100.0/rsiPeriod)/(0.06+0.92*RSvoltl+0.02*square(RSvoltl))
 fastalpha   = 2.0 /(1.0+multi*FastPeriod)
 fastRema = fastRema[1]+fastalpha*(price-fastRema[1])

 //slowRema
 slowalpha   = 2.0 /(1.0+multi*SlowPeriod)
 SlowRema = SlowRema[1]+slowalpha*(price-SlowRema[1])

 mmacd = fastRema-SlowRema
 signal = average[SignalPeriod,SignalMethod](mmacd)

 if signal>signal[1] then 
  r=50
  g=205
  b=50
 else
  r=255
  g=140
  b=0
 endif
endif


return mmacd coloured(100,100,100,100) style(histogram,1), mmacd coloured(192,192,192) style(line,3) , signal coloured(r,g,b) style(line,3)

 

Download
Filename: PRC_MACD_RSI_Adaptive.itf
Downloads: 486
Nicolas
Nicolas Legend
I created ProRealCode because I believe in the power of shared knowledge. I spend my time coding new tools and helping members solve complex problems. If you are stuck on a code or need a fresh perspective on a strategy, I am always willing to help. Welcome to the community!
Author’s Profile

Comments

Edelmiro
2 years ago
#

Un millón... de gracias... me gustaría más, poder ofrecer euros; pero va a ser que no puedo, así que: gracias gracias gracias

Rory Dryden
5 years ago
#

Thanks. This looks useful.

Marc Boliart
9 years ago
#

dear nicolas, tyvm for your indicators and strategies, i have this following error when i charge in my PRT v10.2: https://postimg.org/image/u15gsxpdz/ ... what I have to do? tyvm again

Nicolas
9 years ago
#

Your picture is too small, but for sure the problem is about the fact you are still using v10.2 and this indicator need the new graphical instructions of 10.3 version. Try to delete everything in the code about "style", replace the RETURN line with this one instead: return mmacd coloured(100,100,100), signal coloured(r,g,b)

juanj
9 years ago
#

Definitely, need to code this into an automated strategy.

ProRealCode ProRealCode
Loading...