EA autoselects lot size based on equity

 
Hello, How do I set my EA to auto select the lot size based on the account balance. for example my risk reward ratio is 10% of the account size and my target is 50 pips per trade. if the account size is $1000 I would trade with 0.2 lot size. if balance is $200 I trade with 0.04 and so on. Someone help me with the MQL4 Code.
 
BensonMunene12:
Hello, How do I set my EA to auto select the lot size based on the account balance. for example my risk reward ratio is 10% of the account size and my target is 50 pips per trade. if the account size is $1000 I would trade with 0.2 lot size. if balance is $200 I trade with 0.04 and so on. Someone help me with the MQL4 Code.

You don't understand what risk reward ratio is.

if TP distance is double the SL distance (the account balance.from the open price) then R:R is 1:2

It cannot be a % of the account balance.