The first thing I want to do is to set up a strategy to place a limit buy order which if isn't filled within a few bars is then canceled.
The second thing I want to do is to not short if I've only been long for a few bars.
I'm totally lost on question 1. How do cancel an order if my code is EnterLong(Shares, "Long");? How do I reference this order to find out its status and such?
I've tried to detect how many bars have passed with the following code:
if (BarsSinceEntry() < 10 )
...
entryOrder = EnterLong(Shares, "Long");
The problem here is that as soon as I add the if statement with BarsSinceEntry() my strategy never goes long during back testing. If I comment out that if statement there is no problem with going long. (The EnterLong is outside of the if logic)

Comment