Is there a way to program color changes on the chart?

 

I have searched google and the MQL's but I cant find any examples on how to change the colors of the axis, scale, etc.

I would like to cahnge the according what order is open.

red for sell,green for buy,blue for no orders.

 

You need to use:

ChartSetInteger(0,CHART_COLOR_FOREGROUND, myColor);

 Run a loop through your open orders, figure out what color you want the axes to be, then set the color using the above code.

 
honest_knave:

You need to use:

 Run a loop through your open orders, figure out what color you want the axes to be, then set the color using the above code.

i tried that but it only changed the foreground colors on the chart. i wish to change the color of the price scale, axis, period separators,etc just like i can do in the options menu
 

I just dropped this script on a chart:

void OnStart()
  {
   ChartSetInteger(0,CHART_COLOR_FOREGROUND, clrPink);
  }

 

And ended up with this:

 

 
honest_knave:

I just dropped this script on a chart:

 

And ended up with this:

 

hmmm i am not getting it to do that. 

i am trying to use this in a ea, would that matter? 

 
4x_Gypsy:

hmmm i am not getting it to do that. 

i am trying to use this in a ea, would that matter? 

Shouldn't do. I just dropped this EA onto a chart with the same effect

void OnTick()
  {
   ChartSetInteger(0,CHART_COLOR_FOREGROUND, clrPink);
  }
 
honest_knave:

Shouldn't do. I just dropped this EA onto a chart with the same effect

 

i have got it running through a loop under ontick. i place the trades with a button, ea doesnt make any trades at all it is a manual assistant.

if i take ChartSetInteger(0,CHART_COLOR_FOREGROUND,clrBlue); out of the loop it works fine but in the loop it doesnt.

 

got it fixed.

i put ChartSetInteger(0,CHART_COLOR_FOREGROUND,clrGreen) in the  buy function and so on, it works great.

But it still will not work in a loop, 

Thank you for you're guidance.

Have a wonderful and profitable day 

 
Likewise, glad you got it sorted
Reason: