How to make objects drawn by XY change smoothly (MT4 vs MT5) - page 10

 
Vitaliy Kuznetsov:

Thank you, good template, it will come in handy. Very much and interesting to learn from your workings.

Dmitry, I still consider you a programmer capable of demonstrating high skill.

And if there are suggestions code, constructive thoughts, with pleasure (and not only I) would adopt your experience.

P.S. It is better to see the code once, than to hear about it 100 times.

Yep, lined up, standing in line, holding at arm's length... Code for what?

 
Nikolai Semko:

I doubt it can be done in freelancing. Those who can do it are overloaded with work up to their ears, and those who are free are probably not as good at kanvas as you are.

That's why I don't like objects, as they have their own life in their flows, over which you have no control. With kanvas, on the contrary, everything is in your hands. That's why I have to write additional code for the tester with canvas not to slow down when calculating frames at each tick more than 30 times per second.
Also, working with TFs and history loading is very unreasonable and inefficient in MT5. Only M1 are loaded, and in an unpacked form, while others are only calculated from M1. Therefore, if you enable MN1 for the first time, 100 bars will take more than 10 seconds to load. I had to write the bar load myself and convert M1 to packed form and have all calculated TFs in memory. All my TFs together with M1 take up a fraction of the space in RAM than just the regular M1 in MT5.

Is this a penance, or a delight?

 
Алексей Тарабанов:

Is it repentance, or rapture?

You see, it's the other way around. You create a program - it's a world that lives by your laws. You make something object-oriented: you spawn something like an amoeba, or cooler, living on its own.

 
Алексей Тарабанов:

Is this repentance, or rapture?

This is nonsense based on an inadequate ego. And very far from the realities of working in MT5.

 
Nikolai Semko:

Well first, fix your indicator with objects according to this algorithm I gave you.

Nikolay, if it is not difficult, what are your thoughts on the fact that the fixed indicator shifts over time in the tester. If you try to change the scale with the mouse, it's fixed.

It's the same with kanvas. Either the chart is not shifted or it is shifted incorrectly (after some time), until you manually change the chart scale. The calculations and alerts themselves are correct, but the graphics...

Surely there must be a solution, which I can't see. Or maybe it's something wrong in the tester?

 
Vitaliy Kuznetsov:

Nikolai, if you don't mind, what are your thoughts on the corrected indicator shifting over time in the tester. If you try to change the scale with the mouse, it is corrected.

The same is with kanvas. Either the chart is not shifted or it is shifted incorrectly (after some time), until you manually change the chart scale. The calculations and alerts themselves are correct, but the graphics...

Surely there must be a solution, which I can't see. Or maybe there is something wrong in the tester?

I add a line in OnChartEvent

if (id == CHARTEVENT_CHART_CHANGE ) Draw (); 
monitoring a chart change event (a new bar is also a chart change event)
  • I add to OnCalculate for tester mode a line for redrawing e.g. when a new bar comes, as OnChartEvent does not work in the tester:
     if(rate_total != prev_calculated ) if (Canvas.tester) {ChartChanged (); Draw ();}
  • If it does not work in MT4, it means that there is something wrong with CHARTEVENT_CHART_CHANGE event. I cannot check it now, there are no quotes yet.



     
    Nikolai Semko:

    Thanks for the tip. Haven't gotten around to it yet, I'll try it today

    Reason: