
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
1009 Objects exactly. Performance is really no criteria.
Names - write a simple function that creates random names by increasing a number. Use classes, not native ObjectCreate().
Loop - Yes and No. If you use the MQL5 standard lib, yes, but these libs are simply programmed very bad. Create 20 objects, just move the mouse and watch the CPU - nothing more to say. There you are right, yes. But if you use Objects in classes and organize them proper in containers by a hierarchic model, you won´t have any performance problems at all. But of course, you have to develop your own control class library.
MQL5 is absolutely awesome, but highly underestimated.
The biggest brake, by the way, is ChartUpdate(). Some objects require to update the chart, especially bitmap objects. If you update the chart after every change, and you have 200-300 objects, you can go out and have lunch while it´s updating. This function must really be handled with care.
Edit: ChartRedraw() not ChartUpdate(). Sorry.
The biggest brake, by the way, is ChartUpdate(). Some objects require to update the chart, especially bitmap objects. If you update the chart after every change, and you have 200-300 objects, you can go out and have lunch while it´s updating. This function must really be handled with care.
Sorry, but probably no again ;) It gets not accumulated, at least its usually not done that way by other CGIs I met in the past. Normally, when bitmaps are created in memory, the are created on a screen layer with an alpha channel either in CPU RAM (I suspect this option in MQL) or in GPU RAM (faster). When ChartRedraw() is used, this overlay gets flashed for one time to the main GPU buffer which is RGB and it makes no difference, if there are 1000 objects or one. To avoid a delay and lack of performance, you must not call ChartRedraw() multiple times, instead call it only one time. The growth of performance is drastically with this simple trick and thats why I assume that MQL does this this usual way too.
I implemented this in my graphical libraries by a nested "Freeze"-functionality. As long "Freeze" is activated, no chart updates get through. And due to hierarchic organization within regions plus time-based filters for visual outputs (the eye cannot capture more than 15-18 updates per second) there is a graphical performance that you won't except with MQL - but impossible to achieve with the standard control classes, yes. And this is also not an invention of me, its also just kind of normal for optimized graphical engines. I deal <>50% with such vector based bitmaps.
Thank you for this generous explanation I will try to make an example that addresses the same idea but with both method
What exactly are you planning to do? Maybe I have something ready which you may try to use.
int style=EMPTY,
color clr=clrNONE
);
for(int i = 0; i <limit; i++)
{
string histogram = StringConcatenate("histogram",i);
ObjectCreate(histogram,OBJ_TREND,Index,Time[i],iMA(NULL,0,50,0,MODE_EMA,PRICE_CLOSE,i));
ObjectSet(histogram,OBJPROP_COLOR,Green);
ObjectSet(histogram,OBJPROP_WIDTH,2);
WindowRedraw();
}