EA perfect functionality by backtesting, a mess in real-time!

 

Hello all, 

I hope the following naïve question doesn't cause too much disturbance for the professionals among You. 

I've created an EA based on the "Asian Session Breakout" strategy. When backtesting, whatever modelling mode is used, it functions perfectly. What I mean by "perfectly", not just the profitability, but more importantly placing the pending stop orders accurately, whether the timing, volumes, SL, TP, ect., complying correctly with the conditions to place the orders. When applying the EA in real-time, it gets messy, and placing the pending orders fails. 

The indicator I'm using to determine open/close times of the trading sessions uses the input attached.

//    Time constants are specified across Greenwich
input int   AsiaOpen=0; //Tokyo Session Open
input int   AsiaClose=9; //Tokyo Session Close
const int   AsiaOpenSummertime=1;   // The Asian session shifts
const int   AsiaCloseSummertime=10; // after the time changes
input int   EuropaOpen=8; //London Session Open
input int   EuropaClose=17; //London Session Close
input int   AmericaOpen=13; //NY Session Open
input int   AmericaClose=22; //NY Session Close

During the backtesting, the "perfect" functionality needs me to add my GMT offset (+2) to these default values. But in real-time, whatever these values are, it's a mess! I believe it has something to with the TimeLocal() , TimeGMTOffset() , TimeTradeServer() values. As I said, my location is GMT+2, and my broker's is GMT+0. 

Any help would be greatly appreciated!

Ahmed

 
Your topic has been moved to the section: Expert Advisors and Automated Trading
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
 
Ahmed Mohamed Ahmed Elaroussi: I hope the following naïve question doesn't cause too much disturbance for the professionals among You. I've created an EA based on the "Asian Session Breakout" strategy. When backtesting, whatever modelling mode is used, it functions perfectly. What I mean by "perfectly", not just the profitability, but more importantly placing the pending stop orders accurately, whether the timing, volumes, SL, TP, ect., complying correctly with the conditions to place the orders. When applying the EA in real-time, it gets messy, and placing the pending orders fails. The indicator I'm using to determine open/close times of the trading sessions uses the input attached. During the backtesting, the "perfect" functionality needs me to add my GMT offset (+2) to these default values. But in real-time, whatever these values are, it's a mess! I believe it has something to with the TimeLocal() , TimeGMTOffset() , TimeTradeServer() values. As I said, my location is GMT+2, and my broker's is GMT+0. Any help would be greatly appreciated!
  • Are you back-testing with "real tick data"?
  • Are you simulating "delays" in the back-test?

If your answer to either is "no", then you are not really testing your EA to detect possible problems in live environments.

You need to do so to getter a better idea if how your EA will behave, and to debug and fix the possible issues.

And if even after that, you still have issues, you should print details to the log, and/or use the "debugging" feature of MetaEditor to find out why.

 
Fernando Carreiro #:
Your topic has been moved to the section: Expert Advisors and Automated Trading
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893

So sorry for the inconvenience!

 
Fernando Carreiro #:
  • Are you back-testing with "real tick data"?
  • Are you simulating "delays" in the back-test?

If your answer to either is "no", then you are not really testing your EA to detect possible problems in live environments.

You need to do so to getter a better idea if how your EA will behave, and to debug and fix the possible issues.

And if even after that, you still have issues, you should print details to the log, and/or use the "debugging" feature of MetaEditor to find out why.

The answers to both are "yes". 
Thanks a lot, Fernando, for Your effort & time. Will keep analyzing the issue.