My approach. The core is the engine. - page 124
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
Because instead of OrderOpenPrice put OrderOpenTime()
Right. I mixed up. :)
I have to admit that I was a bit surprised by the test results.
That's why I wanted you to do everything yourself, not to give ready-made solutions, which are like peas against the wall.
I have heard of pointers to functions. But I have very few functions. It's because of this that I don't have space and need to use OOP.
I have a different development concept. I believe that the operation of holistic multi-function blocks is more efficient than that of large complexes of small functions.
More promising, from the point of view of mechanism development.
That's my opinion...
I have several big blocks. To apply OOP, they must be broken down into small functions, organize into classes, and then, use pointers and other things.
But I won't be able to do that. Simply because I think differently.
The concept of OOP does not coincide with the peculiarities of my way of thinking, and I can't expand in it. That's the reason.
Note, Nikolai, that in the matter of programmatic development, I have no problem. Everything is developing very quickly.
At the same time, the mechanisms work fine.
I have now mastered unions, and I see their application in one particular task, - writing strings into a resource.
I will try to check the speed and CPU load in the test EA and post the result.
If it is good, I will rebuild communication between engine and EA, making it on resources.
In order to use resources to pass strings of undefined length, these strings must be written to a char array.
However, it seems that their size is only declared inside the union and does not change afterwards.
I tried resizing the char array from the union, through ArrayResize, but there is no effect.
It seems that the size of the char array must be set beforehand. And it should be maximum size.
Here is the code:
It is now clear that the size of thechar arrayin the union must be known beforehand. BecauseArrayResize(u.Char,StrSize) does not change it.
So, we have to set the array size equal to the length of the maximum string...
Good news. Everything is working well.
The string is written to the resource and read by another EA on a different chart.
There is no load on the processor. The load is only caused by calling the Alert that prints the string.
Here is the code of Expert Advisors:
1. Expert Advisor forming the string and writing it into a resource.
An advisor reading a line from a resource on another chart:
Will use resources for communication. The only drawback is that you have to set the maximum char array size in the union. But, you don't need to think about the size of the string and the number of MT objects.
This method is slower than the MT-object linking method, but it's fine.
You have an interesting theory, although it doesn't quite match the results of my experiments, which I will now post below.
As the test shows, it is the initialization of the pixel array that loads the CPU the most.
Check out the test EA below.
Reread the task:
Vasiliy Sokolov:
Peter, here's the assignment. Make a panel showing current order openings in MT4. You don't have to make a full copy of the system panel, just make a simple table with basic properties of open orders: open price, direction, profit. The rest is up to you. The main thing is that when an order is closed, its indication in your table would also disappear. And vice versa, it would appear in this table when a new order is opened.
Here you can see the two necessary operations of redrawing when the table changes on the screen: 1. when closing a trade and 2. when opening a trade. Why redraw the pixels at other times?
Are you solving some other problem?
Reread the problem:
Vasiliy Sokolov:
Here we see two necessary redrawing operations when the table changes on the screen: 1. when closing a trade and 2. when opening a trade. Why redraw pixels at other times?
Are you solving some other problem?
Well, they are redrawn exactly as you said.
The load on the processor appears during animation:
There is a constant reinitialization of the values in the pixel array. Every 16 milliseconds. This loads the processor up to 40%.
I was trying to figure out what exactly the load is. I thought it was saving a resource or reading it. It turned out that it was the reinitialization of the array in the drawing loop.
It also turned out that a constant call of ObjectSetInteger(0, "MT object",OBJPROP_SELECTED,1); (every 16 ms) also loads the processor. By about 10%.
I use this call to tell another EA to read the resource with animation data.
In total, it gets +~50% CPU load during animation.