FMW_1





//+------------------------------------------------------------------+
//|                                                        FMW_1.mq4 |
//|                                                                * |
//|                                                                * |
//+------------------------------------------------------------------+
#property copyright "FMW_1"
#property link "fraktalis@gmail.com"


//---- input parameters
extern   double  Lots=0.2;
extern   bool    RiskManagement=true;
extern   double  RiskPercent=20;
extern   int     StopLose=0;
extern   int     TakeProfit=12; 
extern   int     TrailingStop=0;
extern   int     WPRSell=10;
extern   int     WPRBuy=90;
extern   int     S=80; // EMA
extern   int     B=40; // EMA
int start()


  {
  
  double SL,TP;
  int Total=0;

  for(int cnt=0;cnt<OrdersTotal();cnt++)
   {
  OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);
   if(OrderSymbol()==Symbol())
      {
      Total++;
      if(OrderType()==OP_BUY)
         {
         if(TrailingStop>0
         && Bid-OrderOpenPrice()>Point*TrailingStop
         && OrderStopLoss()<Bid-Point*TrailingStop)
            {
            OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*TrailingStop,OrderTakeProfit(),0);
            return(0);
            }
         }
      if(OrderType()==OP_SELL)
         {
         if(TrailingStop>0
         && OrderOpenPrice()-Ask>Point*TrailingStop
         && (OrderStopLoss()>Ask+Point*TrailingStop || OrderStopLoss()==0))
            {
            OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point*TrailingStop,OrderTakeProfit(),0);
            return(0);
            }
         }
      }
   }
  
  if(OrdersTotal()==1)return(0);
  
    if(RiskManagement)
  {
      if(RiskPercent<0.1||RiskPercent>100)   
      {
      Comment("Invalid Risk Value.");
      return(0);
      }
      else
          {
          Lots=MathFloor((AccountFreeMargin()*AccountLeverage()*RiskPercent*Point*100)/(Ask*MarketInfo(Symbol(),MODE_LOTSIZE)*
                MarketInfo(Symbol(),MODE_MINLOT)))*MarketInfo(Symbol(),MODE_MINLOT);
          }
  }
  if(Lots<0.01)Lots=0.01;//My min lots
  if(Lots>100)Lots=100;//My max lots  
  if(RiskManagement==false){Lots=Lots;}
  
         double SellMA=iMA(NULL,0,S,0,MODE_EMA,PRICE_OPEN,1);
         double BuyMA=iMA(NULL,0,B,0,MODE_EMA,PRICE_OPEN,1);
         double hight=iFractals(NULL,0,MODE_UPPER,3);
         double low=iFractals(NULL,0,MODE_LOWER,3);
         double R=iWPR(NULL,0,21,1);
        
            if(SellMA>BuyMA && R>-WPRSell)

               {
               if (TakeProfit>0) TP=Bid-TakeProfit*Point;
               if (StopLose>0) SL=Bid+StopLose*Point;
               OrderSend(Symbol(),OP_SELL,Lots,Bid,2,SL,TP,NULL,0,0);
               return(0);
               }
          
            if(SellMA<BuyMA && R<-WPRBuy)

               {
               if (TakeProfit>0) TP=Ask+TakeProfit*Point;
               if (StopLose>0) SL=Ask-StopLose*Point;
               OrderSend(Symbol(),OP_BUY,Lots,Ask,2,SL,TP,NULL,0,0);
               return(0);
               }
               
  return(0);  
  }
//+------------------------------------------------------------------+



Sample





Analysis



Market Information Used:



Indicator Curves created:


Indicators Used:

Moving average indicator
Fractals
Larry William percent range indicator


Custom Indicators Used:

Order Management characteristics:
Checks for the total of open orders

It can change open orders parameters, due to possible stepping strategy
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.17 Total Net Profit:-1965.75

BackTest : EURUSD on H1

From 2009-12-01 to 2010-01-17 Profit Factor:0.01 Total Net Profit:-3861.79

BackTest : EURUSD on H1

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

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

BackTest : GBPUSD on H1

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

BackTest : USDCAD on H1

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

BackTest : USDCHF on H1

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

BackTest : USDJPY on H1

From 2009-11-01 to 2009-11-30 Profit Factor:0.07 Total Net Profit:-4176.49

Request Backtest for FMW_1


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

Pair: Period: