Percentage of Equity

 
For my EA, rather than using a predetermined number of lots, I would like each trade to be a certain percentage of my equity, probably something like 5-10%. Can someone help me with the language to make that work?

thanks
 
lot=NormalizeDouble(AccountFreeMargin()*MaximumRisk/1000.0,1);