Forex
Google
New signals service!

Go Back   Forex Trading > Downloads > Expert Advisors - Metatrader 4


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 12-23-2006, 10:08 PM
Junior Member
 
Join Date: Aug 2006
Posts: 8
budhax is on a distinguished road
Lot sum after EA test / Avoid "CLOSE AT STOP"

Hello,

1. HOW TO GET INFORMATION FROM TRADES GENERATED BY EA TEST ?
Let's test an EA and then "OPEN CHART". On this chart we can see all orders made by the EA.
To get custom information for this test, I would write a script to get the sum of all lots' order? EXAMPLE: 2 trades at 1.0 lot, 2 trades at 5.0 lots -> sum=12 lots. I think we cannot use OrderLots( ) function because trades (generated by EA durring a test) are not stored in the history pool.
So, how to get information on trades displayed in this chart? Could you help me to write the script?

May be, it is easier to get this information (time, price) from Trendline graphical objects, because each Trendline represents a trade. In this case, how to get the lot value of the trade?

2. HOW TO AVOID "STOP AT CLOSE" RESULTS DURING EA TEST ?
My historical data (EURUSD) go from 1st JULY 2004 to 30th NOVEMBER 2006, and I select "Use date" 1st JULY 2004 to 30th JUNE 2006 (24 months) in my Tester settings.
How to avoid the "Close at Stop" we can see at the end of the Results tab in the Tester (for some EA). Why those trades give big loss?

Thanks.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 12-24-2006, 01:42 AM
Senior Member
 
Join Date: Jan 2006
Posts: 1,084
omelette is on a distinguished road
Hi. Regarding your first point, there is no way for a script to extract trade info from the chart opened after a backtest. Even if a script could locate the buy and sell graphics, there would be no way to equate price data to these. But why go to all this trouble - it would be much easier to just add a function to the EA that would keep tabs on the executed trades.
As for your second point, as far as I'm aware, the large drawdown that follows the 'Close At Stop' is a result of poorly written EAs that open multiple orders and are 'forgotten' about until they are closed en-masse by MT at the end of the testdata. As most will probably be in the red, you get a large drawdown.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-14-2007, 10:16 PM
Junior Member
 
Join Date: Aug 2006
Posts: 8
budhax is on a distinguished road
Omelette,
Sure there is a way, like this script. Drag and drop it on the chart displayed by the "Open Chart" after testing an EA.
Code:
// USE THIS SCRIPT ON A 24 MONTHS PERIOD TESTED

double Normalize0 (double d) {return (NormalizeDouble(d,0));}
double Normalize1 (double d) {return (NormalizeDouble(d,1));}
double Normalize2 (double d) {return (NormalizeDouble(d,2));}


//--------------------------------------------------------------------
//  script program start function                                    |
//--------------------------------------------------------------------
int start() {

	string NameOBJ;
	string Paire=Symbol();
	int LPrice=2+Digits;
	int TotalOBJ=ObjectsTotal();
	
	double SumTrade=0;
	double SumPIP=0;
	double PointR=0;
	double SumPointG=0;
	double SumPointP=0;
	double Price1,Price2;
	bool FacSens=true;
	double SumLot=0;
	
	int PeriodAnnee=2;
	int PeriodMois=PeriodAnnee*12;
	int PeriodSemaine=PeriodAnnee*52;
	color CloseC=Goldenrod;
	string resS="  ____  ";
	string lineS="----------------------------------------------------";
		
	// Parcours la liste des OBJ sur le chart
	for(int i=0;i<TotalOBJ;i++) {
		NameOBJ=ObjectName(i);
		if (ObjectType(NameOBJ)==OBJ_ARROW) {
			if (ObjectGet(NameOBJ,OBJPROP_COLOR)==CloseC) {
				Price1=StrToDouble(StringSubstr(NameOBJ,StringFind(NameOBJ,Paire,0)+10,LPrice));
				Price2=StrToDouble(StringSubstr(NameOBJ,StringFind(NameOBJ,"er a",0)+6,LPrice));
				FacSens=!(0<StringFind(NameOBJ,"sell",0));
				PointR=(Price2-Price1)*((2*FacSens)-1)/Point;
				if (0<PointR) {SumPointG+=PointR;} else {SumPointP+=PointR;}
				SumTrade++;
			}
		}
	}
	
	// Résultats
	SumPIP=SumPointG+SumPointP;
	Print(lineS);
	
	Print("TRADE: ",SumTrade,resS,
	Normalize0(SumTrade/PeriodSemaine)," [Tr/Se]",resS,
	Normalize0(SumTrade/PeriodMois)," [Tr/Mo]");
	
	Print("PIP: ",SumPointG," - ",-SumPointP," = ",SumPIP,resS,
	Normalize2(SumPIP/SumTrade)," [Pi/Tr]",resS,
	Normalize0(SumPIP/PeriodSemaine)," [Pi/Se]",resS,
	Normalize0(SumPIP/PeriodMois)," [Pi/Mo]");
	
	Print(lineS);

	return(0);

}
I agree with you, It should be easier to add a script in the EA.

Is it possible to customize the report generated by the Tester?
Thanks

Last edited by budhax; 02-14-2007 at 10:46 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-15-2007, 11:49 PM
Kurka Fund's Avatar
Senior Member
 
Join Date: Sep 2006
Location: San Diego
Posts: 139
Kurka Fund is on a distinguished road
write an ea that doesent have huge drawdowns and this problem is avoided.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-16-2007, 03:16 AM
ralph.ronnquist's Avatar
Senior Member
 
Join Date: Oct 2006
Posts: 280
ralph.ronnquist is on a distinguished road
I think it would be possible to write code in the deinit() function, to write to file information the closed orders history; as I remember it, the deinit() function is called during testing before the final stop-out happens.

EDIT: deinit() seems to be called after stop-out, so this method won't work. As a variation, if the start() function keeps track of its last invocation time, then the deinit() function can still dump the closed history to file, and discard trades closed after the time of the last start() function invocation.

Last edited by ralph.ronnquist; 02-16-2007 at 04:29 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

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

BB 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
How to "teach" and to use the AI ("neuron") EA? danil Suggestions for Trading Systems 5 07-15-2008 04:26 PM
MT4 is there a "close all open trades script/command?" keramikus Metatrader 4 3 05-29-2007 01:49 PM
Help Me Test "SMA_MultiHedge" phoenix Expert Advisors - Metatrader 4 7 01-11-2007 03:26 PM
what's the meaning of "close at stop"? phoenix General Discussion 2 06-24-2006 02:07 AM


All times are GMT. The time now is 05:28 AM.



Search Engine Friendly URLs by vBSEO 3.2.0 ©2008, Crawlability, Inc.