How to set candle color according to supertrend's trend

 

Hello, everyone.

I have a supertrend indicator.
I want to set candle color according to supertrend's trend like attached image.
could you help me?

Thanks.

MQL5.community - User Memo
MQL5.community - User Memo
  • www.mql5.com
You have just registered and most likely you have questions such as, "How do I insert a picture to my a message?" "How do I format my MQL5 source code?" "Where are my personal messages kept?" You may have many other questions. In this article, we have prepared some hands-on tips that will help you get accustomed in MQL5.community and take full advantage of its available features.
 
Your topic has been moved to the section: Technical Indicators
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
 

If you need help with your code, then please show your earnest attempt, explaining what exactly you are having difficulty with.

If you don't know how to code it, then please consider the Freelance section — https://www.mql5.com/en/job

EDIT: There are examples in the CodeBase on how to change the candle colours according to different conditions. Here are some, but please search 🔍 for more.

Code Base

Change the color of the candles

Kourosh Davallou, 2012.12.06 13:12

The indicator that allows modifying color of the candles.

Code Base

MACD Crossing the zero level (color candles)

Vladimir Karputov, 2018.01.22 09:20

Color candlesticks display areas, in which the MACD indicator crosses the zero line.

Code Base

Decision Colored Candles - MT5

Mohamed Hassan Mohamed Hassan Alsherbiny, 2024.07.22 19:29

higher confidence to get into trade
 
depends if you want to change the default candle chart colors, or if you want to overlay new candles
 
@Conor Mcnamara #: depends if you want to change the default candle chart colors, or if you want to overlay new candles

That is incorrect. You cannot programmatically change the colour of individual default candles. You can only "overlay" custom candles.

You can however change the global colours of ALL the default candles, but that is not what the OP is requesting.

 
Fernando Carreiro #:

That is incorrect. You cannot programmatically change the colour of individual default candles. You can only "overlay" custom candles.

You can however change the global colours of ALL the default candles, but that is not what the OP is requesting.

oh yes, apologies

@OP I think it's wise to use the article section https://www.mql5.com/en/articles/7815

People went to the trouble of writing these articles, you may as well go through them, and there is a lot of good content there

Exploring options for creating multicolored candlesticks
Exploring options for creating multicolored candlesticks
  • www.mql5.com
In this article I will address the possibilities of creating customized indicators with candlesticks, pointing out their advantages and disadvantages.
 
You can also look at the hekin ashi indicator's code.
 

Hi

I agree with William Roeder – it’s a good solution to work on some available code which is working correctly and change them to your idea.

This way you can simply change conditions to detect super trend values and color candles just like the heiken ashi is working.

Have a nice day👍📊