| stevehopwoodforex.com https://www.stevehopwoodforex.com/phpBB3/ Print view |
|
| Use of Comment() when backtesting https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=457 |
Page 1 of 2 |
| Author: | slipshod [ Thu Mar 29, 2012 8:14 am ] |
| Post subject: | Use of Comment() when backtesting |
Hi everyone, firstly my thanks to Steve & everyone who contributes here for such an informative forum I'll try and keep things short - I got into forex after being "let go" from (programming) my day job & threw myself into it all guns blazing. Six months later I had to face the unfortunate truth that as a trader I make a good programmer. So, convinced that the strategy I'd developed was basically sound & should be profitable if traded by someone without emotions who just follows the rules, I decided it was time to develop my own EA. Over the last 2 months I've been merrily clicking away deep into the night, and finally am at the point where I'm running some basic backtests. Here I've run into a bit of a problem. How can I tell that the EA is doing what I designed for it to do? When running the EA in normal time I can make it print to the screen via Comment(), and display a bunch of info that tells me exactly what its doing & why. I can compare that to indicators etc & verify that its working properly (or not). However, when I try this with backtesting in visual mode, the comments flicker on the screen every now & then for a nanosecond, then are gone. I'm basically blind & can't tell precisely why its trading as it is, which is pretty frustrating. Has anyone else run into this problem, and is there any way around it? Thanks in advance |
|
| Author: | MichaelM [ Thu Mar 29, 2012 9:04 am ] |
| Post subject: | Re: Use of Comment() when backtesting |
Use Print (like Comment). It outputs to the Experts tab. |
|
| Author: | slipshod [ Thu Mar 29, 2012 9:34 am ] |
| Post subject: | Re: Use of Comment() when backtesting |
Thanks but ... unfortunately the Strategy Tester doesn't have an Experts tab, so its not much use for backtesting. Print() does write to a file in tester\logs, however the information only gets saved to the file hundreds of candles after the event (seems to be buffered by the system). |
|
| Author: | MichaelM [ Fri Mar 30, 2012 12:26 am ] |
| Post subject: | Re: Use of Comment() when backtesting |
Sorry, I meant Journal tab. |
|
| Author: | SteveHopwood [ Fri Mar 30, 2012 10:53 am ] |
| Post subject: | Re: Use of Comment() when backtesting |
All my bots, and the shell, have this snippet in the leading comment block: Code: Select all |
|
| Author: | slipshod [ Fri Mar 30, 2012 1:25 pm ] |
| Post subject: | Re: Use of Comment() when backtesting |
Thanks guys - why did I never think to check the Journal? Amazing how easy it is to miss obvious things. Nice suggestion re the use of Alert too, will definitely put that to good use |
|
| Author: | Raiden [ Fri May 04, 2012 2:26 am ] |
| Post subject: | Re: Use of Comment() when backtesting |
That's bizarre, the only way I think that could happen is that you placed your Comment(), or whatever function with your Comment() in it, in a loop within the Start(). Try placing it in the main body of the Start() itself. You want to make sure it executes every tick. Edit: for illustration, check out http://raidenworks.com/2012/01/25/drawdown/, and skip to the header MQL4 Code: You can see that the Comment() is in the main body of Start(). Don't nest it in anything else. (Unless you are printing error logs which are time specific.) A little further down the screenshot of the comment field that appears. |
|
| Author: | slipshod [ Fri May 04, 2012 11:43 am ] |
| Post subject: | Re: Use of Comment() when backtesting |
No, I can assure you it was in Start() and not nested at all. I think its because I had too many indicators running at the time - I've found that when I ran it with no indicators visible the problem went away. Also, when I had a lot of indicators on the screen, objects I added manually (trendlines etc) would disappear the next tick, and again its not something I see when there's nothing but candles. |
|
| Author: | SteveHopwood [ Fri May 04, 2012 3:44 pm ] |
| Post subject: | Re: Use of Comment() when backtesting |
Some indi's display a comment. When you call indi's from within an ea, they briefly display their comment, which is then replaced by your ea's comment or one of the other indi's comment. This causes the flicker. Where you have the source for the indi, find the Comment() and delete it. Where you do not have the source, save the .ex4 under a different name, decompile it, delete the Comment and use the decompiled version instead. Also, many custom indi's are dreadfully coded. Some will merely delete all objects of the type they are using, regardless of whether the indi created it or not. You will quickly come to loathe these blasted things as much as I do. |
|
| Author: | Raiden [ Fri May 04, 2012 5:50 pm ] |
| Post subject: | Re: Use of Comment() when backtesting |
That makes much sense. As for having lots of indicators onscreen, I can attest that having about 8, both main and sub-window, does not affect my comment field. Might be possible that one of the indicators has a memory leak too, might explain why the comment field disappears completely after a while. Another work around would be to create labels(ObjectCreate(), ObjectSetText(), ObjectSet()) instead of using Comment(). Worth doing as you can manipulate the information display better, e.g. colour, font, fontsize, etc.. |
|
| All times are UTC | Page 1 of 2 |
|
Powered by phpBB® Forum Software © phpBB Limited |
|