Correct the BackTest on MT3 (MetaTrader) the robber platforms

 

https://www.mql5.com/go?link=http://www.mataf.net/forum/upload/viewtopic-pid14633.htm

Excused my bad English!

Hello,

After several hours of research, I came has boils to bypass almost all the errors that the Back test on MT3 (metaquotes) can create. There are no robber system, but robber platforms.

Indeed, she will not fly for you, if it is only your time, but she will give to you unbelievable illusions. Almost any system on MT3 can be great winning, but to obtain a little more reality it is necessary to follow this that follows:

I programed 2 systems rather stupid thank-you that do unbelievable gains. I used them for found the solutions that inclusion sufficed to activate them.

Before to post them I will summarize you the failures and the solutions.

1-Error on BuyStop. If one puts an order stop has an inferior price that the current price the order is executed but to the price of the very Stop if no transaction goes the.

The most unbelievable one is than with an order stop it the delete automatically if the top of the next bar is not at the same level than the order stop. One does now in the clairvoyance... With that one does money has blow on. Héhé

Solution: To Prevent to do more of an order by bar.

Prohibit the BuyStop and use a Buy simply.

2- Error on purchase underneath a closing in an even bar.

If a closing executes itself in a bar, a new order can be passed and this even underneath the price of the preceding closing.

That can even caused multi transaction in an even bar, imagined the profits…

Solution: To Prevent all transaction in a bar if it there has a closing.

3-The stops and trailing stop in a BT can give false results, but this is nonetheless slight.

If the new bar opens under the stop, the sale price calculated will be the price of the stop...

Solution: to oppose that it would be necessary to program a stop that closes the position to the opening of the bar and no an automatic stop to even the order.

Now I will provide to program a true System and to verify it more simply.

Hoping that it will correct on MT4, but is not has itself their quoted advantage marketing to sell a platform that does not promise you full of cash...

 




/*[[ Name := Vérification de Backtest 1
Author := Syl20
Link := /go?link=https://www.mataf.net
Notes := Preuve d'erreur sur BuyStop
Notes := Preuve d'erreur, achat dans la même barre.
Lots := 1.00
Stop Loss := 20
Take Profit := 20
Trailing Stop := 20
]]*/

var: UT (0);// times unity of the motto

UT = period; // times of the motto in minute

// --------------------------------------
// Exclusion conditions
// --------------------------------------
If Bars < 100 then Exit;
If FreeMargin < Equity/10 then Exit;

// Correction to avoid the multi-buy in the even bar.
// If CurTime-LastTradeTime < UT*60 then Exit;// Verify if it there has a trade in the presents bar.

If TotalTrades < 1 then

// ------------
// LONG entry
// ------------
If close[5] < Low-10*Point then
SetOrder(OP_BUYSTOP,Lots,close[5],3,Ask-StopLoss*Point,Ask+TakeProfit*Point,Lime);
Exit;

/*
The correction for the purchase would be to put the purchase to the Ask always and the sale to the Bid otherwise one obtains from aberrations... As you can note it!!!
But one obtains again aberrations, therefore it is necessary to use only the Buy and the Sell.
*/

 



/*[[ Name := Vérification de Backtest 2
Author := Syl20
Link := /go?link=https://www.mataf.net
Notes := Error proof of purchase underneath a sale in an even bar...
Lots := 1.00
Stop Loss := 10
Take Profit := 20
Trailing Stop := 20
]]*/

var: Ordre(0), TrailStop(0), CloseTime(0);
var: cnt(0);
var: UT (0);// times unity of the motto

UT = period;
TrailStop = TrailingStop*Point;

// --------------------------------------
// Exclusion conditions
// --------------------------------------

If Bars < 100 then Exit;
If FreeMargin < Equity/10 then Exit;
If TotalTrades > 0 then // Takes some notes the hour of the last trade
{
CloseTime = CurTime;
};

// ------------------
// Order passage
// ------------------

If TotalTrades < 1 then // Verify if it there already has a trade
{
//Solution
If CurTime-CloseTime > UT*60 and CurTime-LastTradeTime > UT*60 then // Verify if it there has a trade in the bar.

SetOrder(OP_BUYSTOP,Lots,Ask,3,Ask-StopLoss*Point,Ask+TakeProfit*Point,Lime); // Buy
Exit;
};


// -------------------------------
// Movements of the Trailing Stops
// -------------------------------

For cnt=1 to TotalTrades
{
Ordre=OrderValue(cnt,VAL_TYPE);

If OrderValue(cnt,VAL_SYMBOL)=Symbol and CurTime-LastTradeTime> UT*60 then // One verifies if one modifies the good order and if the last bar is finished.

If OrderValue(cnt,VAL_TYPE)>OP_BUY then
{
If OrderValue(cnt,VAL_STOPLOSS)>Bid then
{
DeleteOrder(OrderValue(cnt,VAL_TICKET),Orange);
Exit;
}
}

// ---------------------
// Trailing orders LONG
// ---------------------
If Ordre=OP_BUY then
{
If (close[1]-OrderValue(cnt,VAL_OPENPRICE)) > TrailStop then //vérifie si la fermeture est plus grande que l'achat.
{
If OrderValue(cnt,VAL_STOPLOSS) < (close[1]-TrailStop) then // Verify if the new stop will be higher than the last one.
{
ModifyOrder(OrderValue(cnt,VAL_TICKET),OrderValue(cnt,VAL_OPENPRICE),close[1]-TrailStop,OrderValue(cnt,VAL_TAKEPROFIT),Pink);
Exit; // Déplace le stop
};
};
};
};
/*
N.B. The stops and trailing stop in a BT can give false results, but this is nonetheless slight.
If the new bar opens under the stop the sale price calculated will be the price of the stop...
To oppose that it would be necessary to program a stop that closes the position has the opening of the bar.

//End

A model of reference will follow…

 

Haven't tried above strategy to get a more accurate result yet, but I think no matter what you do in the expert, the result is still much inaccurate due to serveral reasons. One reason is that there are serious programming errors (bugs) in MT3 backtester. And another one is that candles data is used instead of ticks data. Backtesting by ticks data is believed to be very accurate.

Because of above reason, I write my own ticks data backtester.

 

I would like to know your ticks data backtester.

On the other hand the tick by tick is not necessary for the majority of the systems in as much as one follows what is written above. Moreover, we can use tick by tick backtester of meta to give better an approximation of Reality.

Above is described the manner to avoid the bugs in the backtester.

A model of reference will follow…

 

Extremely, Gigantic, and Gross errors in profitability exist with the backtester. Only use the backtester for buy and sell visual points on the graph! The MQLII backtester multiplies profitable trades, sometimes by a factor of 20. My expert advisor for January reported in the backtester to have a profit well over $7,000. When in fact, after the multiplied profit trades were deleted, my profit was only $160.00!!

Don't get fooled like most of us have been. Don't rely on the MQII backtester to support your theories behind your custom expert advisor - You will be sadly, very sadly deceived as I have been. MetaTrader or MetaQuotes lacks integrity to fix their bad programming. Honesty and integrity is what we depend on. Unfortunately, Meta whatever does not have much as an organization. They probably need the help of our Savior. This is an honest report.

Dave 77

Reason: