Subscription to OnBookEvent sometimes falls off - is there such a thing? - page 8

 
fxsaber:

And you can also automate gutting of paid Market products - in free demo mode rip out all resources (icons, cursors, etc.). With alpha-channels and stuff.

You can. And you can also stop freaking out and think: why does an event have to have an ending.

 
A100:

I don't believe it! - It's written that everything in the Market is secure

I suspect it's imported in-house)

 
A100:

I don't believe it! - It's written that everything is securely protected in the Market

I can't tell if this is serious or sarcasm. If seriously, ResourceSave is the head of everything.

But you can do it this way.

Forum on trading, automated trading systems and trading strategies testing

Features of mql5 language, subtleties and tricks

fxsaber, 2017.10.31 08:11

// Сохранение Bitmap-объекта в bmp/gif/png-файле (прозрачность не учитывается)
bool BitmapObjectToFile( const long chartID, const string ObjName, const string FileName, const bool FullImage = false )
{  
  const ENUM_OBJECT Type = (ENUM_OBJECT)ObjectGetInteger(chartID, ObjName, OBJPROP_TYPE);  
  bool Res = (Type == OBJ_BITMAP_LABEL) || (Type == OBJ_BITMAP);
             
  if (Res)
  {
    const string Name = __FUNCTION__ + (string)MathRand();

    ObjectCreate(chartID, Name, OBJ_CHART, 0, 0, 0);
    ObjectSetInteger(chartID, Name, OBJPROP_XDISTANCE, -1 e3);
    
    const long chart = ObjectGetInteger(chartID, Name, OBJPROP_CHART_ID);
        
    Res = ChartSetInteger(chart, CHART_SHOW, false) && ObjectCreate(chart, Name, OBJ_BITMAP_LABEL, 0, 0, 0) &&
          ObjectSetString(chart, Name, OBJPROP_BMPFILE, ObjectGetString(chartID, ObjName, OBJPROP_BMPFILE)) &&
          (FullImage || (ObjectSetInteger(chart, Name, OBJPROP_XSIZE, ObjectGetInteger(chartID, ObjName, OBJPROP_XSIZE)) &&
                         ObjectSetInteger(chart, Name, OBJPROP_YSIZE, ObjectGetInteger(chartID, ObjName, OBJPROP_YSIZE)) &&
                         ObjectSetInteger(chart, Name, OBJPROP_XOFFSET, ObjectGetInteger(chartID, ObjName, OBJPROP_XOFFSET)) &&
                         ObjectSetInteger(chart, Name, OBJPROP_YOFFSET, ObjectGetInteger(chartID, ObjName, OBJPROP_YOFFSET)))) &&
                         ChartScreenShot(chart, FileName, (int)ObjectGetInteger(chart, Name, OBJPROP_XSIZE),
                                                          (int)ObjectGetInteger(chart, Name, OBJPROP_YSIZE));
    ObjectDelete(chartID, Name);
  }                    

  return(Res);
}


Application

// Сохраняет в png-файлах все Bitmap-объекты текущего чарта
void OnStart()
{  
  for (int i = ObjectsTotal(0) - 1; i >= 0; i--)
  {
    const string Name = ObjectName(0, i);
    
    BitmapObjectToFile(0, Name, (string)ChartID() + "\\" + Name + ".png");    
  }      
}


ZZY Also a BMP->GIF/PNG file converter is implemented.

 
A100:

Where do you make the changes? In MetaTrader or in the documentation... e.g.

For wide events OnChartEvent is written more specifically: Sending event messages to all mql5 programs on the chart (i.e. the subscription unit is the chart)

Which in fact is what happens

Maybe they will add the CheckBookEventCount() function

It means that if counter is higher than 1, we don't call unsubscribe

 
prostotrader:

Maybe add CheckBookEventCount() function

I.e. if the count is greater than 1, we don't call delete subscription

Why not?

Questions remain though:

  • Which function will decrease the counter?
  • Which one will close the cup?

If we put everything on MarketBookRelease then why CheckBookEventCount and why us with our counter check?

 

In general, if the unit of broadband subscription is a graph, then you could do nothing at all by organising an inter-program subscription counter\subscription based on a global variable with a name like this:

string GVName( string symbol ) { return IntegerToString(ChartID()) + ":" + symbol; }

by tacit agreement

 
A100:
in your sandbox, yes. any external code tied to the glass is likely to break you.
 
prostotrader:

Well, as expected, you're wrong.

I can be wrong, but not in this case. I wish you'd read others' posts more carefully. It has been repeated several times what the problem is, and to no avail...

 
fxsaber:

Init and Deinit are not part of the subscription. Perhaps this circumstance will help.

No, it does not matter. Even if we refer to the problem of unpredictable sequence of OnInit/OnDeinit calls at reloading of indicators, it will not disappear if we rely on creation/destruction of objects - there is the same paradox.

But once again, this sequence (in indicators) is not the source of error.

 
Stanislav Korotky:

I can be wrong, but not in this case. I wish you'd read others' posts more carefully. It has been repeated several times what the problem is, and to no avail...

Right, it's a good idea to read all the posts.

https://www.mql5.com/ru/forum/267154/page7#comment_8170755
Подписка на OnBookEvent иногда отваливается - есть такое?
Подписка на OnBookEvent иногда отваливается - есть такое?
  • 2018.07.24
  • www.mql5.com
После того как поплотнее занялся стаканом и повесил на чарты несколько экспертов и индикаторов, подписанных на OnBookEvent, обнаружил, что некоторы...
Reason: