Profit Generator





//+------------------------------------------------------------------+
//|                                             Profit Generator.mq4 |
//|                       No Copyright, created in 2006, Open Source |
//|                                         http://www.forex-tsd.com |
//|          Works best on Daily timeframes. Possibly H4 and Weekly. | 
//|        Freely receive, Freely give. Please post updated version. |
//+------------------------------------------------------------------+
#property copyright "Created in 2006, Open Source Project"
#property link      "http://www.forex-tsd.com"

extern int MaxTrades=1;
extern double lots=1.0;
extern int stoploss=30,takeprofit=40;
extern bool UseHourTrade = False;
extern int  FromHourTrade = 8;
extern int  ToHourTrade = 18;

int ID=983783;

void deinit() {
   Comment("");
}

int orderscnt(){
int cnt=0;
   for(int i =0;i<OrdersTotal();i++){
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)){
         if(OrderSymbol()==Symbol() && ID==OrderMagicNumber()){
            cnt++;
         }
      }
   }
   return(cnt);
}

int start()
  {
  if (UseHourTrade){
   if(!(Hour()>=FromHourTrade&&Hour()<=ToHourTrade)){
   Comment("Non-Trading Hours!");
   return(0);
   }
   }
  double sl,tp;
   
   
   if (Period() < 30) {Comment("change to M30 or higher pls"); return(0); }
   if (MathMod(Minute(),Period()) >= 0.5*Period()) return(0);

   if ((High[0]-Low[0])>10*Point && Open[0]<(High[0]+Low[0])/2 && Ask < Open[0]){
      if(orderscnt()<MaxTrades){
         if(stoploss==0){sl=0;}else{sl=Bid-stoploss*Point;}
         if(takeprofit==0){tp=0;}else{tp=Bid+takeprofit*Point;}
         OrderSend(Symbol(),OP_BUY,lots,Ask,2,sl,tp,"Profit Generator",ID,0,Blue); 
      }
   }
   if ((High[0]-Low[0])>10*Point && Open[0]>(High[0]+Low[0])/2 && Bid > Open[0]){
      if(orderscnt()<MaxTrades){
         if(stoploss==0){sl=0;}else{sl=Ask+stoploss*Point;}
         if(takeprofit==0){tp=0;}else{tp=Ask-takeprofit*Point;}
         OrderSend(Symbol(),OP_SELL,lots,Bid,2,sl,tp,"Profit Generator",ID,0,Red); 
      }
   }
   return(0);
  }





Sample





Analysis



Market Information Used:

Series array that contains the highest prices of each bar
Series array that contains the lowest prices of each bar
Series array that contains open prices of each bar


Indicator Curves created:


Indicators Used:



Custom Indicators Used:

Order Management characteristics:
Checks for the total of open orders

It automatically opens orders when conditions are reached

Other Features:

BackTest : EURUSD on H1

From 2009-11-01 to 2009-11-30 Profit Factor:0.30 Total Net Profit:-9718.00

BackTest : USDJPY on H1

From 2009-11-01 to 2009-11-30 Profit Factor:0.27 Total Net Profit:-9816.82

BackTest : EURUSD on H1

From 2009-12-01 to 2010-01-17 Profit Factor:0.26 Total Net Profit:-9725.00

BackTest : USDCAD on H1

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

BackTest : EURUSD on H1

From 2009-08-01 to 2009-10-01 Profit Factor:0.24 Total Net Profit:-9726.00

BackTest : GBPUSD on H1

From 2010-01-01 to 2010-02-27 Profit Factor:0.00 Total Net Profit:-9712.00

BackTest : USDCAD on H1

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

BackTest : EURUSD on H1

From 2010-03-01 to 2010-03-27 Profit Factor:0.24 Total Net Profit:-7340.00

BackTest : GBPUSD on H1

From 2010-01-01 to 2010-04-16 Profit Factor:0.00 Total Net Profit:-9796.00

BackTest : EURUSD on H1

From 2010-04-01 to 2010-04-30 Profit Factor:0.16 Total Net Profit:-8566.60

BackTest : EURUSD on H1

From 2010-05-01 to 2010-05-31 Profit Factor:0.00 Total Net Profit:0.00

BackTest : EURUSD on H1

From 2010-06-01 to 2010-06-30 Profit Factor:0.00 Total Net Profit:0.00

Request Backtest for Profit Generator


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

Pair: Period: