CHART_BRING_TO_TOP property is not working

 

Dear all

I want to ask this code is not working in mql4

ChartSetInteger(chart_id, CHART_BRING_TO_TOP, true);

I don't know why ?

 
Trung Le Minh:

Dear all

I want to ask this code is not working in mql4

I don't know why ?

define not working?

show your code  and any error messages

 
Paul Anscombe:

define not working?

show your code  and any error messages


//+----------------------------------------------------------------------+
//| Send command to the terminal to display the chart above all others.  |
//+----------------------------------------------------------------------+
bool ChartBringToTop(const long chart_ID=0)
  {
//--- reset the error value
   ResetLastError();
//--- show the chart on top of all others
   if(!ChartSetInteger(chart_ID,CHART_BRING_TO_TOP,0,true))
     {
      //--- display the error message in Experts journal
      Print(__FUNCTION__+", Error Code = ",GetLastError());
      return(false);
     }
//--- successful execution
   return(true);
  }
ChartSetInteger(chart_ID, CHART_BRING_TO_TOP, 0, true) does not display the chart above all others although no error messages
 
Trung Le Minh:


Seems to me that you don't need the 3rd parameter. I don't know if it will make any difference though.

If I remember correctly, I think that this function will not always work if the charts are minimised.

 
Trung Le Minh:


the code works just fine, two thoughts:

1) are you sending the chart ID or 0 when calling the function like: ChartBringToTop(0) ?

2) are you running this when the market is closed? the chart will only redraw on a new tick, so if the market is closed you must force it with a ChartRedraw() after running the function

as I said it works fine.

 
Paul Anscombe:

the code works just fine, two thoughts:

1) are you sending the chart ID or 0 when calling the function like: ChartBringToTop(0) ?

2) are you running this when the market is closed? the chart will only redraw on a new tick, so if the market is closed you must force it with a ChartRedraw() after running the function

as I said it works fine.

Thank you, because I run code in closed market so I need ChartRedraw().

Thank a lot

Reason: