MA trend colored

Category: Indicators By: Nicolas Created: November 21, 2018, 2:56 PM
November 21, 2018, 2:56 PM
Indicators
5 Comments

Simple indicator that color the candlesticks according to:

  • the trend direction, based on 2 moving averages (period and type can be modified)
  • the slope of the faster moving average, if it declines in a bullish trend or ascend in a bearish trend

Coded because of a request in the ProBuilder forum.

//PRC_TrendColored | indicator
//21.11.2018
//Nicolas @ www.prorealcode.com
//Sharing ProRealTime knowledge

// --- settings 
period1 = 10
MA1type = 2
period2 = 50
MA2type= 2
// --- end of settings 

avg1 = average[period1,MA1type]
avg2 = average[period2,MA2type]

if avg1>avg2 then 
 r=0
 g=255
 b=0
 if avg1<avg1[1] then 
  r=0
  g=128
  b=0
 endif
elsif avg1<avg2 then 
 r=255
 g=0
 b=0
 if avg1>avg1[1] then 
  r=255
  g=99
  b=71
 endif
endif

drawcandle(open,high,low,close) coloured(r,g,b)

return

 

Download
Filename: PRC_TrendColored.itf
Downloads: 370
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...