Download MetaTrader 5

chartevent

To add comments, please log in or register
kuolung1967
43
kuolung1967  

i write some chartevent for redraw some object in chartwindow


but in debug mode if i insert a break point in chartevent function , it can gatch everone event


if i clear the break point , some event will lose


what can i do to fix it

Marco vd Heijden
Moderator
5564
Marco vd Heijden  

write some more code.

kuolung1967
43
kuolung1967  
Marco vd Heijden:

write some more code.

i write in indicator code :


void OnChartEvent(const int id,
                  const long &lparam,
                  const double &dparam,
                  const string &sparam)
{
   int i;
   int nbars;
   int bars_count;
   int bar;
   int iprice;
   double   dWHigh;
   double   dPixelToPriceRatio;
  
   if (id == CHARTEVENT_CHART_CHANGE)
   {
      DeleteAll();


      bars_count=WindowBarsPerChart();
      bar=WindowFirstVisibleBar();
      if (bars != Bars) {
         nbars = Bars;
         ArrayResize(ddate,bars);
         ArrayResize(dlow,bars);
         ArrayResize(dhigh,bars);
      }
      i = 9;
   } else if (id == CHARTEVENT_KEYDOWN) {
      i = 0;
   } else if (id == CHARTEVENT_MOUSE_MOVE) {
      i = 1;
   } else if (id == CHARTEVENT_OBJECT_CREATE) {
      i = 2;
   } else if (id == CHARTEVENT_OBJECT_CHANGE) {
      i = 3;
   } else if (id == CHARTEVENT_OBJECT_DELETE) {
      i = 4;
   } else if (id == CHARTEVENT_CLICK) {
      i = 5;
   } else if (id == CHARTEVENT_OBJECT_CLICK) {
      i = 6;
   } else if (id == CHARTEVENT_OBJECT_DRAG) {
      i = 7;
   } else if (id == CHARTEVENT_OBJECT_ENDEDIT) {
      i = 8;
   } else if (id == CHARTEVENT_CHART_CHANGE) {
      i = 9;
   } else if (id == CHARTEVENT_CUSTOM) {
      i = 10;
   } else if (id == CHARTEVENT_CUSTOM_LAST) {
      i = 11;
   }
}


i can't get the chartevent_chart_change  every time

Marco vd Heijden
Moderator
5564
Marco vd Heijden  

I always use

CHART_WIDTH_IN_PIXELS
CHART_HEIGHT_IN_PIXELS
For chart change.
kuolung1967
43
kuolung1967  

but , when the mouse scroll up or down , I can't recivi the mouse event or chartevent

ps i set the mousmove event to true , still can't recive the chartevent

Kaleem Haider
132847
Kaleem Haider  
kuolung1967:

but , when the mouse scroll up or down , I can't recivi the mouse event or chartevent

ps i set the mousmove event to true , still can't recive the chartevent


you should get CHART_CHART_CHANGE event on mouse scroll. id=9,lparam=0,dparam=0, sparam=""

To add comments, please log in or register