This forum is in read-only mode now. You may discuss your questions on forums of MQL4.community and MQL5.community
The best EA this side of the universBack to topics list | 1 2 |
|
hardwood
2005.08.08 17:19
I have backtested an EA on version 178 called 'Firebird' which promptly turned 10'000$ into 655'000 $ in a mere 4 years. What a performance!
Looking at the Strategy Tester Report, I see hundreds of phantom trades which certainly could not have been generated by the EA. The report is very big so I wont post it here, but I have 2 questions: 1) Has anyone else had similar problems or is it my 'majic fingers' ? 2) How do I send the report to MetaQuotes Software for analysis? Best regards, Hugh here is a small extract of the report - it is done on daily time frame with the 'every tick' model. 1 2001.10.11 14:00 buy 1 1.00 1.4415 1.4215 1.4445 2 2001.10.11 14:00 t/p 1 1.00 1.4445 1.4215 1.4445 300.00 10300.00 3 2001.10.11 14:00 buy 2 1.00 1.4415 1.4215 1.4445 4 2001.10.11 14:01 t/p 2 1.00 1.4445 1.4215 1.4445 300.00 10600.00 5 2001.10.11 14:01 buy 3 1.00 1.4415 1.4215 1.4445 6 2001.10.11 14:02 t/p 3 1.00 1.4445 1.4215 1.4445 300.00 10900.00 7 2001.10.11 14:02 buy 4 1.00 1.4415 1.4215 1.4445 8 2001.10.11 14:03 t/p 4 1.00 1.4445 1.4215 1.4445 300.00 11200.00 9 2001.10.11 14:03 buy 5 1.00 1.4415 1.4215 1.4445 10 2001.10.11 14:04 t/p 5 1.00 1.4445 1.4215 1.4445 300.00 11500.00 11 2001.10.11 14:04 buy 6 1.00 1.4415 1.4215 1.4445 12 2001.10.11 14:05 t/p 6 1.00 1.4445 1.4215 1.4445 300.00 11800.00
//+------------------------------------------------------------------+
//| Firebird v0.55 - MA envelope exhaustion system |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2005, TraderSeven"
#property link "TraderSeven@gmx.net"
//----------------------- USER INPUT
extern int MA_length = 10;
extern int TradeOnFriday =1; // >0 trades on friday
extern int MAtype=0;//0=close, 1=HL
extern int slip = 100;//exits only
extern int Lots = 1;
extern int TakeProfit = 30;
extern int Stoploss = 200;// total loss on all open positions in pips
//extern double TrailingStop = 5;
extern int PipStep = 30;
double Stopper=0;
double KeepStopLoss=0;
double KeepAverage;
double dummy;
double spread=0;
int OrderWatcher=0;
//----------------------- MAIN PROGRAM LOOP
int start()
{
double PriceTarget;
double AveragePrice;
int OpeningDay;
//double Tester;
int Direction=0;//1=long, 11=avoid long, 2=short, 22=avoid short
if (Day()!=5 || TradeOnFriday >0)
{
int cnt=0, total;
total=OrdersTotal();
if(total==0) OpeningDay=DayOfYear();
OrderSelect(total-1, SELECT_BY_POS);
double LastPrice=OrderOpenPrice();
OrderSelect(total, SELECT_BY_POS, MODE_TRADES);
//----------------------- ENTER POSITION BASED ON OPEN
OrderWatcher=0;
if(MAtype==0)
{
if((iMA(NULL,0,MA_length,0,MODE_SMA,PRICE_OPEN,0)*1.02)<Bid && Direction!=22 && (Bid>=(LastPrice+(PipStep*Point))||total==0)) // Go SHORT -> Only sell if >= 30 pips above previous position entry
{
OrderSend(Symbol(),OP_SELL,Lots,Bid,slip,Bid+(Stoploss*Point),Bid-(TakeProfit*Point),0,0,Red);
OrderWatcher=1;
Direction=2;
}
if((iMA(NULL,0,MA_length,0,MODE_SMA,PRICE_OPEN,0)*0.98)>Ask && Direction!=11 && (Ask<=(LastPrice-(PipStep*Point))||total==0)) // Go LONG -> Only buy if >= 30 pips below previous position entry
{
OrderSend(Symbol(),OP_BUY,Lots,Ask,slip,Ask-(Stoploss*Point),Ask+(TakeProfit*Point),0,0,Blue);
OrderWatcher=1;
Direction=1;
}
}
//----------------------- ENTER POSITION BASED ON HIGH/LOW
if(MAtype==1)
{
if((iMA(NULL,0,MA_length,0,MODE_SMA,PRICE_HIGH,0)*1.02)<Bid && Direction!=22 && (Bid>=(LastPrice+(PipStep*Point))||total==0)) // Go SHORT -> Only sell if >= 30 pips above previous position entry
{
OrderSend(Symbol(),OP_SELL,Lots,Bid,slip,Bid+(Stoploss*Point),Bid-(TakeProfit*Point),0,0,Red);
OrderWatcher=1;
Direction=2;
}
if((iMA(NULL,0,MA_length,0,MODE_SMA,PRICE_LOW,0)*0.98)>Ask && Direction!=11 && (Ask<=(LastPrice-(PipStep*Point))||total==0)) // Go LONG -> Only buy if >= 30 pips below previous position entry
{
OrderSend(Symbol(),OP_BUY,Lots,Ask,slip,Ask-(Stoploss*Point),Ask+(TakeProfit*Point),0,0,Blue);
OrderWatcher=1;
Direction=1;
}
}
//----------------------- CALCULATE AVERAGE OPENING PRICE
total=OrdersTotal();
AveragePrice=0;
if(total>1 && OrderWatcher==1)
{
for(cnt=0;cnt<total;cnt++)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
AveragePrice=AveragePrice+OrderOpenPrice();
}
AveragePrice=AveragePrice/total;
}
//----------------------- RECALCULATE STOPLOSS & PROFIT TARGET BASED ON AVERAGE OPENING PRICE
OrderSelect(0, SELECT_BY_POS, MODE_TRADES);
if(OrderType()==OP_BUY && OrderWatcher==1 && total>1)// && OrderSymbol()==Symbol()) // Calculate profit/stop target for long
{
PriceTarget=AveragePrice+(TakeProfit*Point);
Stopper=AveragePrice-(((Stoploss*Point)/OrdersTotal()));
}
if(OrderType()==OP_SELL && OrderWatcher==1 && total>1)// && OrderSymbol()==Symbol()) // Calculate profit/stop target for short
{
PriceTarget=AveragePrice-(TakeProfit*Point);
Stopper=AveragePrice+(((Stoploss*Point)/OrdersTotal()));
}
//----------------------- IF NEEDED CHANGE ALL OPEN ORDERS TO THE NEWLY CALCULATED PROFIT TARGET
if(OrderWatcher==1 && OrdersTotal()>1)// check if average has really changed
{
total=OrdersTotal();
for(cnt=0;cnt<total;cnt++)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
OrderModify(OrderTicket(),0,Stopper,PriceTarget,0,Yellow);// set all positions to averaged levels
}
}
//----------------------- KEEP TRACK OF STOPLOSS TO AVOID RUNAWAY MARKETS
// Sometimes the market keeps trending so strongly the system never reaches it's target.
// This means huge drawdown. After stopping out it falls in the same trap over and over.
// The code below avoids this by only accepting a signal in teh opposite direction after a SL was hit.
// After that all signals are taken again. Luckily this seems to happen rarely.
if (OrdersTotal()>0)
{
OrderSelect(0, SELECT_BY_POS, MODE_TRADES);
KeepStopLoss=OrderStopLoss();
KeepAverage=AveragePrice;
if(OrderType()==OP_BUY)
Direction=1;//long
else Direction=2;//short
}
if(KeepStopLoss!=0)
{
spread=MathAbs(KeepAverage-KeepStopLoss)/2;
dummy=(Bid+Ask)/2;
if (KeepStopLoss<(dummy+spread) && KeepStopLoss>(dummy-spread))
{
// a stoploss was hit
if(Direction==1) Direction=11;// no more longs
if(Direction==2) Direction=22;// no more shorts
}
KeepStopLoss=0;
}
}
}
//----------------------- TO DO LIST
// 1st days profit target is the 30 pip line *not* 30 pips below average as usually. -----> Day()
// Trailing stop -> trailing or S/R or pivot target
// Realistic stop loss
// Avoid overly big positions
// EUR/USD 30 pips / use same value as pipstep
// GBP/CHF 50 pips / use same value as pipstep
// USD/CAD 35 pips / use same value as pipstep
//----------------------- OBSERVATIONS
// GBPUSD not suited for this system due to not reversing exhaustions. Maybe use other types of MA
// EURGBP often sharp reversals-> good for trailing stops?
// EURJPY deep pockets needed.
|
|
steve_zhang8
2005.08.08 19:27
No need to send to the metaquote for analysis. The code has the problem. Whne I started to work on expert and got the similar results at first. You may need a flag or time check to prevent you from entering one trader for many times.
|
|
hardwood
2005.08.08 20:04
Thank-you Steve.
On a 4 year time frame, even 1 phantom trade a day will create a significant skew in the results! Does this mean that the backtesting is basically not usable ? Best regards, Hugh |
|
Vooch
2005.08.08 21:27
Freebird!
Rename the file to Freebird.mq4 and it should work. - Vooch Ref. http://online.wsj.com/public/article/0,,SB111102511477881964-ZkAKwALO87RaHLbFJrSJSA_i9xg_20050415,00.html?mod=blogs ;-) If that doesn't work, try something like this:
/////////////////////////////////////////////////////////////////////////////////////////
// BACKTESTER FIX: DO NOT PLACE AN ORDER IF WE JUST CLOSED
// AN ORDER WITHIN Period() MINUTES AGO
/////////////////////////////////////////////////////////////////////////////////////////
datetime orderclosetime;
int TheHistoryTotal=HistoryTotal();
int difference;
for(cnt=0;cnt<TheHistoryTotal;cnt++) {
if(OrderSelect(cnt,SELECT_BY_POS,MODE_HISTORY)==true)
{
if ( (OrderSymbol()==Symbol()) && (OrderMagicNumber()==MagicNumber) ) {
orderclosetime=OrderCloseTime();
rightnow=Year()+"-"+Month()+"-"+Day()+" "+Hour()+":"+Minute()+":"+Seconds();
rightnow2=StrToTime(rightnow);
difference=rightnow2-orderclosetime;
if(Period()*60*2>difference) { // At least 2 periods away!
openunprofitablelongorders=100; // Throw a flag
openunprofitableshortorders=100; // Throw a flag
break;
}
}
}
}
/////////////////////////////////////////////////////////////////////////////////////////
|
|
GT48aec42c270a6
2005.08.09 01:09
"Freebird!"
|
|
hardwood
2005.08.09 01:22
Thank-you Vooch,
I tried freebird and even FREEBIRD! but none went away... good try! The code u gave attenuates the problem - is this the 'official workaround'? Thanks and regards, Hugh |
|
Vooch
2005.08.09 02:50
hardwood,
I emailed you with my changes integrated into your script. If you didn't get it, let me know. Freebird, Vooch |
|
MartinCooney
2005.08.09 03:47
First up guys you may wanna use the current script version.
This is v.57 and is being made available in the Yahoo groups by the author TraderSeven (Tony) - the author is not hardwood. I know the author well and I'd suggest he be the one made aware of any changes or suggestions to the script. I know I've chatted online with him about the flakey backtest so I'm sure he'd appreciate some respect when his script is concerned. My $0.02c worth. Martin |
|
Vooch
2005.08.09 03:58
Martin,
I'm a member of that group, but I rarely visit. Do you have a link to v.57? You can email me at vooch a t vooch d o t com. - Vooch |
|
MartinCooney
2005.08.09 04:04
Done
|
|
Vooch
2005.08.09 04:10
Martin,
Ooops! I can't receive attachments there. Could you please resend? This time, send it to salvucci a t Lawrenceburg d o t com . Thanks, Vooch |
Back to topics list
| 1 2
Download MetaTrader 5 (450 Kb, web installer) — a new terminal for financial markets
