Forums>EA Wizard>General Discussion>Chart Color
Hi all,
Is it possible to change the background color of a chart ?
Regards
John
- This topic was modified 4 months, 4 weeks ago by
JS17.
//+——————————————————————+
//| The function receives chart background color. |
//+——————————————————————+
color ChartBackColorGet(const long chart_ID=0)
{
//— prepare the variable to receive the color
long result=clrNONE;
//— reset the error value
ResetLastError();
//— receive chart background color
if(!ChartGetInteger(chart_ID,CHART_COLOR_BACKGROUND,0,result))
{
//— display the error message in Experts journal
Print(__FUNCTION__+”, Error Code = “,GetLastError());
}
//— return the value of the chart property
return((color)result);
}
//+——————————————————————+
//| 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);
}Put this at the very end of: “EA Wizard / code / CustomFunctions.mq4″
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);
}Add this line of code after the OrderSend function ends:
if(OP_BUY){ChartBackColorSet(Green, 0);}
if(OP_SELL){ChartBackColorSet(Red, 0);}
Im sure you will understand, good luck.
Karish
Thanks again for your help
But your faith in my abilities are not well placed – lol
I created a simple EA to test this and used CustomAction inside EA Wizard to change the background color to red if the EA closed all positions on equity target
When I complied it the editor showed 7 errror messages
I have attached the EA if you can help?
Regards
John
Attachments:
You must be logged in to view attached files.This is the sqw file, just change the file extension back to .sqw and it should be OK
- This reply was modified 4 months, 3 weeks ago by
JS17.
- This topic was modified 4 months, 4 weeks ago by
You must be logged in to reply to this topic.