double lots; if(OrderSelect(0,SELECT_BY_POS,MODE_HISTORY)) { if(OrderType()==6 && OrderProfit()>0) { if(AccountFreeMargin()>OrderProfit()*2) lots=MathAbs(MathCeil(-AccountFreeMargin()/OrderProfit()))*0.01; } else Comment("...not loaded all trades history... or it is maybe >0 ?1"); } else Comment("...not found first depo..."); Comment("lots=",lots);
or
if(AccountFreeMargin()>1000*2) lots=MathAbs(MathCeil(-AccountFreeMargin()/OrderProfit()))*0.01; else lots=0.01;
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
How do you write a code to increase the trading lot size by every (full) $1000 gain in account balance and the lot size should not round up ?
eg
Balance lot size
$1000 0.01
$1450 0.01
$2000 0.02
$2990 0.02
$3100 0.03