What I want to do is the following:
I want to submit an entry stop or limit order in OnBarUpdate as long as I am Flat. If the bar closes with no fill, I would like to submit a new entry order based on the bar that just closed with no fill. That doesn't seem to work now, how can I make it work?
Note: when I enter via stop or limit, I also set a stoploss and target some number of pips away. If the order fills and closes, I can indeed submit a new order at the end of the bar where it clloses. In other words, something is not working if the order gets canceled, but it DOES work if the order gets filled and closed.
How do I fix this?
UPDATE: Ok, it seems that if I resubmit the order (using say the same call to EnterLongStopMarket or EnterLongLimit with perhaps a modified price) it all works fine. The entry is not canceled but is instead moved to the sam price. But If I want to enter an order in the OPPOSITE direction it does not work! So for example, if I submit an EnterLongStopMarket and that does not fill, on the next call to OnBarUpdate I try to enter a EnterShortStopLimit. That order just sits there and never does anything (or is rejected, I'm not sure). The originall buy stop market is canceled and the new sell stop market doesn't ever appear anywhere.
How to fix?
Comment