Hi there,
Is there any way to control the expiry of a Stop order? Trading spot forex using Oanda if I create a new stop order it expires at session close on the day of the order, i.e. 10:59 PM.
My code:
private IOrderPriced _exitLongStopOrder;
_exitLongStopOrder = OrderCreator.Stop(new SOrderParameters(Contracts.UserSpecified, "Buy Exit", EOrderAction.Sell));
exitLongStopOrder .Send(price, positionSize);
I'm aware that if I send some alternate text with the order it books it as a new Stop order so could potentially manipulate it to extend the order just before the close - however was looking for a cleaner way of doing it by just setting the initial expiry at 1 week.
Thanks in advance.
Alan
Stop Order Expiry
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: Stop Order Expiry
Hello Alan,
The orders are active at broker while they are sent by the strategy. That means the conditions for order generation should be met in your code on each bar close or each tick (if IOG=ON) calculation while you need to keep your orders active. TIF for the orders (DAY and GTC are available for OANDA) can be specified via the auto trading plugin settings only, not from the code.
The orders are active at broker while they are sent by the strategy. That means the conditions for order generation should be met in your code on each bar close or each tick (if IOG=ON) calculation while you need to keep your orders active. TIF for the orders (DAY and GTC are available for OANDA) can be specified via the auto trading plugin settings only, not from the code.