extern double Lot = 0.3;
extern bool use_per_of_depo = true;
extern double per_of_depo = 2.3;
int Start()
{
1)if(use_per_of_depo) Lot=Lot_of_percent_of_deposit(per_of_depo);
...
return;
}
double Lot_of_percent_of_deposit(double Risk)
{
2)double Free_margin = AccountFreeMargin();
3)double One_Lot_cost = MarketInfo(Symbol(),MODE_MARGINREQUIRED);
4)double Step_lot = MarketInfo(Symbol(),MODE_LOTSTEP);
5)double Lot_per = MathFloor(Free_margin*Risk/100/One_Lot_cost/Step_lot)*Step_lot;
6)return(Lot_per);
}