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

Back to topics list To post a new topic, please log in or register
avatar
106
4x_Gypsy 2016.01.13 10:18
 

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.

avatar
736
honest_knave 2016.01.13 10:26 #
 

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.

avatar
106
4x_Gypsy 2016.01.13 10:54 #
 
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
avatar
736
honest_knave 2016.01.13 11:10 #
 

I just dropped this script on a chart:

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

 

And ended up with this:

 

avatar
106
4x_Gypsy 2016.01.13 11:14 #
 
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? 

avatar
736
honest_knave 2016.01.13 11:22 #
 
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);
  }

 

avatar
106
4x_Gypsy 2016.01.13 11:25 #
 
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.

avatar
106
4x_Gypsy 2016.01.13 11:40 #
 

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 


avatar
736
honest_knave 2016.01.13 16:05 #
 
Likewise, glad you got it sorted
Back to topics list  

To add comments, please log in or register