#property copyright "профэссор"

#property indicator_chart_window
int start()
  {
double MaxLot = MarketInfo(Symbol(),MODE_MAXLOT);
if(MaxLot>AccountFreeMargin()*0.99/MarketInfo(Symbol(),MODE_MARGINREQUIRED))//где 0.99 - коэффициент запаса
MaxLot=AccountFreeMargin()*0.99/MarketInfo(Symbol(),MODE_MARGINREQUIRED);

//Comment ("Макс.лот " ,MaxLot,"Спред ",MarketInfo(Symbol(),MODE_SPREAD),"пт","Стоп ",MarketInfo(Symbol(),MODE_STOPLEVEL),"пт");
//Comment ("Спред ",MarketInfo(Symbol(),MODE_SPREAD),"пт"); 
//Comment ("Стоп ",MarketInfo(Symbol(),MODE_STOPLEVEL),"пт");
Comment ("Макс.лот " ,MaxLot,"\n","Спред ",MarketInfo(Symbol(),MODE_SPREAD),"пт","\n","Стоп ",MarketInfo(Symbol(),MODE_STOPLEVEL),"пт");
   return(0);
  }
//+------------------------------------------------------------------+