Expiration date format

Created at 04 Oct 2012, 12:26
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
FU

FurFighter

Joined 04.10.2012

Expiration date format
04 Oct 2012, 12:26


Hi there.

I'm unable to find any examples of the format required for the expiration date when using a CreateBuyStopOrder, even the ExpirationTime help page just uses "null":

[/docs/reference/calgo/api/pendingorder/expirationtime]

Does anyone know the proper format to use?  It would be useful to know how to specify an exact date and time, and also how to specify a number of hours after the trade is initiated.

Thanks!


@FurFighter
Replies

rkokerti
04 Oct 2012, 16:04

Hi!

Try this:

Trade.CreateBuyStopOrder(Symbol,Volume,TargetPrice,StopLoss,TakeProfit,Exp);

or

Trade.CreateSellStopOrder(Symbol,Volume,TargetPrice,StopLoss,TakeProfit,Exp);

Where Exp:

DateTime Exp = MarketSeries.OpenTime.LastValue.AddMinutes(60);

or

DateTime Exp = MarketSeries.OpenTime.LastValue.AddDays(1);

or

DateTime Exp = MarketSeries.OpenTime.LastValue.AddHours(1);

depends on your time scale. I hope it will help you.

 


@rkokerti

FurFighter
04 Oct 2012, 20:23

Thanks, I'll give it a go!


@FurFighter