|
|||||||
| Register in Forex TSD! | |
|
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time). Click here to register and get more information |
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Modular version behaves differently
I customized Lesson16.pdf http://www.forex-tsd.com/attachments...f?d=1135725434 to be more modular for the way I want to test different trading strategies. Unfortunately, I am not getting the same results as the unmodified lesson.
Would you please take a look and advise me as to why mine behaves so differently on the same data in the Strategy Tester? The actual performance is not the issue right now; only the disagreement in selected entry/exit trade(s). It does not close the original open order, except when the tester ends. So I only have 1 round trip trade! The only differences I suspect would be where I make a second call for: shortEma, longEma, isCrossed (as cg_l16_Crossed(shortEma,longEma);), and total; since I have the code split into more modular functions. I am also assuming that I process the same price data since I am in testing mode -- and that for live trading my present code may miss a tick if it is slower. Thoughts? |
|
|||
|
Wrong code sequence, but still...
Okay, I did notice I was not selecting the order as the first step in the for loop of the exit test exitStrategy_cg_l16 (the 2 bold if conditions were reversed), but even when I do as below, I get the same incongruent results. I also commented out the magic number condition.
Code:
for(int cnt=0; cnt<total; cnt++)
{
if(selectOrderByIndex(cnt))
{
if(OrderType()<=OP_SELL && OrderSymbol()==Symbol())// && OrderMagicNumber()==cg_l16)
{
if(OrderType()==OP_BUY) // long position is opened
|
|
|||
|
OrdersTotal()
It seems to have been the way I handled total = OrdersTotal().
If anyone would explain why, that would be terrific. I still don't understand why the first way I posted didn't perform the same. Attached is my modular version of Coders Guru Lesson 16 which appears to perform the same. |
|
|||
|
cockeyedcowboy,
Do you have any idea why my original post did not perform the same way as Lesson 16 and my last post? How would you suggest writing Lesson 16 to accommodate different strategies (which may not use a simple "isCrossed" flag)? Does 'Code Complete' apply to MQL4? Because my original plan was to call functions after their name was determined dynamically, but that is not possible in MQL4 (no function pointers or "eval" type techniques, nor OOP). Regards. Is there really a W in MicrowSoft Press? Last edited by ftsdPadawan : 01-22-2007 at 12:29 AM. Reason: W ? |
|
||||
|
Quote:
Code Complete is language independent it teaches programing style good for any language. dont know what went wrong with your code. I don't look at code that is choped up like that was. It would take less time to re-write the code then try to read it. Sorry. send link to lesson, I've not read it. Edit never mind found the link in your first post. will respond when I've read it. Last edited by cockeyedcowboy : 01-22-2007 at 01:27 AM. |
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| DIN version 3.0 | ANCOLL | Dolly | 88 | 05-22-2008 01:10 PM |
| FIREBIRD NEW Version | Yves81 | Expert Advisors - Metatrader 4 | 2 | 10-04-2006 02:43 PM |
| is it possible in pocket pc version?? | kucinx | General Discussion | 6 | 06-02-2006 03:41 AM |
| CVS Version System | fxdk | Tools and utilities | 1 | 04-30-2006 02:17 AM |
| New Version | MFX | TSD Expert Advisors | 6 | 01-24-2006 02:48 PM |