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);
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.