The 20's [ea]

Author: Copyright � 2005, TraderSeven
Profit factor:
0.58
Price Data Components
Series array that contains open time of each bar
Orders Execution
Checks for the total of open ordersIt automatically opens orders when conditions are reachedIt can change open orders parameters, due to possible stepping strategyIt Closes Orders by itself
9 Views
0 Downloads
0 Favorites
The 20's [ea]
/*-----------------------------+
|			       |
| Shared by www.Aptrafx.com    |
|			       |
+------------------------------*/

//+------------------------------------------------------------------------------+
//|                            ------------                       The 20's v0.20 |
//+------------------------------------------------------------------------------+
#property copyright "Copyright © 2005, TraderSeven"
#property link      "TraderSeven@gmx.net"
 
//            \\|//             +-+-+-+-+-+-+-+-+-+-+-+             \\|// 
//           ( o o )            |T|r|a|d|e|r|S|e|v|e|n|            ( o o )
//    ~~~~oOOo~(_)~oOOo~~~~     +-+-+-+-+-+-+-+-+-+-+-+     ~~~~oOOo~(_)~oOOo~~~~
// This EA has 2 main parts.
// Variation=0
// If previous bar opens in the lower 20% of its range and closes in the upper 20% of its range then sell on previous high+10pips.
// If previous bar opens in the upper 20% of its range and closes in the lower 20% of its range then buy on previous low-10pips.
// 
// Variation=1
// The previous bar is an inside bar that has a smaller range than the 3 bars before it.
// If todays bar opens in the lower 20% of yesterdays range then buy.
// If todays bar opens in the upper 20% of yesterdays range then sell.
//
//01010100 01110010 01100001 01100100 01100101 01110010 01010011 01100101 01110110 01100101 01101110 



//----------------------- USER INPUT
extern int TakeProfit=10;
extern int TrailingStop=20;//starts after TakeProfit is reached, 0=off
extern int Variation=1;	 

//----------------------- MAIN PROGRAM LOOP
double YesterdaysRange;
double Top20;
double Bottom20;
int Lots=1;
int slip=0;
double Stoploss=200;
double OrderDay=99;
int start()

{
// ---------------- START OF DAY???
 int h = TimeHour(CurTime());
 int m = TimeMinute(CurTime());
 int s = TimeSeconds(CurTime());

 
if(h==0 && m==0 && OrdersTotal()==0)
  {

YesterdaysRange=(High[1]-Low[1]);
Top20=High[1]-(YesterdaysRange*0.20);
Bottom20=Low[1]+(YesterdaysRange*0.20);

if(Variation==0)//original system
  {
  if(Open[1]>=Top20 && Close[1]<=Bottom20 && Ask<(Low[1]-0.010) && Day()!=OrderDay)
    { 
    OrderSend(Symbol(),OP_BUY,Lots,Ask,slip,Low[1]-(10*Point),Ask+(2*TakeProfit*Point),0,0,Blue);
    OrderDay=Day();
    }
  
  if(Close[1]>Top20 && Open[1]<Bottom20 && Bid>(High[1]+0.010) && Day()!=OrderDay)
    { 
    OrderSend(Symbol(),OP_SELL,Lots,Bid,slip,High[1]+(10*Point),Bid-(2*TakeProfit*Point),0,0,Red);
    OrderDay=Day();
    }  
  }
   
 if(Variation==1)//with narrow range and inside bar
   { 
   if((High[4]-Low[4])>YesterdaysRange && (High[3]-Low[3])>YesterdaysRange && (High[2]-Low[2])>YesterdaysRange && High[1]<High[2] && Low[1]>Low[2])
     {
     if(Open[0]<=Bottom20 && Day()!=OrderDay)
       { 
       OrderSend(Symbol(),OP_BUY,Lots,Ask,slip,Low[1]-(100*Point),Ask+(2*TakeProfit*Point),0,0,Blue);
       OrderDay=Day();
       }
  
     if(Open[0]>=Top20 && Day()!=OrderDay)
       { 
       OrderSend(Symbol(),OP_SELL,Lots,Bid,slip,High[1]+(100*Point),Bid-(2*TakeProfit*Point),0,0,Red);
       OrderDay=Day();
       } 
     
     }
   }
   
}   


if((Bid-OrderOpenPrice()>=TakeProfit*Point && OrderType()==OP_BUY) || (OrderOpenPrice()-Ask>=TakeProfit*Point && OrderType()==OP_BUY))
{


// ---------------- TRAILING STOP
if(TrailingStop>0)
{ 
     OrderSelect(0, SELECT_BY_POS, MODE_TRADES);
     if((OrderType() == OP_BUY || OrderType() == OP_BUYSTOP) && 
(OrderSymbol()==Symbol()))
         {
            if(TrailingStop>0) 
              {                
               if(Bid-OrderOpenPrice()>Point*TrailingStop)
                 {
                  if(OrderStopLoss()<Bid-Point*TrailingStop)
                    {
                     OrderModify(OrderTicket(),OrderOpenPrice(),Bid- 
Point*TrailingStop,OrderTakeProfit(),0,Aqua);
                     return(0);
                    }
                 }
              }
          }
     if((OrderType() == OP_SELL || OrderType() == OP_SELLSTOP) && 
(OrderSymbol()==Symbol()))
         {
            if(TrailingStop>0)  
              {                
               if((OrderOpenPrice()-Ask)>(Point*TrailingStop))
                 {
                  if(OrderStopLoss()==0.0 || 
                     OrderStopLoss()>(Ask+Point*TrailingStop))
                    {
                     OrderModify(OrderTicket(),OrderOpenPrice
(),Ask+Point*TrailingStop,OrderTakeProfit(),0,Aqua);
                     return(0);
                    }
                 }
              }
          }
}   
} 
 
// ---------------- END OF DAY???
h = TimeHour(CurTime());
m = TimeMinute(CurTime());
s = TimeSeconds(CurTime());

 
 Comment(h,":",m,":",s);
 
 if(h==23 && m==59 && s>0 && OrdersTotal()>0)
   {
   OrderDay=9999;
   OrderSelect(0, SELECT_BY_POS);
   if(OrderType()==OP_BUY)
     {
     OrderClose(OrderTicket(),1,Bid,10*Point);
     }   
     
   if(OrderType()==OP_SELL)
     {
     OrderClose(OrderTicket(),1,Ask,10*Point);     
     }
   }



 if(h==23 && m==59 && s>0 && OrdersTotal()>0)
   {
   OrderDay=9999;
   OrderSelect(0, SELECT_BY_POS);
   if(OrderType()==OP_BUY)
     {
     OrderClose(OrderTicket(),1,Bid,10*Point);
     }   
     
   if(OrderType()==OP_SELL)
     {
     OrderClose(OrderTicket(),1,Ask,10*Point);     
     }
   }

}

Profitability Reports

GBP/USD Oct 2024 - Jan 2025
5.00
Total Trades 6
Won Trades 5
Lost trades 1
Win Rate 83.33 %
Expected payoff 13.33
Gross Profit 100.00
Gross Loss -20.00
Total Net Profit 80.00
-100%
-50%
0%
50%
100%
GBP/USD Jan 2025 - Jul 2025
3.41
Total Trades 8
Won Trades 7
Lost trades 1
Win Rate 87.50 %
Expected payoff 12.38
Gross Profit 140.00
Gross Loss -41.00
Total Net Profit 99.00
-100%
-50%
0%
50%
100%
NZD/USD Jan 2025 - Jul 2025
2.86
Total Trades 6
Won Trades 5
Lost trades 1
Win Rate 83.33 %
Expected payoff 10.83
Gross Profit 100.00
Gross Loss -35.00
Total Net Profit 65.00
-100%
-50%
0%
50%
100%
EUR/USD Jan 2025 - Jul 2025
1.51
Total Trades 10
Won Trades 9
Lost trades 1
Win Rate 90.00 %
Expected payoff 6.10
Gross Profit 180.00
Gross Loss -119.00
Total Net Profit 61.00
-100%
-50%
0%
50%
100%
AUD/USD Oct 2024 - Jan 2025
1.25
Total Trades 8
Won Trades 0
Lost trades 0
Win Rate 0.00 %
Expected payoff 3.50
Gross Profit 140.00
Gross Loss -112.00
Total Net Profit 28.00
-100%
-50%
0%
50%
100%
USD/CAD Oct 2024 - Jan 2025
1.18
Total Trades 8
Won Trades 7
Lost trades 1
Win Rate 87.50 %
Expected payoff 1.93
Gross Profit 100.27
Gross Loss -84.82
Total Net Profit 15.45
-100%
-50%
0%
50%
100%
NZD/USD Jul 2025 - Sep 2025
0.66
Total Trades 3
Won Trades 2
Lost trades 1
Win Rate 66.67 %
Expected payoff -7.00
Gross Profit 40.00
Gross Loss -61.00
Total Net Profit -21.00
-100%
-50%
0%
50%
100%
USD/JPY Jul 2025 - Sep 2025
0.55
Total Trades 4
Won Trades 3
Lost trades 1
Win Rate 75.00 %
Expected payoff -8.50
Gross Profit 40.78
Gross Loss -74.77
Total Net Profit -33.99
-100%
-50%
0%
50%
100%
NZD/USD Oct 2024 - Jan 2025
0.42
Total Trades 7
Won Trades 5
Lost trades 2
Win Rate 71.43 %
Expected payoff -19.86
Gross Profit 100.00
Gross Loss -239.00
Total Net Profit -139.00
-100%
-50%
0%
50%
100%
AUD/USD Jul 2025 - Sep 2025
0.34
Total Trades 3
Won Trades 2
Lost trades 1
Win Rate 66.67 %
Expected payoff -25.67
Gross Profit 40.00
Gross Loss -117.00
Total Net Profit -77.00
-100%
-50%
0%
50%
100%
GBP/AUD Jan 2025 - Jul 2025
0.19
Total Trades 3
Won Trades 1
Lost trades 2
Win Rate 33.33 %
Expected payoff -19.09
Gross Profit 13.32
Gross Loss -70.60
Total Net Profit -57.28
-100%
-50%
0%
50%
100%
USD/CHF Jan 2025 - Jul 2025
0.18
Total Trades 10
Won Trades 5
Lost trades 5
Win Rate 50.00 %
Expected payoff -50.24
Gross Profit 113.14
Gross Loss -615.57
Total Net Profit -502.43
-100%
-50%
0%
50%
100%
USD/JPY Jan 2025 - Jul 2025
0.14
Total Trades 12
Won Trades 5
Lost trades 7
Win Rate 41.67 %
Expected payoff -33.91
Gross Profit 68.55
Gross Loss -475.48
Total Net Profit -406.93
-100%
-50%
0%
50%
100%
AUD/USD Jan 2025 - Jul 2025
0.09
Total Trades 9
Won Trades 4
Lost trades 5
Win Rate 44.44 %
Expected payoff -90.44
Gross Profit 80.00
Gross Loss -894.00
Total Net Profit -814.00
-100%
-50%
0%
50%
100%
USD/CHF Jul 2025 - Sep 2025
0.09
Total Trades 5
Won Trades 1
Lost trades 4
Win Rate 20.00 %
Expected payoff -50.48
Gross Profit 25.26
Gross Loss -277.66
Total Net Profit -252.40
-100%
-50%
0%
50%
100%
GBP/CAD Jan 2025 - Jul 2025
0.00
Total Trades 0
Won Trades 0
Lost trades 0
Win Rate 0.0 %
Expected payoff 0.00
Gross Profit 0.00
Gross Loss 0.00
Total Net Profit 0.00
-100%
-50%
0%
50%
100%
USD/CAD Jan 2025 - Jul 2025
0.00
Total Trades 2
Won Trades 2
Lost trades 0
Win Rate 100.00 %
Expected payoff 14.31
Gross Profit 28.62
Gross Loss 0.00
Total Net Profit 28.62
-100%
-50%
0%
50%
100%
EUR/USD Jul 2025 - Sep 2025
0.00
Total Trades 3
Won Trades 3
Lost trades 0
Win Rate 100.00 %
Expected payoff 20.00
Gross Profit 60.00
Gross Loss 0.00
Total Net Profit 60.00
-100%
-50%
0%
50%
100%
GBP/AUD Jul 2025 - Sep 2025
0.00
Total Trades 0
Won Trades 0
Lost trades 0
Win Rate 0.0 %
Expected payoff 0.00
Gross Profit 0.00
Gross Loss 0.00
Total Net Profit 0.00
-100%
-50%
0%
50%
100%
GBP/CAD Jul 2025 - Sep 2025
0.00
Total Trades 0
Won Trades 0
Lost trades 0
Win Rate 0.0 %
Expected payoff 0.00
Gross Profit 0.00
Gross Loss 0.00
Total Net Profit 0.00
-100%
-50%
0%
50%
100%
GBP/USD Jul 2025 - Sep 2025
0.00
Total Trades 3
Won Trades 3
Lost trades 0
Win Rate 100.00 %
Expected payoff 20.00
Gross Profit 60.00
Gross Loss 0.00
Total Net Profit 60.00
-100%
-50%
0%
50%
100%
NZD/USD Jul 2025 - Sep 2025
0.00
Total Trades 1
Won Trades 1
Lost trades 0
Win Rate 100.00 %
Expected payoff 20.00
Gross Profit 20.00
Gross Loss 0.00
Total Net Profit 20.00
-100%
-50%
0%
50%
100%
USD/CAD Jul 2025 - Sep 2025
0.00
Total Trades 1
Won Trades 1
Lost trades 0
Win Rate 100.00 %
Expected payoff 14.71
Gross Profit 14.71
Gross Loss 0.00
Total Net Profit 14.71
-100%
-50%
0%
50%
100%
AUD/USD Jul 2025 - Sep 2025
0.00
Total Trades 2
Won Trades 2
Lost trades 0
Win Rate 100.00 %
Expected payoff 20.00
Gross Profit 40.00
Gross Loss 0.00
Total Net Profit 40.00
-100%
-50%
0%
50%
100%
EUR/USD Jul 2025 - Sep 2025
0.00
Total Trades 1
Won Trades 1
Lost trades 0
Win Rate 100.00 %
Expected payoff 20.00
Gross Profit 20.00
Gross Loss 0.00
Total Net Profit 20.00
-100%
-50%
0%
50%
100%
GBP/AUD Jul 2025 - Sep 2025
0.00
Total Trades 0
Won Trades 0
Lost trades 0
Win Rate 0.0 %
Expected payoff 0.00
Gross Profit 0.00
Gross Loss 0.00
Total Net Profit 0.00
-100%
-50%
0%
50%
100%
GBP/CAD Jul 2025 - Sep 2025
0.00
Total Trades 0
Won Trades 0
Lost trades 0
Win Rate 0.0 %
Expected payoff 0.00
Gross Profit 0.00
Gross Loss 0.00
Total Net Profit 0.00
-100%
-50%
0%
50%
100%
GBP/USD Jul 2025 - Sep 2025
0.00
Total Trades 4
Won Trades 4
Lost trades 0
Win Rate 100.00 %
Expected payoff 20.00
Gross Profit 80.00
Gross Loss 0.00
Total Net Profit 80.00
-100%
-50%
0%
50%
100%
USD/CAD Jul 2025 - Sep 2025
0.00
Total Trades 0
Won Trades 0
Lost trades 0
Win Rate 0.0 %
Expected payoff 0.00
Gross Profit 0.00
Gross Loss 0.00
Total Net Profit 0.00
-100%
-50%
0%
50%
100%
USD/CHF Jul 2025 - Sep 2025
0.00
Total Trades 2
Won Trades 0
Lost trades 2
Win Rate 0.00 %
Expected payoff -151.42
Gross Profit 0.00
Gross Loss -302.84
Total Net Profit -302.84
-100%
-50%
0%
50%
100%
USD/JPY Jul 2025 - Sep 2025
0.00
Total Trades 1
Won Trades 1
Lost trades 0
Win Rate 100.00 %
Expected payoff 13.70
Gross Profit 13.70
Gross Loss 0.00
Total Net Profit 13.70
-100%
-50%
0%
50%
100%

Comments