MACD normalized with its highest and lowest values over the last “inpNormPeriod”.
Classic settings of periods are available. This version embed a small lag smoothing function of the curves for a better reading.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
//PRC_Smoothed & Normalized MACD | indicator //16.10.2018 //Nicolas @ www.prorealcode.com //Sharing ProRealTime knowledge //converted from MT5 version // --- settings inpFastPeriod = 12 // MACD fast period inpSlowPeriod = 26 // MACD slow period inpMacdSignal = 9 // Signal period inpSmoothPeriod = 5 // Smoothing period inpNormPeriod = 20 // Normalization period // --- end of settings price = customclose if barindex>inpslowperiod then alphaf = 2.0/(1.0+Max(inpFastPeriod,1)) alphas = 2.0/(1.0+Max(inpSlowPeriod,1)) alphasig = 2.0/(1.0+Max(inpMacdSignal,1)) alphasm = 2.0/(1.0+Max(inpSmoothPeriod,1)) emaf = emaf[1]+alphaf*(price-emaf[1]) emas = emas[1]+alphas*(price-emas[1]) imacd = emaf-emas mmax = Highest[inpNormPeriod](imacd) mmin = Lowest[inpNormPeriod](imacd) if mmin<>mmax then nval = 2.0*(imacd-mmin)/(mmax-mmin)-1.0 else nval = 0 endif val = val[1] + alphasm*(nval-val[1]) sig = sig[1] + alphasig*(val-sig[1]) endif //colours if val>val[1] then valr=30 valv=144 valb=255 elsif val<val[1] then valr=244 valv=164 valb=96 endif if sig>val then sigr=244 sigv=164 sigb=96 else sigr=30 sigv=144 sigb=255 endif return val coloured(valr,valv,valb) style(line,3) as "reg smooth MACD", sig coloured(sigr,sigv,sigb) style(dottedline) as "signal line", 0 coloured(169,169,169) style(dottedline) |
Share this
No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.
ProRealTime ITF files and other attachments :
Filename : download the ITF files
How to import ITF files into ProRealTime platform?
PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials
Merci pour ce super indicateur. Comment puis-je mettre une alerte dès changement dès croisement de la MACD ou de changement de tendance ?