Folgende Funktion wird nun benutzt
PHP-Code:
bool CheckMoneyForTrade(string symb, double lots,int type)
{
double free_margin=AccountFreeMarginCheck(symb,type, lots);
//-- if there is not enough money
if(free_margin<=0 || AccountInfoDouble(ACCOUNT_MARGIN_FREE) <=10)
{
string oper=(type==OP_BUY)? "Buy":"Sell";
Print("Not enough money for ", oper," ",lots, " ", symb);
return(false);
}
//--- checking successful
return(true);
}
diese Funktion wird vor dem Ordersend so aufgerufen
PHP-Code:
if (!CheckMoneyForTrade(_Symbol,Entry_Amount,command)) return;//Check money for trade
Das kuriose ist nun das es an sich bei Forex Paaren funktioniert. Allerdings bei Gold oder Indizes führt der EA teilweise noch die Ordersend funktion aus und bekommt ein Ordersend error 134.
Kann einer eventuell noch helfen