Profile Picture

placing orders when there is no open position

Posted By adiaco 6 Years Ago
Posted Wednesday January 25 2012
What is the best way to place orders when there is no open position to modify?


I understand the code

newOrder = pos.SubmitOrder(newOrderSettings);

This places an order to modify a current position pos.  But if OpenPositions == 0, this doesn't run during a simulation.  How do I just submit an order if there is no existing position open?

Also, is it possible to just define two different orders (in oppositie directions), and submit them both, then let 'pos' be equal to the one that gets filled?


Posted Wednesday January 25 2012
If there's no position you have to place an order by calling OpenPosition(). You can pass in a PositionSettings object which gives you a lot of control over the order, and there's even a PositionSettings.OpenOrder property that lets you modify the actual order object.

If you submit two orders in opposite directions with OpenPosition(), you will have two (pending) position objects. When the first order gets filled you can cancel the other one and set your "pos" variable to the newly opened position.


Similar Topics

Reading This Topic

2005-2018 © RightEdge Systems