Simple average with visual color

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #121078 quote
    leofi
    Participant
    Junior

    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.

    #121079 quote
    leofi
    Participant
    Junior
    //-+------------------------------------------------------------------+-//
    // | 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"

    Skrochey:

    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.

    #121110 quote
    skrochey
    Participant
    New

    thks 🙂

    #121214 quote
    Nicolas
    Keymaster
    Master

    Thanks @leofi

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.

Simple average with visual color


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
leofi @leofi Participant
Summary

This topic contains 3 replies,
has 3 voices, and was last updated by Nicolas
5 years, 11 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 03/03/2020
Status: Active
Attachments: No files
Logo Logo
Loading...