Hi all.
Simple trend indicator based on moving average, define your moving average parameter and watch the result. You can apply in on the price chart or below it to get the trend direction or pullback infos quickly.
green = fast moving average> normal and normal> slow.
red = fast moving average <normal and normal <slow.
yellow = green or red is not correct.
//-+------------------------------------------------------------------+-//
// | Description: Trend average indicator | //
// | Author: Tom's - Leofi | //
// | Last update: 03.03.20 | //
//-+------------------------------------------------------------------+-//
//-+------------------------------------------------------------------+-//
// | Variable Setup | //
//-+------------------------------------------------------------------+-//
//-> RGB Background color positive trend (light pastel green)
upR = 207
upG = 240
upB = 204
//-> RGB Background color negative trend (light pink)
downR = 252
downG = 192
downB = 203
//-> Setting period moving average slow and fast
slowMovingAverage = 200
fastMovingAverage = 20
//-> Setting type moving average
typeMovingAverage = 1
//-+------------------------------------------------------------------+-//
// | Logic | //
//-+------------------------------------------------------------------+-//
emaslowMovingAverage = average[slowMovingAverage, typeMovingAverage](close)
emafastMovingAverage = average[fastMovingAverage, typeMovingAverage](close)
IF (emafastMovingAverage > emaslowMovingAverage) THEN
backgroundColor(upR, upG, upB)
ELSIF (emafastMovingAverage < emaslowMovingAverage) THEN
backgroundColor(downR, downG, downB)
ENDIF
RETURN emafastMovingAverage coloured(200, 200, 200) STYLE(line, 2) AS "Moving Average Fast", emaslowMovingAverage coloured(0, 0, 0) STYLE(line, 2) AS "Moving Average Slow"
Is there some way whereby this indicator can be simplified by just having two imputs.? Imput 1: Fast MA. Imput 2: Slow MA. The background of the chart appears in light pastel GREEN when the Fast MA is above the Slow MA indicating a positive trend. When the Fast MA is below the Slow MA, the Background of the Chart turns LIGHT PINK indicating negative. The settings of the MA can be adjusted to the Period as well as the type of MA.