Made $ 258 663.50 from $3000 using Problematic Backtesting by just buying at open (Fractal ZigZag)

 
I recently downlaoded the Fractal ZigZag EA and wanted to see why it is doing so well. After playing around with it and at the end removing everything in the EA expect the buy command it made that amount of money.

I used the following settings:
GPBUSD daily
Open prices only
TakeProfit = 25;
Lots = 1;
TrailingStop = 10;
InitialStop = 20;
slip = 3;

It was tested from 1999-07-01
//+------------------------------------------------------------------+
//|                                   Fractal ZigZag ExpertBlack.mq4 |
//|                                                        BlackThorn|
//|   I modified the original one to this to show that the backtester|
//| is not working                                                   |
//+------------------------------------------------------------------+
#property copyright "ikovrigin, bobammax"
#property link      ""
 
//---- input parameters
 
extern double TakeProfit = 25; 
extern double Lots = 1;
extern double TrailingStop = 10;
extern double InitialStop = 20;
extern int slip = 3;  //exits only
 
//---- buffers
int BAR;
 
 
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
 
   BAR = Bars;
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   
   if (BAR == Bars-1)
   {
   BAR = Bars;
// order section
   int OrderForThisSymbol = 0;
   for(int x = 0; x < OrdersTotal(); x++)
     {
       OrderSelect(x, SELECT_BY_POS, MODE_TRADES);
       if(OrderSymbol() == Symbol()) 
           OrderForThisSymbol++;
     }//end for
   
   
   
   if(OrderForThisSymbol == 0)
     {
       
       int BuyOrderTicket = OrderSend(Symbol(), OP_BUY, Lots, Ask, slip, 
                           Ask - (InitialStop*Point), Ask + (TakeProfit*Point),"", 0, 0, Green);
   }
   }
   
   return(0);
  } 
//+------------------------------------------------------------------+

If you look at the chart there is lots of trades that close in the air?






If this is not proof that something is not right then I do not know. Can more people please check this please.

MetaQuotes: If I buy or sell on the bar what price do you use? It looks like the PC is dreaming out a number?




Thanks
Schalk
 
You got the results because the simulated tickchart,which was generated from higher timeframes. The orders were opened and closed on the same bar all the time, since the ticks are generated according to a pattern that is not realistic (on a simulated bar price can go up and down between high and low more than once, filling tight stops on the same bar, getting profits a lot lot lot more often than it would happen on a real tick chart.)
 
Zap:
You got the results because the simulated tickchart,which was generated from higher timeframes. The orders were opened and closed on the same bar all the time, since the ticks are generated according to a pattern that is not realistic (on a simulated bar price can go up and down between high and low more than once, filling tight stops on the same bar, getting profits a lot lot lot more often than it would happen on a real tick chart.)


I agree with waht you say - but there is strategies that work on open, close, high and low of a bar (without super sampling). I feel that the tester should allow for this.

I feel that the same price should be used to open and then take profit or stop loss - from where does this profit come from? (the spread should be lost per trade).

 
The only problem with OHLC is, that you don't know the sequence.
An M1 bar is just compressed Tickchart, with two concrete points: open and close, and two relative: high and low.

I made a quick scheme:
http://img206.imageshack.us/img206/5029/barsjt3.jpg

The first drawing is an M1 bar, that can be built infinite ways. You can guess, the results won't be the same, for the three ways that I drew. In my opinion the first one is the more realistic, but I saw bars built by tester like the third last drawing.
So you only know two sure points per minute, and two relative from a M1 bar, not more. (You can generate with sophisticated algorithms, but the two sure points remain two sure points) Well, if you ever saw a US market open, with announcements, you know that a lot more happening than what can be desribed with these points.
 
Is there any way to get tick data into MetaTrader and use it for backtesting? I find these limitations frustrating.
 
Zap:
The only problem with OHLC is, that you don't know the sequence.
An M1 bar is just compressed Tickchart, with two concrete points: open and close, and two relative: high and low.

I made a quick scheme:
http://img206.imageshack.us/img206/5029/barsjt3.jpg

The first drawing is an M1 bar, that can be built infinite ways. You can guess, the results won't be the same, for the three ways that I drew. In my opinion the first one is the more realistic, but I saw bars built by tester like the third last drawing.
So you only know two sure points per minute, and two relative from a M1 bar, not more. (You can generate with sophisticated algorithms, but the two sure points remain two sure points) Well, if you ever saw a US market open, with announcements, you know that a lot more happening than what can be desribed with these points.
Thanks ZAP - I understand the problem now.

It seems like you know a lot about backtesting - do you know why I cannot get the same results as in the championship when I backtest their code?
Thanks
 
do you know why I cannot get the same results as in the championship when I backtest their code?

Oh yes! I've just tried to explain it. :D
You could get very close with tick data.

Craig: try Google and Ebay.
 
The problem is Time.
in realistic trade, those price can not get at same time,

and those price only can be get after that time, and then trade take place at next time(bar).

so test allow you can judge and trade at same time (or in other word, same bar),
but realistic trade not !!!
 
Well, I don't fully get what you say, but I see nothing wrong with time, or the problem is not only wit time.
The backtester generates tick data from the least timeframe available (I guess everyone has M1) with the so called 'fractal interpolation', which is not far from random data. But every tick has a price and a time, as in a real account, only not the same, because these are just simulated. Only two points will have the same price and time: open and close of a bar. It is natural that something produces different results (output) with different input, isn't it?
 
BlackThorn:
Zap:
The only problem with OHLC is, that you don't know the sequence.
An M1 bar is just compressed Tickchart, with two concrete points: open and close, and two relative: high and low.

I made a quick scheme:
http://img206.imageshack.us/img206/5029/barsjt3.jpg

The first drawing is an M1 bar, that can be built infinite ways. You can guess, the results won't be the same, for the three ways that I drew. In my opinion the first one is the more realistic, but I saw bars built by tester like the third last drawing.
So you only know two sure points per minute, and two relative from a M1 bar, not more. (You can generate with sophisticated algorithms, but the two sure points remain two sure points) Well, if you ever saw a US market open, with announcements, you know that a lot more happening than what can be desribed with these points.
Thanks ZAP - I understand the problem now.

It seems like you know a lot about backtesting - do you know why I cannot get the same results as in the championship when I backtest their code?
Thanks

Hey BlackThorn, a bit outdated thread now but hey the problems remain. Have you got any good tick data that you are perhaps using or have you given up on backtesting with MT4?
 

problem is in 4H period, Open is 0 second, close is at 4 H, but get H and L maybe at 1 H or 1.5 H but only get at 4H.

in other words, HLC data only can be used at next bar.

for ZagZig indicator, if Zagzig give a signal at 9:00 ad you decided to buy or sell, but when tive arrived to 11:00, new data maybe change that signal at 9:00, can you back to 9:00 to change your buy or sell ? you can not back on the timeline!


from your graph, those positions close at prices not exist !