Nicolas

MACD histogram color

Category: Indicators By: Nicolas Created: April 3, 2017, 12:48 PM
April 3, 2017, 12:48 PM
Indicators
4 Comments
MACD histogram color

The MACD color histogram indicator is the classic MACD but with histogram coloured according to their directions : converging or diverging.

This indicator has been coded by a request on French forum.

The colours could modified by changing the Red, Green and Blue values in the code.

MACD settings are external variables and may be changed according to your needs.

//PRC_MACD color histogram | indicator
//03.04.2017
//Nicolas @ www.prorealcode.com
//Sharing ProRealTime knowledge
//translated from MT4 code

// --- settings
//fast = 12
//slow = 26
//signalP = 9
// --- end of settings

myMACD=exponentialaverage[fast]-exponentialaverage[slow]
signal=exponentialaverage[signalP](myMACD)

if myMACD>0 then
 if myMACD>myMACD[1] then
  r=0
  g=100
  b=0
 else
  r=255
  g=69
  b=0
 endif
else
 if myMACD>myMACD[1] then
  r=50
  g=205
  b=50
 else
  r=255
  g=0
  b=0
 endif
endif


RETURN myMACD coloured(r,g,b) style(histogram) as "MACD histogram", signal coloured(255,0,255) style(line,2) as "signal line", myMACD coloured(0,255,255) style(line) as "MACD line"

 

Download
Filename: PRC_MACD-color-histogram.itf
Downloads: 304
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

Helgart
3 years ago
#

Hi, it's great to have this option of having a histogram coloured based on rising or falling slope... but i have the same question as leo above from 6 years ago... this macd has very very different signals from the standard macd ??? Would be great if someone could clarify how to get this to behave the same way as the standard macd. Merci beaucoup :-)

leofib
8 years ago
#

Hello, I was looking for a MACD Histogram with red and green bars according to the value of the previous bar and not only if above/below zero, thus I installed your version on Prorealtime. However it behaves completely different from the normal MACD.installed your MACD but it behaves completely different form the plain MACD. Can you help?

Aporio
9 years ago
#

Nicolás, como puedo cambiar los colores porque para el histrograma quiero que sean más claros y para el macd quiero colores más intensos y líneas más gruesas. Saludos Luis

Nicolas
9 years ago
#

Para cambiar los colores del histograma, deben usarse las variables r, gyb entre las líneas 18 y 34. Esto corresponde a los valores rojo, verde y azul de cada histograma.

ProRealCode ProRealCode
Loading...