MAMy Expert_v1





//+------------------------------------------------------------------+
//|                                                  MAMy Expert.mq4 |
//|                             Copyright © 2006, Victor Chebotariov |
//|                                      http://www.chebotariov.com/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, Victor Chebotariov"
#property link      "http://www.chebotariov.com/"
//----
extern int period = 3;
extern int ma_method = 3;
extern double Lots = 0.1;
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//----
   if(Bars < 100)
     {
       Print("bars less than 100");
       return(0);
     }
//----
   int cnt, ticket, total;
   double iMAMy_0 = iCustom(NULL, PERIOD_MN1, "MAMy v.3", ma_method, period, 0, 1);
   double iMAMy_1 = iCustom(NULL, PERIOD_MN1, "MAMy v.3", ma_method, period, 0, 2);
   double iMAMy_2 = iCustom(NULL, PERIOD_MN1, "MAMy v.3", ma_method, period, 1, 1);
   double iMAMy_3 = iCustom(NULL, PERIOD_MN1, "MAMy v.3", ma_method, period, 1, 2);
//----
   total = OrdersTotal();
//----
   if(total < 1) 
     {
       if(AccountFreeMargin() < (1000*Lots))
         {
           Print("We have no money. Free Margin = ", AccountFreeMargin());
           return(0);
         }
       //----
       if(iMAMy_0 > 0 && iMAMy_1 <= 0)
         {
           ticket = OrderSend(Symbol(), OP_BUY, Lots, Ask, 3, 0, 0, 0, 16384, 0, Green);
           //----
           if(ticket > 0)
               if(OrderSelect(ticket, SELECT_BY_TICKET, MODE_TRADES)) 
                   Print("BUY order opened : ", OrderOpenPrice());
           else 
               Print("Error opening BUY order : ", GetLastError()); 
           return(0); 
         }
       //----
       if(iMAMy_0 < 0 && iMAMy_1 >= 0)
         {
           ticket = OrderSend(Symbol(), OP_SELL, Lots, Bid, 3, 0, 0, 0, 16384, 0, Red);
           if(ticket > 0)
               if(OrderSelect(ticket, SELECT_BY_TICKET, MODE_TRADES)) 
                   Print("SELL order opened : ", OrderOpenPrice());
           else 
               Print("Error opening SELL order : ", GetLastError()); 
           return(0); 
         }
       return(0);
     }
//----
   for(cnt = 0; cnt < total; cnt++)
     {
       OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
       //----
       if(OrderType() <= OP_SELL &&   // check for opened position 
          OrderSymbol() == Symbol())  // check for symbol
         {
           if(OrderType() == OP_BUY)   // long position is opened
               if(iMAMy_2 < 0 && iMAMy_3 >= 0)
                   {
                     // close position
                     OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet);
                     return(0); // exit
                   }
           else // go to short position
             {
               if(iMAMy_2 > 0 && iMAMy_3 <= 0)
                 {
                   // close position
                   OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet);
                   return(0); // exit
                 }
             }
         }
     }
//----
   return(0);
  }
//+------------------------------------------------------------------+



Sample





Analysis



Market Information Used:



Indicator Curves created:


Indicators Used:




Custom Indicators Used:
MAMy v.3

Order Management characteristics:
Checks for the total of open orders
It automatically opens orders when conditions are reached
It Closes Orders by itself

Other Features:


BackTest : EURUSD on H1

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

BackTest : EURUSD on H1

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

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:0.00 Total Net Profit:0.00

BackTest : USDJPY on H1

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

Request Backtest for MAMy Expert_v1


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

Pair: Period: