Questions from Beginners MQL5 MT5 MetaTrader 5 - page 245

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
In the script, I've done this:
time=0
SymbolInfoTick on Monday.
You can check it with this code:
But you need ticks per symbol.
You can check it with this code:
But you need ticks per symbol.
Yes,"SymbolInfoTick", no check today.
Tried it, it won't work until the ticks come in.
iask=0Yes, SymbolInfoTick, no check today.
Tried it, until the ticks go off nothing will work.
iask=0This function is too fast.
To measure the performance, you need to apply multiple calls in a loop with a large number of iterations and measure the total execution time.
All the more interesting, there is an example code. We are waiting for the result.
To check a new bar in the EA I used functions based on "CopyTime", "CopyRates", which I found on the forums. I came to the conclusion that their calculation takes a lot of time.
Here is the check data (it's noteworthy that indicator call takes 171 ms):
And here I got an idea, what if I try something else. For example, "TimeCurrent".
Made the following code for optimization:
Did the following code for optimization in Expert Advisor:
Result in single run without checking for a new bar, when indicator values are received at each tick: 817,196 ms
With check of a new bar: 735 904 ms
The difference is not particularly impressive, there is some improvement, but it's not enough.
I get the indicator as follows:
I tried to put code with calls of handles in block where check of new bar occurs, error appears if I
I put return returns nothing, no error, but EA does not work.
I suppose the hendle call, if it is possible and in general all the main code except the static variable should be placed inside the conditional statement checking for a new bar.
If I'm not mistaken, I read somewhere that even if we call a handle but don't request an indicator in buffers, it is still calculated.
Who can suggest how to make an indicator that displays the results of a single formula buffer[i] = (1.3747-(MarketInfo("EURUSD", MODE_BID))+0.8835-(MarketInfo("USDCHF", MODE_BID)))*10000;
You need to write a custom indicator. To make the process easier - take one of the simplest indicators -iMa and rewrite a bit. Here is another topic, where it talks about MarketInfo. Write the code, ask, if something does not work.
What happened to static variables? Updated the old build of the terminal today and now there are errors when compiling:
The static members-data of the class must now be placed: