Debugging Code with GDB, anyone tried? - page 2

 

yes i am looking at the log file in tester/logs folder

 
SDC:

also it made an 850 megabyte log file which i couldnt open because the file size is so huge it crashed notepad and wordpad [...]

Use a real text editor. Most coders recommend NotePad++ (freeware), personally I am hooked to TextPad (shareware). For simple tailing of log files I recommend BareTail (has both freeware and shareware versions).
 

i notice metaeditor in metatrader 5 comes with a full debugger application its a shame metaquotes didnt see fit to support mql4 in this way already, im beginning to wonder did i make a mistake in spending 3 months learning mql4 only to find an almost impossible task in debugging my obviously flawed programming, mainly due to the lack of a debugger. I might have been better off putting my efforts into learning mql5.

I say mainly due to the lack of a debugger that isnt quite the whole story what actually happend is after spending 3 months learning mql4 and writing my EA, a week ago my laptop hardrive failed mechanically and is not software recoverable, its going to take a specialized data recovery company to disasemble the hardrive and probably replace drive heads to retrieve the data and that is very expensive and of course I hadnt backed up my files for several months so I lost my whole 3 months work, but having learned a lot about mql4 in those 3 months I rewrote the whole program in 2 days and I just know I have made a stupid mistake in re writing it as it was working the first time in preliminary testing so now I'm breaking down the whole thing and going over it code block by code block to find my mistake. oh well ...

 

Ahh, that makes sense. Will need to set up a meeting with the guys and understand their strategy.

CB

 
cloudbreaker:

Ahh, that makes sense. Will need to set up a meeting with the guys and understand their strategy.

That meeting sounds like a good idea based on the amount of time you seem to have committed to the system (judging by posts to their forum).

Speaking as someone who glances occasionally at their website, I'm not sure if they actually have a strategy. Or, at least, a strategy which doesn't change every 5 minutes. The original model seemed to be the NinjaTrader-style "get people to pay for the software". The new model appears to be "get people to pay for automated trading and/or the ability to connect to multiple brokers", either directly or via IB commission. The automated trading includes both creating and running automated strategies - you have to pay for the ability to be a consumer of automated systems, and that's a vast difference from the MT4/MT5 model. The basic version seems to be limited to a single broker connection, and therefore it's only compelling if you think that PT's charting etc are miles better than the main platform offered by your broker.

They've also got a bewildering number of different interlinked websites and services, including profstation.com, betrade.com, protrader.net, and protrader.org.

 

I finaly got to where strategy tester would print some of my variables out in the log but it definately does not print all of them, there are a lot missing from the log, but when I run the EA on a live chart the print statements that were missing from strategy tester log are all there in the trading log (journal).

I get some other strange results from strategy tester, from the variables that did print out it appears to run through some for loops twice for no apparent reason, it doesnt do that in the live test it makes me kinda wary about using strategy tester at all.

 

Output from Print() does not appear in the Journal tab. It appears in the Experts tab.

CB

 
cloudbreaker:

Output from Print() does not appear in the Journal tab. It appears in the Experts tab.

CB


yes you are right, sorry, my bad, I was looking at the log from the experts tab not the journal tab, I wrote it wrong in my post.

What I meant was after testing the same EA in strategy tester then in a live chart, the resulting print statements (or lack of) in the experts/log is different from the results in the tester/logs

I realise there would be some differences expected as the strategy tester is simulating active trades while the live chart test was not but the print statements I was referring to are from the preliminary stages of the program before any trade is made, printing some variables pertaining to indicator lines and their status having crossed or not. Those printouts of those variables are all there in the live chart test log (experts/log) but they are missing from the strategy tester log (tester/log)

 

SDC make sure you actually open the log files with an external reader (notepad/wordpad do the job) and don't go by what is shown within the terminal tab itself. The terminal tab skips logged entries when they happen quickly in realtime as can happen when operating the strategy tester but they are in fact logged to the file on the drive. I've forgot and rediscovered this factoid multiple times, usually after frustratingly failing to locate my print statements and wondering what the heck is going on. Then the "duh!" moment strikes me and I pop open the log file itself.

 

Yes i had that duh moment too over the terminal tabs output, but since then I have been looking at the actual log files on the drive and found this problem with some of my print statements not getting logged by strategy tester, i am getting around it by running the EA, non trading on a live chart to debug it as the print statements all seem to get properly logged in the experts log file.

Reason: