Chart Color

16 replies

JS17

Customer, bbp_participant, community, 73 replies.

Visit profile

6 years ago #201596

Hi all,

Is it possible to change the background color of a chart ?

Regards

John

0

tomas262

Administrator, sq-ultimate, 2 replies.

Visit profile

6 years ago #201622

Hello,

do you mean MT chart background color? Right click on chart – select Properties and set the color

0

JS17

Customer, bbp_participant, community, 73 replies.

Visit profile

6 years ago #201630

Tomas,

Yes

Attachments:
You must be logged in to view attached files.

0

tomas262

Administrator, sq-ultimate, 2 replies.

Visit profile

6 years ago #201632

Did you mean you need to change bckgnd color from within the EA?

0

JS17

Customer, bbp_participant, community, 73 replies.

Visit profile

6 years ago #201633

Tomas

Yes please

 

0

Karish

Customer, bbp_participant, community, sq-ultimate, 444 replies.

Visit profile

6 years ago #201638

//+——————————————————————+
//| 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);
}

0

JS17

Customer, bbp_participant, community, 73 replies.

Visit profile

6 years ago #201639

Karish

Thanks for the reply but I don’t do any coding at all and I was hoping that it could be done using the EA Wizard

Thankyou

0

Karish

Customer, bbp_participant, community, sq-ultimate, 444 replies.

Visit profile

6 years ago #201641

Why would you like to have EA Wiz to change your MT4’s chart background color for, i have trouble to understand

0

JS17

Customer, bbp_participant, community, 73 replies.

Visit profile

6 years ago #201646

Karish

I want the background color different if I am in a different trade, Hedge/Buy/Sell etc

Regards

John

0

tomas262

Administrator, sq-ultimate, 2 replies.

Visit profile

6 years ago #201648

Hello,

you can copy the Karish’s code into EA Wizard / code / CustomFunctions.mq4 (at the end) and save

In EA WIzard you can reference these using “Custom Action” like

CustomAction(ChartBackColorSet(white,0));

It should work

 

0

Karish

Customer, bbp_participant, community, sq-ultimate, 444 replies.

Visit profile

6 years ago #201678

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.

0

JS17

Customer, bbp_participant, community, 73 replies.

Visit profile

6 years ago #201680

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.

0

JS17

Customer, bbp_participant, community, 73 replies.

Visit profile

6 years ago #201682

This is the sqw file, just change the file extension back to .sqw and it should be OK

0

JS17

Customer, bbp_participant, community, 73 replies.

Visit profile

6 years ago #201684

that did not work, I give up with that  lol

0

JS17

Customer, bbp_participant, community, 73 replies.

Visit profile

6 years ago #202118

Tomas

I don’t know were this post above should be ??????????????????, it must be an error

 

Have you looked at my background color file above yet ???

Regards

John

 

0

tomas262

Administrator, sq-ultimate, 2 replies.

Visit profile

6 years ago #202121

Hello,

you can simply do this. See file attached

You can use one of these codes https://docs.mql4.com/constants/objectconstants/webcolors

0

Viewing 15 replies - 1 through 15 (of 16 total)

1 2