Color vela por indicador MAS

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #89394 quote
    Carlos Garcia
    Participant
    Veteran

    Buenos días. A ver si me podéis ayudar, por favor. Busco un nuevo indicador que cambie el color de vela en el gráfico del precio marcado por el indicador Moving Average Slope (MAS). Si el MAS es mayor de 0 la vela sería del color del MAS correspondiente. Y al revés por debajo de 0.

    Mil gracias, de verdad.

    // ------------------------------
    // Moving Average Slope
    // Author: Maz @ prorealcode.com
    // ------------------------------
    
    // maPeriod = 200 // Moving Average Period
    // maType   = 1   // Moving Average function - 1: exponential
    
    ma = average[maPeriod, maType](customClose)
    slope = ma - ma[1]
    
    // -- Colour management -----
    if slope > 0 then
    if slope > slope[1] then
    g = 255
    r = 0
    elsif slope < slope[1] then
    g = 200
    r = 0
    endif
    elsif slope < 0 then
    if slope < slope[1] then
    r = 255
    g = 0
    elsif slope > slope[1] then
    r = 200
    g = 0
    endif
    endif
    
    return slope coloured(r, g, 10) style(histogram, 1) as "Moving Average Slope"
    #89401 quote
    robertogozzi
    Moderator
    Master

    Hecho:

    // ------------------------------
    // Moving Average Slope
    // Author: Maz @ prorealcode.com
    // ------------------------------
     
    maPeriod = 200 // Moving Average Period
    maType   = 1   // Moving Average function - 1: exponential
     
    ma = average[maPeriod, maType](customClose)
    slope = ma - ma[1]
    b = 0
    // -- Colour management -----
    if slope > 0 then
       if slope > slope[1] then
          g = 255
          r = 0
       elsif slope < slope[1] then
          g = 200
          r = 0
       endif
    elsif slope < 0 then
       if slope < slope[1] then
          r = 255
          g = 0
       elsif slope > slope[1] then
          r = 200
          g = 0
       endif
    endif
    DRAWCANDLE(open,high,low,close) COLOURED(r,g,b,255) BORDERCOLOR(r,g,b,255)
    return// slope coloured(r, g, 10) style(histogram, 1) as "Moving Average Slope"
    Carlos Garcia thanked this post
    #89405 quote
    Carlos Garcia
    Participant
    Veteran

    Absolutamente fantástico Roberto. Eres el mejor.

    Grazie mille!! 🙂

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

Color vela por indicador MAS


ProBuilder: Indicadores y Herramientas

New Reply
Author
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by Carlos Garcia
7 years ago.

Topic Details
Forum: ProBuilder: Indicadores y Herramientas
Language: Spanish
Started: 01/23/2019
Status: Active
Attachments: 1 files
Logo Logo
Loading...