Hello SteveSteveHopwood wrote:Re the rapid opening/closing of trades thingy, no guarantee that what I am about to write is accurate but I have been involved with Empty4 long enough to be reasonably sure that it is.
Between them, Matt and Phil have provided industrial-strength code to overcome the more criminally-programmed aspects of this bloody platform.
Users of EA's must ensure that they run Matt's ForceHistorical script thingy, linked in the first post of every one of my threads since Matt first published it, before running the EA on a new platform. Not many people bother to read my post 1 properly, and have only themselves to blame for ignoring the information contained within it.
This is not to say definitively that there is no bug in the EA code, but until it manifests itself on my platform, there is nothing I can do about it. These days, I am far more inclined to blame Empty4 than once I was.
I suggest to include this check module to avoid all bad surprise in future :
Code: Select all
// Try to avoid rapid open/close trades
bool CheckIfBadTrade()
{
int NbHistoTrade = OrdersHistoryTotal();
if (NbHistoTrade == 0) return(false);
// check max last 10 trades
int NbTradeToAnalyse = MathMin(10, NbHistoTrade);
for (int i=NbHistoTrade; i > NbHistoTrade-NbTradeToAnalyse; i--)
{
if (OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)==false) continue;
if (OrderSymbol() != Symbol()) continue;
if (TimeCurrent() - OrderOpenTime() < 60) return(true);
}
return(false);
} //bool CheckIfBadTrade()
Code: Select all
if (!StopTrading && CheckIfBadTrade()==false)
{
LookForTradingOpportunities();
}//if (!StopTrading)Philippe