Libraries: Virtual - page 2

 
The whole discussion thread that was here has disappeared.
 
hmm, cleaned up by accident or like rating points removed? pity, useful thread.
 

I forgot about a free way to speed up some EAs.

This EA is an example.

#include <MT4Orders.mqh> // https://www.mql5.com/en/code/16006
/*
#define VIRTUAL_LIMITS_TP_SLIPPAGE // Limiters and TPs are executed at the first acceptance price - positive slippages
#define VIRTUAL_TESTER_FAST // This may speed up the Expert Advisor in the Tester.
#include <fxsaber\Virtual\Virtual.mqh> // https://www.mql5.com/en/code/22577
*/
input int inRange = 0;
input int inOffset = 10;

void OnTick( void )
{
  static double Offset = inOffset * _Point;
  
  MqlTick Tick;
  
  if (SymbolInfoTick(_Symbol, Tick) && Tick.bid && Tick.ask)
  {
    const double PriceHigh = NormalizeDouble(MathMax(Tick.bid + Offset, Tick.ask + _Point), _Digits);
    const double PriceLow = NormalizeDouble(MathMin(Tick.ask - Offset, Tick.bid - _Point), _Digits);
    
    bool BuyLimit = false;
    bool SellLimit = false;
    
    for (int i = OrdersTotal() - 1; i >= 0; i--)
      if (OrderSelect(i, SELECT_BY_POS))
        switch (OrderType())
        {
          case OP_BUY:
            BuyLimit = true;
            
            if (OrderTakeProfit() != PriceHigh)
              OrderModify(OrderTicket(), OrderOpenPrice(), OrderStopLoss(), PriceHigh, 0);
            break;
          case OP_SELL:
            SellLimit = true;
            
            if (OrderTakeProfit() != PriceLow)
              OrderModify(OrderTicket(), OrderOpenPrice(), OrderStopLoss(), PriceLow, 0);
            break;
          case OP_BUYLIMIT:
            BuyLimit = true;
            
            if ((OrderTakeProfit() != PriceHigh) || (OrderOpenPrice() != PriceLow))
              OrderModify(OrderTicket(), PriceLow, OrderStopLoss(), PriceHigh, 0);
            break;
          case OP_SELLLIMIT:
            SellLimit = true;
          
            if ((OrderTakeProfit() != PriceLow) || (OrderOpenPrice() != PriceHigh))
              OrderModify(OrderTicket(), PriceHigh, OrderStopLoss(), PriceLow, 0);
        }

    if (!BuyLimit)
      OrderSend(_Symbol, OP_BUYLIMIT, 1, PriceLow, 0, 0, PriceHigh);
  
    if (!SellLimit)
      OrderSend(_Symbol, OP_SELLLIMIT, 1, PriceHigh, 0, 0, PriceLow);
  }
}


Optimisation.

Optimisation speed in the mode by pips and real ticks.

optimization finished, total passes 6
optimization done in 9 minutes 12 seconds
shortest pass 0:01:30.359, longest pass 0:01:33.652, average pass 0:01:32.059
local 6 tasks (100%), remote 0 tasks (0%), cloud 0 tasks (0%)


After uncommenting the source.

optimization finished, total passes 6
optimization done in 1 minutes 54 seconds
shortest pass 0:00:18.341, longest pass 0:00:21.834, average pass 0:00:19.104
local 6 tasks (100%), remote 0 tasks (0%), cloud 0 tasks (0%)


We got a free acceleration of optimisation by five times.


Single pass.

Without Virtual.

23366361 ticks, 213919 bars generated. Environment synchronized in 0:00:00.073. Test passed in 0:04:31.191 (including ticks preprocessing 0:00:02.984).


With Virtual.

23366361 ticks, 213919 bars generated. Environment synchronized in 0:00:00.070. Test passed in 0:00:22.723 (including ticks preprocessing 0:00:03.047).


Free acceleration by 12 times. Free - trades are made in the Tester, charts are built, tables are filled in, etc.


In practice, using this method most often gives 10-20% acceleration. This is up to five hours a day.

 
It's just sad that useful threads are being cleaned up. There was a lot on installation in the beginning.
 
fxsaber:
The entire discussion thread that was here has disappeared.

Yes, and the thread itself has been recreated. It disappeared from my favourites (

 
Andrey Khatimlianskii:

Yes, and the topic itself has been recreated. It disappeared from my favourites (

That's a fact, thanks, just noticed.(

 
Andrey Khatimlianskii:

Oh, and the topic itself has been recreated. It disappeared from my favourites (

Unfortunately, zero chance of recovery. There were a lot of examples and ideas there, which I myself returned to from time to time. Here was a kind of squeeze: a base of knowledge and skills on the bible.

It's all gone. I hope the trigger for deletion wasn't yesterday's code update. You'll wonder whether to update other bibles now.

 

It is considered good manners to have backups. Even more good tone is considered to be a public explanation of the reasons for what happened.

But all this, if the fault is on the part of the site, not the user. And here a strange situation looms ...

For now, hope only on the Internet archive.

 
Stanislav Korotky:

It is considered good manners to have backups. It is even more good manners to publicly explain the reasons for what happened.

For now, the only hope is the Internet archive.

By the way, yes, the web archive should be looked at, if it is still alive, not all of course, they do not have frequent save points.

 
Stanislav Korotky:

For now, the only hope is the Internet Archive.

Off-topic. If anyone can post it, it would be good.