shanmugapradeep
Member
Hello,
Logic i am looking for :
If floating Balance is less than 1% in negative of account balance => Close the trade (OR) if floating balance is less than $100 in negative => Close the trade
Code :
Error : Balance, Equity and Floating balance do not change in Real time. Instead it takes the initial value when installing the EA and the values remains same.
Logic i am looking for :
If floating Balance is less than 1% in negative of account balance => Close the trade (OR) if floating balance is less than $100 in negative => Close the trade
Code :
Code:
extern int negative_equity_percentage = 1;
extern int negative_equity_balance = 50;
double equity = AccountEquity();
double Account_balance = AccountBalance();
double floatingBalance = equity - Account_balance;
void CheckAndCloseTrade()
{
double NewspercentageThreshold = 0.01 * negative_equity_percentage * Account_balance;
if ((floatingBalance < NewspercentageThreshold) || (floatingBalance < -negative_equity_balance)) {
closetrade();
}
}
void closetrade() {
//Closing Trade Logic
}
int start()
{
CheckAndCloseTrade(;
return(0);
}
Error : Balance, Equity and Floating balance do not change in Real time. Instead it takes the initial value when installing the EA and the values remains same.