English

## Calculate lots size

 41 KeepMarcos 2016.04.17 20:51 #   ```bool lotopt=true; double mrg,lot; double Lots = 1.0;``````extern double               Lots = 1.0; //+------------------------------------------------------------------+ //| Expert initialization function                                   | //+------------------------------------------------------------------+ int LotOpt() //--function: calculation Optimization Lots    {       if (lotopt==true)          {            //----            mrg = AccountBalance();            if (mrg < 1000) {lot = 0.1;}            if ((mrg > 1000) && (mrg < 5000)) {lot = 0.1;}            if ((mrg > 5000) && (mrg < 9000)) {lot = 0.2;}            if ((mrg > 9000) && (mrg < 13000)) {lot = 0.3;}            if ((mrg > 13000) && (mrg < 17000)) {lot = 0.4;}            if ((mrg > 17000) && (mrg < 21000)) {lot = 0.5;}            if ((mrg > 21000) && (mrg < 25000)) {lot = 0.6;}            if ((mrg > 25000) && (mrg < 29000)) {lot = 0.7;}            if ((mrg > 29000) && (mrg < 33000)) {lot = 0.8;}            if ((mrg > 33000) && (mrg < 37000)) {lot = 0.9;}            if ((mrg > 41000) && (mrg < 45000)) {lot = 1.0;}            if (mrg > 45000) {lot = 1.5;}          }       else lot = Lots;       return(lot);       //----    } //-end LotOpt() void OnTick()   { //---    OrderSend(Symbol(),OP_SELL,lot,Bid,0,0,0,NULL,1,0,Red);   }```