How to automatically adjust trading lots when Equity changes up and down during running ea

TieuDuLong
9
TieuDuLong  

Example:  Step: (1000; 0.01)

       Equity   1,000 usd ---> Lot = 0.01

       Equity 10,000 usd ----> lot = 0.1

       Equity   9,000 usd ----> lot = 0.09

..........

It's been 6 months and I haven't found a solution yet.

Please help me.

TieuDuLong
9
TieuDuLong  

 When running it only get Equity at the start of running ea.

So the lot traded does not change when the Equity is changing.

Please help me!!

input double    MinEquity =200;
double lottrade;

void OnTick()
  {
  if(NewCandle())     //new candle begins
   {
      if(AccountInfoDouble(ACCOUNT_EQUITY)< MinEquity )
         {
         lottrade = 0.01;
         }
       else 
         {
         lottrade = (AccountInfoDouble(ACCOUNT_EQUITY)/MinEquity )*0.01;
         }
      --------------------------