Please look at TimeInForce-part of place-order code

My TimeInForce part of the order:

"GTD" + " " + yyyymmdd + " " + hh:mm:ss + " " + "GMT"

worked well in the past, but now with new TWS Release Notes 10.17/ TWS Api Build 10.18.1 an error message occurs:

Error 343: Endtime: The date, time, or time-zone entered ist invalid. The correct format is yyyymmdd hh:mm:ss xxx where yyyymmdd and xxx is optional. E.g.: 20031126 15:59:00 US/Eastern Note that there is a space the date and time and betwe --> here stops the message

after deleting + " " + "GMT"

Error 2174: You submitted request with date-time attributes without explicit time zone. Please switch to use yyyymmdd-hh:mm:ss in UTC or use instrument timezone, like US/Eastern. Implied time zone functionally will be removed in the n --> here stops the message

Please remark: time zone of the instrument's exchange instead of the user's time zone is needed in order-code

TWS Release Notes | Interactive Brokers LLC

TWS API v9.72+: Guide Updates (

Hi @Beate

IB has changed the timezone format in TWS 10.17+. By the way, it's not recommended to use the latest TWS version, instead use the latest stable version (10.12 atm)
With the release of TWS 10.17 and TWS API 10.18 clients now can send date/time in different formats:

API allows UTC format "yyyymmdd-hh:mm:ss" in date/time fields.
Example: 20220930-15:00:00
API allows date/time field format with instrument's exchange timezone (for all non-operator fields) and operator's time zone (for all fields).
Example: IBM 20220930-15:00:00 US/Eastern

At the moment you could simply replace GMT by adequate timezone (something like Europe/London ?). However note that support for implicit (default/user) timezone will be completely removed in the next major API version so due to ever-changing TWS API it's best to specify time with an explicit time zone appended. Personally I always use instrument timezone.

Dear alligator,

thanks for your message. I thought, I solved the problem, but in the last days I learned that the code plays with me cat and mouse. :dizzy_face:

I replaced my "old" well running solution which was: "GTD YYYYMMDD hh:mm:ss GMT" with different code-changes like:

yyyymmdd hh:mm:ss
yyyymmdd-hh:mm:ss uct
yyyymmdd hh:mm:ss uct
yyyymmdd hh:mm:ss met
yyyymmdd hh:mm:ss us/central and of cours also with "-" between date and time and

also where hour is the exchange/instrument timezone, e.g. -x hours. combined with UCT or US/Central.

The remarkable: what wworked well yesterday the next day didn't work :very surprised:

Maybe the issue is the "GTD" . You mention "IBM" in example.

What I did not understand yet is, where is my default in my code line?
Remove GTD? But where place it?
When I want to implement the instrument timezone: in hour-field is to use the hour of exchange of instrument e.g. GLOBEX and add name of exchange timezone GLOBEX = US/ Central. Is to use US/Central or UCT?
As written above I tried a lot what was written in TWS-information sources, but nothing worked well. The information I got from github/ tws-api didn't help me to solve the problem completly.

Now I installed TWS version 10.12.2 and will use my "old" code line:
GTD YYYYMMDD hh:mm:ss GMT and it works... But it is not a solution for the next versions...

Would you be so kind and recomend me a link, where I can get some more information about the changes which will be in the next TWS versions and how I have to change my code?

Best regards

Hi @Beate,

First as I wrote it's not recommended to use unstable TWS versions, anything could happen. Not only the API is different but IBKR servers and message format you connect to/with can vary, and they may be updated anytime by IB. This could explain why you get different results for each connection (this happened to me years ago with data, lesson learned). Simply use a stable version it should be stable :wink:.

Second I've given you the official info about the new format
New Orders Date/Time Format
Here are other docs, re TWS:
Last the format I posted (YYYYMMDD-HH:MM:SS TZ with TZ e.g US/Central US/Eastern UTC MET etc) should work in future versions. My advice: either use UTC or instrument timezone, nothing else.

PS: TWS v 981 works fine, no reason to upgrade yet.

1 Like

Dear alligator,

thanks for your answer und sorry for my late response :wink:

Yes, as written in my post, I switched to stable version, this is version 10.12.2. Now my "old" code works well. I use the version because there were problems with auto-restart TWS.

The needed change of the code in the future I will keep an eye on it, because even if I have changed the code into what should be right like written in the files at interactivebrokers, sometimes it worked and somtimes id didn't work. Like you wrote ... We will see ... :wink:

Once more : thanks a lot for your messages


Hi Alligator,

Unfortunately, I was advised by IB to use the latest version due to my quotes on futures not updating properly. Anyway, I am getting that exact same MSG 36 Error 2174 error message in the plugin status. I am not sending anything to IB via code. Is there a way to fix this error in Amibroker or is it with the IB plugin?

Best regards,

What IB support says not always is the right thing to do. In case of any problems with IB, first thing to try is to DOWNGRADE, not upgrade, because it is IB "tradition" to introduce bugs and incompatibilities in newer releases that only get eventually fixed later if more people report problems to them. Older versions are usually more reliable than new ones.

Yes, old version worked well ... until today :frowning:

I reinstalled stable version (10.19.1g) - older are not loadable - but same problem.

Which correction in code is needed? I would be very happy, if anyone could pblish a working solution.


I'm using TWS 10.19, and what's strange is that "US/Eastern" doesn't work, but "America/New_York" does, which is contrary to the error message and API docs. I'm in the US in the Eastern time zone.

This is the string that works:
GTD 20231117 12:54:26 America/New_York

These don't work, either defaulting to GTC or returning an error:
GTD 20231117 13:00:17 US/Eastern
GTD 20231117 12:55:16 EST
GTD 20231117 12:55:16 EDT
GTD 20231117-17:57:00 UTC
GTD 20231117-17:57:00 GMT

For reference, here's the error. You can see that my strings are properly constructed and IB is returning errors anyway:

  1. End Time: The date, time, or time-zone entered is invalid. The correct format is yyyymmdd hh:mm:ss xx/xxxx where yyyymmdd and xx/xxxx are optional. E.g.: 20031126 15:59:00 US/Eastern Note that there is a space between the date and time, and between the time and time-zone. If no date is specified, current date is assumed. If no time-zone is specified, local time-zone is assumed(deprecated). You can also provide yyyymmddd-hh:mm:ss time is in UTC. Note that there is a dash between the date and time in UTC notation.

I hope this helps someone.