<code> input double Lots = 0.1; input double MaxLot = 10; input double Risk = 5; extern double InitialLot = 0.1; //прогресcия лота на каждые "ProgressiveBalans" extern double ProgressiveBalans = 1000; //шаг баланса //+-----------------------------------------------------------------+// double Lot() { double LotSize=MarketInfo(Symbol(),MODE_LOTSIZE); double MinLot=MarketInfo(Symbol(),MODE_MINLOT); double lot=Lots; lot=NormalizeDouble(AccountBalance()*InitialLot/ProgressiveBalans,1); //баланс меньше 1000 if(AccountBalance()<ProgressiveBalans) { lot=NormalizeDouble(AccountBalance()*Risk/LotSize,2); if(lot<=MinLot) lot=MinLot; if(lot>=MaxLot) lot=MaxLot; } // баланс уменьшился с 3100 до 2900 if(AccountBalance()< PrevBalance && (int)AccountBalance()/ProgressiveBalans<(int)PrevBalance/ProgressiveBalans) lot=lot-InitialLot; return(lot); } //+-----------------------------------------------------------------+// </code>
Andrju81