In my strategy code, I use EnterLongStopMarket if my conditions are perfectly met. It works just fine placing the order and waiting for the price till it reaches it, then fills the order. However, sometimes the price goes down and doesn't reach to the level I hope for. So, in this case, I'd like to tell it that after you place the order and then the price goes down to a certain level, ExitLongStopMarket(). Here's the logic I'm using and it's not giving me any errors while compiling, but my orders are still not cancelled even the price goes down to the level where I'd to exit:
If (my condition is met)
{
EnterLongStopMarket();
}
// the above part is done elegantly
// now here's the part where I'm confused and where I'd tell it that after you place the order (as in above) and the price goes down to a certain
// level, ExitLongStopMarket()
If (High[0] <= (EMA1[0] + (40 * TickSize))) // that's the price level when is reached, I'd like to exit or cancel any pending orders
{
ExitLongStopMarket();
}
Appreciate your kind support
Comment