MACD histogram color

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

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: 298
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...