Strategy Tester Problem?

 

I am having a problem with the Strategy Tester showing a loss for a trade that should be a winner. I am running MT 4.0, build 200.


I have created a small EA to replicate the problem and have captured a screenshot of the trade results and the data (attached). Any ideas why a trade that clearly hit the Take Profit would show a loss in the Strategy Tester?

#property copyright "Copyright © 2006, ????????????"
#property link "http://www.????"

static bool executedTrade1 = false;

//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
//----

if ( TimeYear(Time[0]) == 2005 && TimeDay(Time[0]) == 27 && TimeMonth(Time[0]) == 10 && TimeHour(Time[0]) == 12 && TimeMinute(Time[0]) >= 25 && !executedTrade1 )
{
executeTrade(OP_SELLSTOP, 1, 1. 2134, 1.2163, 1. 2126);
executedTrade1 = true;
}

//----
return(0);
}

//+------------------------------------------------------------------+
//| Execute a Trade |
//+------------------------------------------------------------------+
int executeTrade( int op, double lots, double entryPrice, double stop, double limit)
{

//----

int ticket=OrderSend(Symbol(),op,lots,entryPrice,3,stop,limit,"expert comment", 255,0,CLR_NONE);
if(ticket<1)
{
int error=GetLastError();
Alert("Error Code= ", error);
return(-1*error);
}

return(0);
}

 
 
Hi Robert,

I think that your problem is that you are simulating using only open or close prices (or with some interpolation). The lowest price is hit inside the 13:30-13:35 bar but if the strategy tester is set up not to use all ticks it will not notice that you should have reached the take profit. ¿have you tried to simulate all the ticks?

I have another problem with the Strategy Simulator. It seems like some data gets "lost" or is not available at the history center and due to this I get time gaps ¿had anybody encountered this problem? ¿should I download the history data somewhere and import it?


Regards
 
I ran the Strategy Tester with every tick but got the same result. I am attaching the data.
Thanks,
Robert
Files:
eurusd5.zip  6 kb
 
Is your problem reproduced if You test with visual mode?
 
stringo wrote:
Is your problem reproduced if You test with visual mode?

Yes, the problem is still there in visual mode.
 
Your EURUSD5.csv is incorrect because every bar has volume 1. This case is not modelled.
 
stringo wrote:
Your EURUSD5.csv is incorrect because every bar has volume 1. This case is not modelled.

Are you saying that the Strategy Tester uses volume information in backtesting? How is it used? In this case I obtained the data from a source that did not include volume, but I did not think that was required for back testing.

Thanks,
Robert
 
Open offline fxt-file generated by tester and see bars evolution. (See article 'Testing of Expert Advisors in the MetaTrader 4 Client Terminal: An Outward Glance' - first picture is offline opened fxt-file)

BTW last updated build of client terminal can modify such incorrect volumes when data imported.
Reason: