Setting an expire date on entry orders

Moderator: admin

Setting an expire date on entry orders

Postby Fartlek » Wed Jun 17, 2020 12:28 pm

Hi, all.

I'm creating limit entry order with a good till date (GTD) time in force value, but I can't figure out how to do that. The SDK 3 docs don't have any examples.

I've got this code:
Code: Select all
local order = core.valuemap();
order.Command = "CreateOrder";
order.OrderType = "LE";
order.OfferID = Offer.OfferID; -- Offer being core.host:findTable("offers"):find("Instrument", instance.bid:instrument())
order.AcctID = Account; -- instance.parameters.Account
order.BuySell = "B";
order.PegPriceOffsetPipsStop = -20.545455;
order.PegTypeStop = "M";
order.PegPriceOffsetPipsLimit = 102.727273;
order.PegTypeLimit = "M";
if (not CanClose) then -- CanClose being core.host:execute("getTradingProperty", "canCreateMarketClose", instance.bid:instrument(), Account)
    order.EntryLimitStop = "Y";
end
order.Rate = 1.118270;
order.GTC = "GTD";
local expireTimestamp = gSource:date(period) + TFDuration; -- now + some number of hours (expressed as days)
-- gSource is ExtSubscribe(1, nil, instance.parameters.TF, instance.parameters.Type == "Bid", "bar");
order.ExpireDate = expireTimestamp;


Now I can place this with
Code: Select all
terminal:execute(100, order);
and it will place the order. It won't give it an expiry date, though. My ExpireDate will be something like 43830.208333. The docs aren't particularly expressive:
The date/time until which the order will be valid. Used for GTD orders only. If this value is not specified for the GTD order the default value of the currect trading date end - 1 minute will be used. The date/time should be specified in EST/EDT time.

I don't know whether I am using the wrong format (should I be using OLE, a date table or somthing else?) I don't get any feedback from the terminal, either.
Fartlek
 
Posts: 4
Joined: Wed Jun 17, 2020 11:59 am

Re: Setting an expire date on entry orders

Postby Apprentice » Wed Jun 17, 2020 3:29 pm

Your request is added to the development list.
Development reference 1508.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36341
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Setting an expire date on entry orders

Postby Apprentice » Thu Jun 18, 2020 5:24 am

There is no "good till date" orders. GTD means "good till day".
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36341
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Setting an expire date on entry orders

Postby Fartlek » Thu Jun 18, 2020 5:54 am

Thanks for getting back to me, Apprentice.

I'm looking in the docs at Create an Entry Limit Order which contains this table ([table] tags aren't working):
Valuemap field=GTC
Datatype=string
Description=Time-In-Force value.

Can be GTC (Good-Till-Cancelled), GTD (Good-Toll-Date) or DAY (Good-Till-End-Of-Day).

The value is optional.

Conditional orders are GTC orders by default.

Valuemap field=ExpireDate
Datatype=DateTime
Description=The date/time until which the order will be valid. Used for GTD orders only. If this value is not specified for the GTD order the default value of the currect trading date end - 1 minute will be used. The date/time should be specified in EST/EDT time.

It seems like this exists since it's in the Indicore SDK 3 docs. I can't figure out how to set an ExpireDate, though. I've tried a OLE timestamp, a date table and a formatted date; ExpireDate always blank in the Orders table.
Fartlek
 
Posts: 4
Joined: Wed Jun 17, 2020 11:59 am

Re: Setting an expire date on entry orders

Postby KevinH » Thu Jun 18, 2020 11:09 am

I would be interested in the solution to this too.

I want to set a entry order (with stop and limit) that expires in 2 candles time. So if the 1 hour chart, the in 2 hours; if the 8 hour chart then 16 hours.

Cannot seem to figure this one out!

Let me know if you can get it to work Fartlek
KevinH
 
Posts: 7
Joined: Sun Jun 07, 2020 4:45 pm

Re: Setting an expire date on entry orders

Postby Apprentice » Fri Jun 19, 2020 4:24 am

Your request is added to the development list.
Development reference 1518.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36341
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia



Return to Indicator Development

Who is online

Users browsing this forum: No registered users and 14 guests