Forex
Google

Go Back   Forex Trading > Metatrader Training > Metatrader 4 mql 4 - Development course
Forex Forum Register FAQ Members List Calendar Search Today's Posts Mark Forums Read


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

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-18-2007, 02:23 AM
ftsdPadawan ftsdPadawan is offline
Junior Member
 
Join Date: Jan 2007
Posts: 6
ftsdPadawan is on a distinguished road
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?
Attached Files
File Type: mq4 ftsdPadawan.mq4 (5.7 KB, 20 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 01-18-2007, 05:56 AM
ftsdPadawan ftsdPadawan is offline
Junior Member
 
Join Date: Jan 2007
Posts: 6
ftsdPadawan is on a distinguished road
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-21-2007, 03:21 AM
ftsdPadawan ftsdPadawan is offline
Junior Member
 
Join Date: Jan 2007
Posts: 6
ftsdPadawan is on a distinguished road
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.
Attached Files
File Type: mq4 ftsdPadawan.mq4 (6.3 KB, 10 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 01-21-2007, 07:16 AM
cockeyedcowboy's Avatar
cockeyedcowboy cockeyedcowboy is offline
Senior Member
 
Join Date: Nov 2005
Posts: 267
cockeyedcowboy is on a distinguished road
Quote:
Originally Posted by ftsdPadawan
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.
ftsdPadawan

May I seggest you read 'Code Complete' published by MicrowSoft Press, The information in it is language independent. Don't know if its still in print but you are sure to get a used copy of it on the net, if not. It will show you how to really construct code in module blocks. It will also tell you what coding Style has to do with readablity. What you have done here was to break the code up into peices, far from what would be consided good programing style.


[Edit] Another good read is, 'Rapid Development' also published by MicrowSoft Press.

Last edited by cockeyedcowboy : 01-21-2007 at 07:18 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 01-22-2007, 12:26 AM
ftsdPadawan ftsdPadawan is offline
Junior Member
 
Join Date: Jan 2007
Posts: 6
ftsdPadawan is on a distinguished road
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 ?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 01-22-2007, 01:24 AM
cockeyedcowboy's Avatar
cockeyedcowboy cockeyedcowboy is offline
Senior Member
 
Join Date: Nov 2005
Posts: 267
cockeyedcowboy is on a distinguished road
Quote:
Originally Posted by ftsdPadawan
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?
a w in microsoft? look ok to me either way LOL Iam bad in spelling just in english.

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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


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


All times are GMT. The time now is 09:03 AM.