Scripts: Revers

 

Revers:

Revers Script.

Author: Collector

 
english please...
 

Please Translate English.

nt SymbolOrders;         // êîëè÷åñòâî îğäåğîâ ïî äàííîìó ñèìâîëó
   int cnt;                  // ñ÷åò÷èê îğäåğîâ (îáõîä÷èê)
   int buyOrders,sellOrders; // êîëè÷åñòâî îğäåğîâ â ğûíêå (îòëîæåííûå íå ñ÷èòàåì)
   double buyLots,sellLots;  // îáùèé îáúåì îòêğûòûõ îğäåğîâ â ïîêóïêó è ïğîäàæó
   double reversLot;         // îáúåì ğàçâîğîòíîãî îğäåğà

 
How can this be modified to multiply the new lot size by 3, 4, 5, etc? Also, do you have an english version so I can modify to suit?
 

... May require some fine tuning. I simply sent it to google to translate.


 // +------------------------------------------------------------------ +
 // | Revers.mq4 |
 // | Copyright © 2005, MetaQuotes Software Corp.  |
 // | Http://www.metaquotes.ru/forum/6749/ |
 // +------------------------------------------------------------------ +
 # Property copyright "Copyright © 2005, MetaQuotes Software Corp." 
 # Property link "http://www.metaquotes.ru/forum/6749/" 
 
 extern int Slippage = 3; 
  // +------------------------------------------------------------------ +
 // | Script program start function |
 // +------------------------------------------------------------------ +
 int start ()
   {
 //----
    int SymbolOrders;            // number of orders in this symbol
    int cnt;                     // counter orders (lineman)
    int buyOrders, sellOrders;   // number of orders in the market (pending is not counted)
    double buyLots, sellLots;    // total volume of open orders to buy and sell
    double reversLot;            // the amount of the reversal order
    int intLots;                 // auxiliary variable
    int ticket;                  // ticket order reversal
 //----
    if (! IsDemo ())             // protection from accidental start a real account
       {
         Alert ("Work is prohibited on the real!"); 
          return;                // shutdown script
       }
 //----
    if (OrdersTotal () == 0)
       {
         Alert ("Order not found"); 
          return;                // shutdown script
       }
 //----
    for (cnt = OrdersTotal () - 1; cnt> = 0; cnt -)         // loop through orders
      {
        if (OrderSelect (cnt, SELECT_BY_POS, MODE_TRADES))  // if the order is chosen
           {
             if (OrderSymbol ()! = Symbol ()) 
                 continue;                                  // if the selected order is not in our character
             // - Move to the next warrant
             if (OrderType () == OP_BUY) 
               {
                 buyOrders++;                               // increase the counter orders at Buy
                 buyLots = buyLots + OrderLots ();          // increase the volume of orders at Buy
               }
             if (OrderType () == OP_SELL) 
               {
                 sellOrders++;                              // increase the counter orders at Sell
                 sellLots = sellLots + OrderLots ();        // increase the volume of orders to Sell
               }
           }
      }
    // Orders are regarded, and now need to check - is there an order in the market.
    if (buyOrders + sellOrders == 0) 
      {
        Alert ("market orders for the symbol", Symbol (), "found"); 
         return; // shutdown script
      }      
    // We got to this place - it means the order is still
    if (buyOrders * sellOrders! = 0)      // we only work with either orders Buy or Sell,
                                          // But not both
       {
         Alert ("We have the symbol", Symbol (), "    ", BuyOrders," and warrants to purchase "  
                sellOrders, "orders in the market. Work stopped"); 
          return; // shutdown script
       }
    // We got to this place - it means we have only one type of warrant
    if (buyOrders> 0)
      {
        intLots = 2 * 10 * buyOrders;                 // integral double the number of lots
        reversLot = NormalizeDouble (intLots / 10, 1) // get the amount of the reversal order
        RefreshRates (); 
         ticket = OrderSend (Symbol (), OP_SELL, reversLot, Bid, Slippage, 0, 0,  
                            "Revers order", 0, 0, Red); 
         if (ticket <0)
          {
            Alert ("Unable to open an order SELL", Symbol (), "    ", ReversLot," at ",  
                   Bid, "Error", GetLastError ()); 
           }
      }
 //----
    if (sellOrders> 0)
      {
        intLots = 2 * 10 * sellOrders;                // integral double the number of lots
        reversLot = NormalizeDouble (intLots / 10, 1) // get the amount of the reversal order
        RefreshRates (); 
         ticket = OrderSend (Symbol (), OP_BUY, reversLot, Ask, Slippage, 0, 0,  
                            "Revers order", 0, 0, Blue); 
         if (ticket <0)
          {
            Alert ("Unable to open an order SELL", Symbol (), "    ", ReversLot," at ",  
                   Ask, "Error", GetLastError ()); 
           }
      }
 //----
    return (0); 
    }
 // +------------------------------------------------------------------ + 
Reason: