MQL4 Ayuda con Eventos

 

Hola!
Tengo un problema, resulta que necesito reemplazar una linea si es que se la borra manualmente. Entonces lo que se me ocurrió fue usar OnChartEvent para reponer la linea borrada. Por lo tanto tengo el siguiente código:

void OnChartEvent(const int id, const long& lparam, const double& dparam, const string& sparam)
{ 
   if(id == CHARTEVENT_OBJECT_DELETE)
   {
      if(StringFind(sparam, "LINE_", 0) != -1)
      {
         color Color = ObjectGet(sparam, OBJPROP_COLOR);
         int X1 = ObjectGet(sparam, OBJPROP_TIME1);
         int X2 = ObjectGet(sparam, OBJPROP_TIME2);
         double Y1 = ObjectGet(sparam, OBJPROP_PRICE1);
         double Y2 = ObjectGet(sparam, OBJPROP_PRICE2);
         int Style = ObjectGet(sparam, OBJPROP_STYLE);
         Alert(ObjectFind(sparam));
         Alert("color: " + ColorToString(Color) + "; x1: " + IntegerToString(X1) + "; x2: " + IntegerToString(X2) + "; y1: " + DoubleToStr(Y1) + "; y2: " + DoubleToStr(Y2) + "; style: " + IntegerToString(Style) + ";nombre: " + sparam);
         DrawLine(sparam, Color, X1, Y1, X2, Y2, Style);
      }
   }
}

El problema es que cuando intento obtener todos los datos de la linea borrada (color, time1, time2, price1, price2 y style) me devuelve todo 0, porque claro, la linea se borró y no puede obtener esos datos. Entonces quería saber si hay alguna manera de obtener esos datos o alguna otra forma de "reponer" la linea borrada manualmente (sin tener que preguntar en cada tick si existe la linea)

Muchas Gracias.

 

Muy buenas compañero.

¿Pusiste en el OnInit() la activación de la recepción del evento Object Delete??:

ChartSetInteger(0,CHART_EVENT_OBJECT_DELETE,true);


Un saludo.