| New signals service! | |
|
|||||||
| 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 |
|
|||
|
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. |
|
|||
|
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. |
|
|||
|
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);
}
![]() Is it possible to customize the report generated by the Tester? Thanks Last edited by budhax; 02-14-2007 at 10:46 PM. |
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
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 |