One glitch driving me crazy.

 

Okay so I'm creating a martingale EA...

So I want to record the account balance, then make a trade, then if the new account balance is bigger than the previous account I want lot = 0.1; If the new balance is smaller than previous balance, then I want lot=lot*2; (I have static double lot)...

All I want to know is how to save the Account balance before I make the trade so that I can compare it with the account balance after the trade...

Thanks a lot

Dohan

 
Dohan:

Okay so I'm creating a martingale EA...

All I want to know is how to save the Account balance before I make the trade so that I can compare it with the account balance after the trade...
  1. Guaranteed to blow your account eventually.
  2. static double previousBalance;
    :
        int ticket = OrderSend(...)
        if (ticket < 0)
           Alert("OrderSend failed: ", GetLastError());
        else previousBalance = AccountBalance();
    

 

Before considering using martingale you should backtest your strategy to find how many consecutive losses you get

 
Thanks!