Stop Order Expiry

Questions about MultiCharts .NET and user contributed studies.
ascales
Posts: 36
Joined: 06 Jan 2017
Has thanked: 4 times
Been thanked: 2 times

Stop Order Expiry

Postby ascales » 11 Sep 2017

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

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Stop Order Expiry

Postby Henry MultiСharts » 12 Sep 2017

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.

ascales
Posts: 36
Joined: 06 Jan 2017
Has thanked: 4 times
Been thanked: 2 times

Re: Stop Order Expiry

Postby ascales » 14 Sep 2017

Hi Henry,

Thanks, surprisingly I had not seen that option.


Return to “MultiCharts .NET”