molanis.com/forum - Tools for MetaTrader : The place to ask about the best expert advisor builder, expert advisor downloads, and expert advisor programming

AFTER YOU REGISTER SEND US AN EMAIL TO ACTIVATE YOUR ACCOUNT - Before posting:-1- Please read the user guide -2- Try the examples -3- Search in the forum
It is currently Mon Apr 29, 2024 4:22 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Saving Huge Amounts of Time when Debugging Your EA Design?
PostPosted: Tue Jul 24, 2012 9:58 pm 
Offline

Joined: Wed Mar 14, 2012 12:31 am
Posts: 118
One of the HUGE time savers that you can employ, is the tagging of your code whenever you use an MQL block. If you have an EA design with multiple signals, this will save you time searching and scanning your written code for the trade executions that show-up in the Tester Journal.

The Tester Journal shows you the trade that's being executed, but if all of your trades start with the same exact code (like those that trade across the same span of time), then the Tester Journal becomes useless for determining which trade just got triggered, as the text that shows-up in the Tester Journal might be too long to distinguish and/or identify the trade. Thus, you end up spending a massive amount of time as you pause the Tester and begin searching your written code (line-by-line) for the conditions that triggered the trade. Extremely exhausting and highly frustrating to say the least. You can literally spend hours just doing this iterative kind of trouble-shooting and debugging.

There's an easier way to identify that trade that is very simple, quick and accurate. Simply encode a 'Trade Tag' as the very first line of code. Now, when you look at the Tester Journal, you will know precisely which trade just got triggered.

Example:

I have an EA that has eight (8) different potential trade triggers. All of them start out with the same exact piece of code:

((DayOfWeek() != 0
&&
DayOfWeek() != 5
&&
DayOfWeek() != 6
&&
TimeHour(TimeCurrent()) <= 23 && TimeMinute(TimeCurrent()) < 57)
||
(DayOfWeek() == 5
&&
TimeHour(TimeCurrent()) <= 21 && TimeMinute(TimeCurrent()) < 57))


So, there is no possible way to look at the Tester Journal and know which trade is being executed, as all trades will print to the Journal in the same exact way as seen above. I then have to stop the Tester and start pouring through the charts and the written code, looking for the market condition that just got triggered. Not anymore.


The EA contains eight (*) different sub-EAs. I simply encoded the eight (8) trade types this way:

Branch #1: Long "Name of System A"
Branch #2: Long "Name of System B"
Branch #3: Long "Name of System C"
Branch #4: Long "Name of System D"
Branch #1: Short "Name of System A"
Branch #2: Short "Name of System B"
Branch #3: Short "Name of System C"
Branch #4: Short "Name of System D"

I then added this to the top of each code block that contains the code for the respective EA:

0+1 == 1
0+2 == 2
0+3 == 3
0+4 == 4

0-1 == -1
0-2 == -2
0-3 == -3
0-4 == -4

All positive numbers belong to the Long branch and all negative numbers belong to the Short branch. Since each trade is a mirror image of the other - one for the Long side and one for the Short side - I instantly know which code block is being triggered, because the Tester Journal will always show the very first string of characters of the MQL being executed. Therefore, the very first thing that prints to the Tester Journal, is the encoded "Trade Tag."

No more searching for code, scanning charts and re-calculating (by hand!) the conditions that might have triggered a particular code block.

In this pic, the Trade Tag 0-3 == -3 lets me know that Branch #3: Short "Name of System C" was just triggered.


Image


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by Molanis © 2009