BrijonRocks_FF





//+------------------------------------------------------------------+
//|                          BrijonSingleTester.mq4       
//+------------------------------------------------------------------+
extern int       TP=15;
extern double    MarginRatio=0.025;                
extern double    PositionSize=0.1;
extern int       MagicNObase = 10000;             // this is a stupid part that has to be manually set when attaching EA to a chart.
extern int       DDistCriteria = 100;             // determine if the Dist is profittable and safe w/o drawdown.
extern int       HDistCriteria = 15;              // determine if the Dist is profittable and safe w/o drawdown.
extern int       breath = 2;
extern int       SessionStart = 21;
extern int       SessionEnd = 6;

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  { return(0); }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  { return(0); }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
{  
   double PendingCap, DWL, HWL;    
   int DDist, HDist; 
       
	  PendingCap = Risk();                                                                     
	  if (PendingCap <= MarginRatio && ( Hour()>=SessionStart || Hour()<=SessionEnd )  )            // 1. Verify sizing; 2. trade only in Asian Morning.
     {  Print("Current Positions take ", PendingCap, " capital; OK to Trade!");  
     
        DWL = WLcollector(1440);                     // 1440 minute = 1 day
        HWL = WLcollector(60);                       // 60 minute = 1 hour       
        if (Ask < DWL)
           {
           DDist = (-Ask+DWL)/Point;
           HDist = (-Ask+HWL)/Point;
           }
        else if (Bid > DWL)   
           {
           DDist = (-DWL+Bid)/Point;
           HDist = (-HWL+Bid)/Point;        
           }     
        if (DDist>DDistCriteria&&HDist>HDistCriteria )
        {
           placetrades(DWL);
        }
     }        // PendingCap if, highest if
   return(0);  
} 
// End of 'Start' section
//+------------------------------------------------------------------+
double Risk()                                      //output the ratio of position/capital
{
      double riskratio;      
      riskratio = AccountMargin()/AccountFreeMargin();
      return(riskratio);     
}
//+------------------------------------------------------------------+
double WLcollector(int MAtimeframe)
{     
      double ma5=iMA(NULL,MAtimeframe,5,0,MODE_SMA,PRICE_CLOSE,0);
      double ma7=iMA(NULL,MAtimeframe,7,0,MODE_SMA,PRICE_CLOSE,0);
      double ma22=iMA(NULL,MAtimeframe,22,0,MODE_SMA,PRICE_CLOSE,0);

      double WLoutput = (ma5+ma7+ma22)/3;

      if (Symbol()=="GBPUSD")
         {
         double ma34=iMA(NULL,MAtimeframe,34,0,MODE_SMA,PRICE_CLOSE,0);
         WLoutput = (ma5+ma7+ma22+ma34)/4;
         }
      return(WLoutput);
}
//+------------------------------------------------------------------+
void placetrades(double DailyWL)
{   
   int ticket;
   int spread=MarketInfo(Symbol(),MODE_SPREAD);
           
   if (Ask < DailyWL)   
   {
      ticket=OrderSend(Symbol(),OP_BUY,PositionSize,Ask,4,0,Ask+(TP+spread+breath)*Point,"Brijon Long Trade",MagicNObase,0,Blue);      // Ask - Mountain*Point
      if(ticket>0) 
      {
         if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) 
            {Print("BUY order opened : ",OrderOpenPrice());}
         else 
            {Print("Error opening BUY order : ",GetLastError());} 
      } 
   }
   else if (Bid > DailyWL)
   { 
      ticket=OrderSend(Symbol(),OP_SELL,PositionSize,Bid,4,0,Bid-(TP+spread+breath)*Point,"Brijon Short Trade",MagicNObase,0,Blue); 
      if(ticket>0)
      {
         if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) 
            {Print("SELL order opened : ",OrderOpenPrice());}
         else 
            {Print("Error opening SELL order : ",GetLastError());}  
      }     
   }   
   
 }
//+------------------------------------------------------------------+





Sample





Analysis



Market Information Used:



Indicator Curves created:


Indicators Used:

Moving average indicator


Custom Indicators Used:

Order Management characteristics:
It automatically opens orders when conditions are reached

Other Features:


BackTest : EURUSD on H1

From 2009-08-01 to 2009-10-01 Profit Factor:0.86 Total Net Profit:-565.12

BackTest : EURUSD on H1

From 2009-12-01 to 2010-01-17 Profit Factor:4.60 Total Net Profit:1885.92

BackTest : EURUSD on H1

From 2010-03-01 to 2010-03-27 Profit Factor:1.20 Total Net Profit:245.41

BackTest : EURUSD on H1

From 2010-04-01 to 2010-04-30 Profit Factor:0.28 Total Net Profit:-1471.78

BackTest : GBPUSD on H1

From 2010-01-01 to 2010-02-27 Profit Factor:0.35 Total Net Profit:-4422.74

BackTest : GBPUSD on H1

From 2010-01-01 to 2010-04-16 Profit Factor:0.31 Total Net Profit:-2846.29

BackTest : USDCAD on H1

From 2009-01-01 to 2010-01-01 Profit Factor:0.47 Total Net Profit:-10253.32

BackTest : USDCAD on H1

From 2009-12-01 to 2010-01-01 Profit Factor:0.00 Total Net Profit:0.00

BackTest : USDCHF on H1

From 2009-12-01 to 2010-01-01 Profit Factor:0.08 Total Net Profit:-2484.87

BackTest : USDJPY on H1

From 2009-11-01 to 2009-11-30 Profit Factor:0.33 Total Net Profit:-3781.87

Request Backtest for BrijonRocks_FF


From : (yyyy/mm/dd) To: (yyyy/mm/dd)

Pair: Period: