Login Page - Create Account

Support Board


Date/Time: Tue, 18 Nov 2025 04:33:31 +0000



[Programming Help] - how to draw a line in the middle of a candle body but only when CLOSE > OPEN

View Count: 172

[2025-09-28 00:54:37]
User873130 - Posts: 52
based on this code that someone shared

(MAX(O,C)-MIN(O,C))/2+MIN(O,C)

How can I use this so that it only shows up when the candle CLOSE > OPEN (only bullish candles)
[2025-09-28 13:12:33]
Sawtooth - Posts: 4288
how to draw a line in the middle of a candle body but only when CLOSE > OPEN
Try this:
Add the Spreadsheet Formula study,
- Set the Chart Region to 1.
- Set 'Draw Zero Values' to No.
- Use this formula in its Formula field:
=IF(C>O,(MAX(O,C)-MIN(O,C))/2+MIN(O,C),0)
- Set the Draw Style to Dash.
[2025-09-29 12:30:57]
VolTrader73 - Posts: 139
Sawtoth.
Just for educational purpose ,

why not =IF C > O , (H-L)/2 + L ?
While being more simple, wouldn't it work for this specific task ?
[2025-09-29 14:22:08]
Sawtooth - Posts: 4288
why not =IF C > O , (H-L)/2 + L ?
This would put the line in the middle of the candle, not in the middle of the candle body.

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account