How to change the colour of a base candle (body less than 50% of the range)?

Forums ProRealTime English forum ProRealTime platform support How to change the colour of a base candle (body less than 50% of the range)?

Viewing 4 posts - 1 through 4 (of 4 total)
  • #217460

    On my chart, all the candles are either shown in green or red. I want to distinguish the base candles (body less than 50% of the range) with a different colour. How can I do this in ProRealTime? I’m using version 1.1-1.8.0_202.

     

    #217462

    Here is the code I wrote to draw the base candle in yellow but I get an error message.

    // Define variables
    vars:
    Range(0), // Range of the candle
    BodySize(0), // Size of the candle body
    CandleColor(black); // Color of the candle (default)

    // Calculate the range and body size
    Range = high – low;
    BodySize = abs(open – close);

    // Check if the body is less than 50% of the range
    if BodySize < (Range * 0.5) then
    CandleColor = yellow; // Change the color to yellow for the base candle

    // Set the candle color
    PlotColor(1, CandleColor);

    #217471
    JS

    Hi @anilkc

    Try this one…

     

     

    #217473

    This is great. Thank you so much. It works perfectly.

    1 user thanked author for this post.
    avatar JS
Viewing 4 posts - 1 through 4 (of 4 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login