Hi all,
I have started the test this morning and I might have found a bug with the
global basket closure feature.
When there is no sufficient margin to allow trading :
Code: Select all
//Check that there is sufficient margin for trading
if(!MarginCheck())
{
DisplayUserFeedback();
return;
}//if (!MarginCheck() )
then OnTimer function is left, leaving the global basket closure condition unchecked :
Code: Select all
//Have we reached a whole platform basket target?
if (AllTradesBelongToBasket)
{
if (HaveWeReachedGlobalBasketTP() )
{
Alert("Global profit target reached. All trades should have closed.");
NuclearOption();
//All trades must be closed, so keep banging away until they are.
if (ForceTradeClosure)
{
while (ForceTradeClosure)
{
NuclearOption();
if (ForceTradeClosure)
Sleep(5000);//5 seconds
}//while (ForceTradeClosure)
}//if (ForceTradeClosure)
}//if (HaveWeReachedGlobalBasketTP() )
}//if (AllTradesBelongToBasket)
Consequently, the basket closure won't work when we have a certain amount of trade open but with limited margin. Leaving the poor trades up to themselves
A solution would be to move the basket closure condition before the margin check. Anyone can confirm ?
I am testing this solution right now.