Stumped About EA Testing

 

Hello!

I am a bit stumped on something. I have coded what I believe should be a working EA. And I say "should" because the code compiles with no errors and logically it seems okay to me. Still newer in my journey of coding EA's though so I could be completely off. But I try and back test the EA and I get the following results over and over again with no results. I am not sure what I am doing wrong. I have downloaded data of various currency pairs and various time frames and same thing.

Any suggestions? Hope I've been clear enough with my problem

2023.01.06 00:33:37.536 GBPUSD,M1: 99315809 tick events (1862160 bars, 99316810 bar states) processed in 0:02:07.438 (total time 0:02:40.516)
2023.01.06 00:33:37.536 2022.12.30 23:43:54  OrderBook GBPUSD,M1: Alert: The EA has succssfully shutdown!
2023.01.06 00:33:37.536 2022.12.30 23:43:54  OrderBook GBPUSD,M1: Alert: 
2023.01.06 00:31:30.092 2018.01.01 00:00:00  OrderBook inputs: Show_Alert=1; Display_Five_Black_Crows=1; Display_Five_White_Soldiers=1; 
2023.01.06 00:30:57.030 TestGenerator: current spread 23 used
2023.01.06 00:30:41.472 GBPUSD,M1: 19504147 tick events (1850043 bars, 19517265 bar states) processed in 0:00:25.859 (total time 0:00:27.031)
2023.01.06 00:30:41.472 2022.12.30 23:43:59  OrderBook GBPUSD,M1: Alert: The EA has succssfully shutdown!
2023.01.06 00:30:41.472 2022.12.30 23:43:59  OrderBook GBPUSD,M1: Alert: 
2023.01.06 00:30:15.620 2018.01.01 00:00:00  OrderBook inputs: Show_Alert=1; Display_Five_Black_Crows=1; Display_Five_White_Soldiers=1; 
2023.01.06 00:30:14.482 TestGenerator: current spread 22 used
2023.01.06 00:29:01.088 GBPUSD,M5: 98405481 tick events (372753 bars, 98406482 bar states) processed in 0:02:11.109 (total time 0:02:50.156)
2023.01.06 00:29:01.088 2022.12.30 23:43:55  OrderBook GBPUSD,M5: Alert: The EA has succssfully shutdown!
2023.01.06 00:29:01.088 2022.12.30 23:43:55  OrderBook GBPUSD,M5: Alert: 
2023.01.06 00:26:49.979 2018.01.01 00:00:00  OrderBook inputs: Show_Alert=1; Display_Five_Black_Crows=1; Display_Five_White_Soldiers=1; 
2023.01.06 00:26:10.995 TestGenerator: current spread 18 used
2023.01.06 00:11:09.578 GBPUSD,M5: 341541 tick events (668 bars, 341641 bar states) processed in 0:00:00.484 (total time 0:00:07.062)
2023.01.06 00:11:09.578 2022.12.30 23:59:35  OrderBook GBPUSD,M5: Alert: The EA has succssfully shutdown!
2023.01.06 00:11:09.578 2022.12.30 23:59:35  OrderBook GBPUSD,M5: Alert: 
2023.01.06 00:11:09.104 2018.01.01 00:00:00  OrderBook inputs: Show_Alert=1; Display_Five_Black_Crows=1; Display_Five_White_Soldiers=1; 
2023.01.06 00:11:09.082 History: download GBPUSD,M1 [2023.01.03 10:19]
2023.01.06 00:11:08.569 History: download GBPUSD,M1 [2023.01.03 11:18]
2023.01.06 00:11:08.054 History: download GBPUSD,M1 [2023.01.03 19:50]
2023.01.06 00:11:07.552 History: download GBPUSD,M1 [2023.01.04 04:33]
2023.01.06 00:11:07.051 History: download GBPUSD,M1 [2023.01.04 13:05]
2023.01.06 00:11:04.536 TestGenerator: current spread 20 used
2023.01.06 00:11:02.513 Expert OrderBook GBPUSD,M5: loaded successfully
 
If the code can be compiled without any error but it doesn't do what you expect use the debugger to find out why - it is exactly made for this.
Code debugging:  https://www.metatrader5.com/en/metaeditor/help/development/debug
Error Handling and Logging in MQL5:  https://www.mql5.com/en/articles/2041
Tracing, Debugging and Structural Analysis of Source Code:  https://www.mql5.com/en/articles/272
scroll down to: "Launching and Debuggin": https://www.mql5.com/en/articles/35
Tips from a professional programmer (Part  I): Code storing, debugging and compiling. Working with projects and logs
https://www.mql5.com/en/articles/9266
Tips from a professional programmer (Part II): Storing and exchanging parameters between an Expert Advisor, scripts and external programs
https://www.mql5.com/en/articles/9327
Tips from a professional programmer (Part III): Logging. Connecting to the Seq log collection and analysis system
https://www.mql5.com/en/articles/10475
Code debugging - Developing programs - MetaEditor Help
  • www.metatrader5.com
MetaEditor has a built-in debugger allowing you to check a program execution step by step (by individual functions). Place breakpoints in the code...
 
Carl Schreiber #:
If the code can be compiled without any error but it doesn't do what you expect use the debugger to find out why - it is exactly made for this.
Code debugging:  https://www.metatrader5.com/en/metaeditor/help/development/debug
Error Handling and Logging in MQL5:  https://www.mql5.com/en/articles/2041
Tracing, Debugging and Structural Analysis of Source Code:  https://www.mql5.com/en/articles/272
scroll down to: "Launching and Debuggin": https://www.mql5.com/en/articles/35
Tips from a professional programmer (Part  I): Code storing, debugging and compiling. Working with projects and logs
https://www.mql5.com/en/articles/9266
Tips from a professional programmer (Part II): Storing and exchanging parameters between an Expert Advisor, scripts and external programs
https://www.mql5.com/en/articles/9327
Tips from a professional programmer (Part III): Logging. Connecting to the Seq log collection and analysis system
https://www.mql5.com/en/articles/10475
Thank you for letting me know of this.
However I have run into a problem of using historical data...I am unable to it would seem as I am using MT4 and not MT5 and MQL4 and not MQL5 respectively. The option is greyed out in my options and after doing a quick google search it would appear that feature is not available in MT4. So not sure how to go about this? And so I also defer to my original post in terms of getting the back testing to work right
 
Anewr #: Thank you for letting me know of this. However I have run into a problem of using historical data...I am unable to it would seem as I am using MT4 and not MT5 and MQL4 and not MQL5 respectively. The option is greyed out in my options and after doing a quick google search it would appear that feature is not available in MT4. So not sure how to go about this? And so I also defer to my original post in terms of getting the back testing to work right

What option are you referring to that is "greyed out"? (show a screenshot)

The MetaEditor debugging functionality works on both MQL5 and MQL4. You can debug on MQL4 too with no issues.

Even if there was no debugger for MQL4, you can also use Print() in your code at specific points to output information to the Experts log (ou Journal log in the Strategy Tester) to help you debug your code.

You can use either method (or both) to debug and analyse your code to find the cause of the problem.

 
Fernando Carreiro #:

What option are you referring to that is "greyed out"? (show a screenshot)

The MetaEditor debugging functionality works on both MQL5 and MQL4. You can debug on MQL4 too with no issues.

Even if there was no debugger for MQL4, you can also use Print() in your code at specific points to output information to the Experts log (ou Journal log in the Strategy Tester) to help you debug your code.

You can use either method (or both) to debug and analyse your code to find the cause of the problem.

Thanks for the reply. Below is a screenshot of what I am talking about. I will go through and use the Print() option too if I can't figure out the back testing.

mt4 backtest options