Thank you for this extract from your extended response you generated on the IB support messaging platform.
I copy your full response below, for the benefit of other Amibroker users, including @Tomasz who I guess would be very concerned if all Amibroker users using IB plugin and TWS could not use Amibroker with TWS due to incorrect open prices.
I respectfully disagree with your statement that "This is neither IB issue nor Amibroker issue" and offer my reasons:
The open prices must be correct regardless of anything else...
When Amibroker generates higher interval candles based on the data received from TWS, it does so without changing TWS data in any way.
According to your response, TWS passes the previous Open price where there is no real trade (i.e non existent trade during the first few 1 minute intervals). So in case IGO it passes $10.85 (the previous day Close price) as the Open price for all dummy records, inserting zero as the volume, until the real trade occurs several minutes later.
As a result any Amibroker user trading 10 minutes candles or any other interval, will then have $10.85 as the Open price for the first 10min with the closing price of $10.80 (see the timestamp 10:10:00 in the picture above) . Clearly that is wrong, because the Open price for the first 10 minute interval is $10.71 and Close is $10.80.
TWS does not have such a problem when it generates 10 minutes candles on its own charts - since it does not pass to its own charts anything else but records of real trades (not the dummy ones that TWS passes to Amibroker).
The following day however when backfilling data to Amibroker, TWS removes the dummy records all together and only passes data from real trades. This then corrects the problem for the previous day. I only wish I could trade using the previous data - but I have to trade with what TWS has given to Amibroker and regrettably the passed data are incorrect and totally unusable.
Btw, everything starts ok in the morning until I either re-connect to the TWS or log out and then log back in later on. At that point TWS generates the initial dummy records and Amibroker simply displays what TWS sent.
I repeat, this problem only started to occur recently and certainly not over the past 15 or more years I've been using Amibroker and TWS with IB-plugin. For some reason TWS finds it necessary to generate dummy records if there are no real trades and that has never occurred before to the best of my knowledge.
@Tomasz may have a better view of the IB-plugin interaction with the TWS, but one thing is certain, something has changed in the most recent releases of TWS so that it creates dummy, zero volume records, when the Exchange opens and until the first real trade occurs.
I believe that this is an issue that would affect all Amibroker users using TWS.
Please consider the above as I, and other Amibroker users, may not be able to continue to use TWS and IB in conjuction with Amibroker.
Extended Response from Interactive Brokers @ChriX
Dear Mr. Brkic,
I just read the question that you asked to Tomasz in Amibroker forum. I understand the reason now.
As you requested the last trade prices, only last trade price will be returned.
If the stock has 0 volume, IB server will not return None/ Null values.
Instead, IB will return the last updated trade prices with more than 0 volume to you.
Your attached image IGO-ASX-S-AUD explains this concept.
Date: Open: Volume:
26/10/2023 10:04:00 AM 10.71 80750
26/10/2023 10:03:00 AM 10.85 0
26/10/2023 10:02:00 AM 10.85 0
26/10/2023 10:01:00 AM 10.85 0
26/10/2023 10:00:00 AM 10.85 0
26/10/2023 09:59:00 AM 10.85 0
25/10/2023 4:11:00 PM 10.85 0
25/10/2023 4:10:00 PM 10.85 68321
From 25/10/2023 4:11:00 PM to 26/10/2023 10:03:00 AM, as there is no traded volume, all the open prices will be replaced by the last updated trade price ($10.85).
When the time is 26/10/2023 10:04:00 AM, as there is 80750 volume, the open price will be updated to $10.71.
This is neither IB issue nor Amibroker issue.
IBKR API Support Team, Technical Assistance Center