_Open_LOCK





//+------------------------------------------------------------------+
//|                                                   _Open_LOCK.mq4 |
//|                                           "ÑÊÐÈÏÒÛ ÄËß ËÅÍÈÂÎÃÎ" |
//|             Ñêðèïò îòêðûâàåò îäèí LOCK äëÿ âñåõ îòêðûòûõ ïîçèöèé |
//|                                  (åñëè õâàòèò äåíþøêè)           |
//|                           Bookkeeper, 2006, yuzefovich@gmail.com |
//+------------------------------------------------------------------+
#property copyright ""
#property link      ""
#property show_inputs // Åñëè åñòü æåëàíèå ìåíÿòü ýêñòåðíû â ïðîöåññå
//----
extern int    DistSL     = 35;   // StopLoss â ïóíêòàõ
extern int    DistTP     = 35;   // TakeProfit â ïóíêòàõ
extern int    Slippage   = 7;    // Ïðîñêàëüçûâàíèå
extern bool   StopLoss   = true; // Ñòàâèòü èëè íåò
extern bool   TakeProfit = true; // Ñòàâèòü èëè íåò
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void start() 
  {
   int    Total, i, Pos, Error, MinLotDgts;
   int    Result;
   double MinLot = MarketInfo(Symbol(), MODE_MINLOT);   
   double SL = 0, TP = 0, Stake, BuyLots = 0, SellLots = 0;   
   Total = OrdersTotal();
   if(Total > 0) // Åñëè åñòü îðäåðà
     {
       for(i = Total - 1; i >= 0; i--) 
         {
           if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES) == true)  
             {
               Pos = OrderType();
               Stake = OrderLots();
               if((OrderSymbol() == Symbol()) &&
                  (Pos == OP_BUY || Pos == OP_SELL)) // Ñìîòðèì òîëüêî îòêðûòûå Buy è Sell
                 {                                   // â àêòèâíîì îêíå
                   if(Pos == OP_BUY) 
                       BuyLots = BuyLots + Stake;    // Ñóììèðóåì Ëîòû îòêðûòûõ Buy
                   else 
                       SellLots = SellLots + Stake;  // Ñóììèðóåì Ëîòû îòêðûòûõ Sell
                 }
             }
         }
       if(MinLot < 0.1) 
           MinLotDgts = 2;
       else
           if(MinLot < 1.0) 
               MinLotDgts = 1;
           else 
               MinLotDgts = 0;
       Stake = NormalizeDouble(BuyLots - SellLots, MinLotDgts);
       if(Stake != 0) // Åñëè åñòü ÷òî ËÎÊèðîâàòü
         {
           if(Stake > 0) // ËÎÊèðóåì ïðîäàæåé
             {
               RefreshRates();
               if(StopLoss == true) 
                   SL = NormalizeDouble(Ask + DistSL*Point, Digits);
               if(TakeProfit == true) 
                   TP = NormalizeDouble(Bid - 2*DistTP*Point, Digits);
               Result = OrderSend(Symbol(), OP_SELL, Stake, Bid, Slippage, SL, TP, "");
             }
           else // ËÎÊèðóåì ïîêóïêîé
             {
               RefreshRates();
               Stake = -Stake;
               if(StopLoss == true) 
                   SL = NormalizeDouble(Bid - DistSL*Point, Digits);
               if(TakeProfit == true) 
                   TP = NormalizeDouble(Ask + 2*DistTP*Point, Digits);
               Result = OrderSend(Symbol(), OP_BUY, Stake, Ask , Slippage, SL, TP, "");
             }
           if(Result <= 0) 
             { 
               Error = GetLastError(); 
               Alert("_Open_LOCK: LastError = ", Error); 
             }
           else 
               Error = 0;
         }
       else 
           Alert("_Open_LOCK: BuyLots = SellLots");
     }
   return(0);
  }
//+------------------------------------------------------------------+





Sample





Analysis



Market Information Used:



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:

It issuies visual alerts to the screen

BackTest : EURUSD on H1

From 2009-11-01 to 2009-11-30 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

BackTest : EURUSD on H1

From 2009-12-01 to 2010-01-17 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 : EURUSD on H1

From 2009-08-01 to 2009-10-01 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-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.00 Total Net Profit:0.00

BackTest : GBPUSD on H1

From 2010-01-01 to 2010-04-16 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

Request Backtest for _Open_LOCK


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

Pair: Period: