Hi! I was testing the Basket Profit/Loss function and I found a bug.
Example:
Profit=10
Loss=5
When one of the those levels is reached the EA doesn't close all the traders, if you know how to correct it, please let me know, above you can check the code that I am using.
extern bool UseProfitLoss=true;
extern int BasketProfit=50;
extern int BasketLoss=100;
//Basket Profit/Loss
if(UseProfitLoss)
{
CurrentBasket=AccountEquity()-AccountBalance();
if(CurrentBasket >= BasketProfit || CurrentBasket <= (BasketLoss*(-1)))
{
NewOrders=false;
CloseSellOrders(Magic);
CloseBuyOrders(Magic);
return(0);
}
}
Thanks in advance!



Reply With Quote

