Testing with Metatrader

 

Please see attached screenshot with the two highlighted lines. The same EA during forward testing, put in the opposite order what was done during backtest. How can this be so out of whack?

MT4 can drive you nuts.

Files:
 

Hi,

Why your SL and TP are so different?

I think your EA don't work properly.

Igor

 
igorad:
Hi,

Why your SL and TP are so different?

I think your EA don't work properly.

Igor

Igor,

The stop loss and TP is different because during testing it was showing "buy" while during trading, it was actually a "sell". So of course, the SL and TP will be different. That is what I can't figure out, how come the two orders are completely different.

I hope I am clarifying things and not making them muddier.

Thanks,

Maji

 

@Maji

Is your trade decision in your EA referring to still open actual bar ([0]) or to closed last bar ([1])?

This can make a big difference.

I am not sure, if MT can handle decisions on open bar properly.

 

Lomme,

Thanks for your reply. I use the closed bar [1], for all my trade decisions.

The decisions are based on the following scheme:

int TradePeriod = 60;

int LookBack = 8;

if(timeprev==Time[0])

return(0);

timeprev=Time[0];

Hi = iHigh(NULL, TradePeriod, Highest(NULL,TradePeriod,MODE_HIGH,LookBack,1));

Lo = iLow(NULL, TradePeriod, Lowest(NULL,TradePeriod, MODE_LOW,LookBack,1));

Cl = iClose(NULL, TradePeriod, 1);

Op = iOpen(NULL, TradePeriod, LookBack+1);

//etc...

 

Maybe some variable, that is used to decide if to sell or to buy had an different value in testing and real trading?

 
lomme:
Maybe some variable, that is used to decide if to sell or to buy had an different value in testing and real trading?

Unless those quotes varied, I don't know how anything else would have varied.

 

Looks like you have to show us the sources.

 
 
 

Can you give example of this

Maji:
I think you have an option where it places trades every tick. You can easily limit that to one trade only by using a trade counter.

Hi Maji,

Can you give an example? I have this problem. I only want to open and close position on the current candle while using every tick method. Thank you

DojiSAn

Reason: