For you to use balance like that the orders have to be already closed so you have to use a different function.
Please see these:
For the function AccountInfoDouble()
Account balance in the deposit currency
Account credit in the deposit currency
Current profit of an account in the deposit currency
Account equity in the deposit currency
Account margin used in the deposit currency
Free margin of an account in the deposit currency
Account margin level in percents
Margin call level. Depending on the set ACCOUNT_MARGIN_SO_MODE is expressed in percents or in the deposit currency
Margin stop out level. Depending on the set ACCOUNT_MARGIN_SO_MODE is expressed in percents or in the deposit currency
Initial margin. The amount reserved on an account to cover the margin of all pending orders
Maintenance margin. The minimum equity reserved on an account to cover the minimum amount of all open positions
The current assets of an account
The current liabilities on an account
The current blocked commission amount on an account
record the account balance on EA start.each time your equity reaches your 5% gain (your smaller goal), close all positions, then set the current account balance as a new starting point.
double STARTING_BALANCE; // a global variable of course
STARTING_BALANCE = AccountInfoDouble.....(ACCOUNT_BALANCE....)
if there's open positions right now.... // check by PositionsTotal()...
current_EQUITY = AccountInfoDouble....(ACCOUNT_EQUITY....) // current floating equity
if(current_EQUITY >= STARTING_BALANCE * 105 * 0.01)
// here close all open positions....
STARTING_BALANCE = current_EQUITY;
yes .. agree with you