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.
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);
JSParticipant
Senior
Hi @anilkc
Try this one…
// Calculate the range and body size
xRange = Range
xBodySize = abs(open - close)
// Check if the body is less than 50% of the range
if xBodySize < (xRange * 0.5) then
DrawCandle(Open,High,Low,Close)Coloured("Yellow") // Change the color to yellow for the base candle
EndIf
Return
This is great. Thank you so much. It works perfectly.