Trade Script - Lot size equal based upon Equity

 

I've got a simple script that will initiate a trade. I would like to make the lot size in OrderSend equivalent to a percentage of my equity. How can this be done?


AccountEquity*.1 ???

 

I believe this is it:


int Lots = NormalizeDouble(AccountFreeMargin()*0.02/1000.0,1);

int ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,1,Ask -25*Point,Ask+15*Point,"Buy Order",255,0,Green);

if(ticket<1)


Let me know if this is correct.

 
It seems correctly.
Reason: