Beginner's questions in MQL5. Professionals don't pass by. - page 2

 
Figar0:

The "all ticks" model has only 14 times more ticks than the "open price" model on H4. Either I'm nuts, or one of the two... So, there is no "open price" model?

Have a look at "The Basics of Testing in MetaTrader 5":

Open prices only

In the "Open prices only" testing mode, generation of ticks is performed by the same algorithm as for the "1 minute OHLC" mode. The only difference is that the OnTick() function in this mode runs only on Open prices of the tested period.

For example, an Expert Advisor is tested on EURUSD H1 in the "Open prices only" mode. It means that the total amount of ticks (check points) will be the same as in the "1 minute OHLC" mode, but the OnTick() handler is called only at open one hour bar. On other ("hidden" from an Expert Advisor) ticks, the checks necessary for the correct testing take place:

  • calculation of margin requirements;
  • triggering of Stop Loss and Take Profit;
  • triggering of pending orders;
  • Removal of pending orders with expired time.

If there are no open positions or pending orders, there is no need in these checks of hidden ticks, and the speed increase can be significant. This mode "Open prices only" is good for testing strategies that perform trades only at bar opening and do not use pending orders, as well as StopLoss, TakeProfit orders. All the necessary precision of testing is retained for the class of such strategies.

 
Rosh:

Have a look at this article Basic Testing in MetaTrader 5:

It's clear why, it's not clear how to be? As I said right away - sad) the MT5 tester in my example is 70 times slower than the MT4 tester. Where in my MT4 was a day here will be 10 weeks? It's cool, I decided to speed up) It's good that I started small and not converted all the good stuff to MT5 for testing)

Forgive my sarcasm, I understand that the MT5 tester has a lot of advantages over MT4, but this is outweighed by the speed.

Maybe we should introduce a model similar to "opening prices" from MT4? Let it be inaccurate, let it be in bold red with lots of warnings, but let it be more immediate than in MT4. The accuracy of testing sequence generation in MT5, for example, is absolutely unnecessary for Expert Advisors operating on a bar opening without TP and SL.

 
Figar0:

It's clear why, not clear how to be? Like I said right away - sad) the MT5 tester in my example is 70 times slower than the MT4 tester. Where in my MT4 was a day here will be 10 weeks? It's cool, I decided to speed up) It's good that I started small and not converted all the good stuff to MT5 for testing)

Forgive my sarcasm, I understand that the MT5 tester has a lot of advantages over MT4, but this is outweighed by the speed.

Maybe we should introduce a model similar to"opening prices" from MT4? Let it be inaccurate, let it be in bold red with lots of warnings, but let it be more immediate than in MT4. The accuracy of testing sequence generation in MT5, for example, is absolutely unnecessary for Expert Advisors operating on a bar opening without TP and SL.

If you want fast open prices, just write a filter in the code so it is not calculated on condition that there is no new bar, the generation of ticks itself takes minimum time, specifically 3-year history on any TF (at open prices) takes 7-15 seconds.
 
Urain:
If you want fast by open prices, just write a filter in the code so that there is no calculation on condition until a new bar appears, the generation of ticks itself takes minimum time, specifically 3-year history on any TF (by open prices) takes 7-15 seconds.
What kind of filter?) I have a check for a new bar at the beginning of Ontick(). But even with this filter my optimization of comparable EAs in MT5 is 70!!! times slower than MT4, and it's not a laughing matter... Maybe I messed up in this piece of code (new bar check), please look at the code page earlier. Or maybe it's just me? Maybe i should try to reinstall mt5 for example?
 
Figar0:
What kind of filter?) My Ontick() starts with a check for a new bar. But even with this filter optimisation of comparable EAs in MT5 is 70!!! times slower than in MT4, and it's not funny ... Maybe I messed up in this piece of code (check for new bar), please look at the code page earlier. Or maybe it's just me? Maybe i should try to reinstall mt5 for example?

Create a variable on every tick, create a dynamic array on every tick, call the copy function, two checks.

Why such complications?

You declare a global variable storing the number of bars in the previous request and check if the number of bars has changed, that's all.

int prevbars;

int OnInit()
  {
   prevbars=-100;// любое число которое не может вернуть Bars()  
   // ...
   return(0);
  }

void OnTick()
  {
   if(prevbars!=Bars(_Symbol,_Period))
     {
      prevbars=Bars(_Symbol,_Period);
      // ...
     }
  }

If you need more verification, then place this verification inside the protected area.

 
Urain:

Create a variable on every tick, create a dynamic array on every tick, call the copy function, two checks.

Why such complications?

Declare globally a variable storing the number of bars on the previous request, and check if the number of bars has changed, that's all.

If you want to check if the data is loaded, then place this check inside the protected zone.

Thank you. But do you really think that this can fundamentally change the situation?) Checked it, so pennies, maybe just within the margin of error... It's all about the huge difference in volume of generated ticks of "By opening prices" model in MT4 2K and MT 1200K, no multicore and cloud will help. Don't even know if this model has a "right" to be called by opening prices, it is like "1 tick out of 14" model judging by the ratio. I don't know what the "Opening price" model of MT4 is guilty of, I don't understand. There was definitely demand for it, why not to leave it in its MT4 form?

I don't know why and for whom this redundancy in testing is so obvious. Do we need to use the tester to extract profit from the history? I think the main point is that the tester accuracy cannot be transferred to a real account.

By the way, who knows where to hide my favorite checkbox "Skip useless results"? I couldn't find it.... Has it fallen out of favour as well?)

 
Figar0:

It was definitely in demand

... is and will continue to be.

Let's wait for the history files, at least the minute files, to be cracked.

 
TheXpert:

... uses and will continue to use.

Let's wait for the history files, at least the minute files, to be cracked.

Yes, I understand, we'll figure it out somehow, I just wanted to avoid crud... The developers seem to be willing to make a usable and functional => platform popular with traders => platform popular with brokerage companies. But sometimes I think they just don't look at it from the other side.) Then the categorical denial of the ability to set spreads (as a result, you can't use 4 on weekends without TakeMySpread), and now the introduction of an innovative cloud, agents to speed up the work and as a result the slowdown by 70 times... I don't get it.
 
The developers need to add another option for selection. That is, the old' Opening prices' option. It is sufficient for many ideas. I have achieved identical results in all modes in MT4. The cloud will then become a super cloud if tested in the old variant)).
Документация по MQL5: Стандартные константы, перечисления и структуры / Константы индикаторов / Ценовые константы
Документация по MQL5: Стандартные константы, перечисления и структуры / Константы индикаторов / Ценовые константы
  • www.mql5.com
Стандартные константы, перечисления и структуры / Константы индикаторов / Ценовые константы - Документация по MQL5
 
joo:

I would add the same "by opening price" mode but with an option to select a sub timeframe. Let's say you have chosen testing timeframe H1, it means you can select the modes of price movement on M1, M2, M5, M10 ..... М30. Then it will be very flexible to choose between "speed and accuracy" (if they are not pipsers, most will prefer "speed").

That's a great addition! Also ranged bars in the tester... But that's another story.))
Reason: