if you want to change a single bar you have to use objects for that
to change the entire chart use ChartSetInteger ENUM_CHART_PROPERTY_INTEGER:
Chart background color |
color |
|
Color of axes, scales and OHLC line |
color |
|
Grid color |
color |
|
Color of volumes and order opening levels |
color |
|
Color for the up bar, shadows and body borders of bull candlesticks |
color |
|
Color for the down bar, shadows and body borders of bear candlesticks |
color |
|
Line chart color and color of "Doji" Japanese candlesticks |
color |
|
Body color of a bull candlestick |
color |
|
Body color of a bear candlestick |
color |
|
Bid price level color |
color |
|
Ask price level color |
color |
|
Line color of the last executed deal price (Last) |
Thank you for your answer. I wanna change entire chart, but i dont understand how to use this ChartSetInterger with my conditions. Can you write a simple code with my example?
RSI >50, bar is red. RSI < 50 bar is blue
complex ? why ?
it's so simple MQ already done the dirty work for you just pick the right function put it in your EA/indicator/Script
the only thing they left for you, is to call the right function when you want or need it
for instance if for some reason i want to change the background color to blue i copy the fonction to my EA/Ind......
//+------------------------------------------------------------------+ //| The function sets chart background color. | //+------------------------------------------------------------------+ bool ChartBackColorSet(const color clr,const long chart_ID=0) { //--- reset the error value ResetLastError(); //--- set the chart background color if(!ChartSetInteger(chart_ID,CHART_COLOR_BACKGROUND,clr)) { //--- display the error message in Experts journal Print(__FUNCTION__+", Error Code = ",GetLastError()); return(false); } //--- successful execution return(true); }
and i call it whenever i want
if (Bla Bla Bla) ChartBackColorSet(clrBlue);

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Dear all,
I want change color of bar chart like Heiken Ashi indicator. Can anyone help me this code?
For example: when RSI > 50 Bar color is red, RSI < 50 bar is blue.
Thank you!