MACD RSI Adaptive

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

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: 484
Nicolas Master
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

Logo Logo
Loading...