if(conditions to go long met)
{
EnterLong();
}
if(conditions to go short met)
{
EnterShort();
}
more or less. what should happen is if, for example we are short, when the long conditions are met and EnterLong() is called, it closes out the short and goes long. But, and here are the conditions for the bug, if the stoploss is triggered at the same time the EnterLong() method is called, the stoploss will close out the order, and EnterLong() will close out the order making it up 1, then EnterLong() puts in the order to go long, making it up 2. so in short, when the stoploss and Enterlong() go at the same time, it puts in 3 buy orders instead of 2. is there anyway to prevent this from happening?

Comment