Hi
I want to plot current price of option straddle.
current price is defined as latest close price of call-option + latest close price of put-option (at same-strike and same-expiry date)
I use InteractiveBrokers plugin. The database has base time interval of 1 minute.
The option symbols are of the form
BANKNIFTY-YY-M-DD--CE-NSE-OPT-INR (for call option)
BANKNIFTY-YY-M-DD--PE-NSE-OPT-INR (for put option)
To plot current price of option straddle, I do the following:
determine name of other symbol of the straddle pair. This is done by changing CE to PE (and vice-versa) to current symbol name
Get the close price of other symbol of straddle pair using Foreign function
Add the close-price-foreign-symbol to close price of current symbol.
This works well historical data.
However, for the straddle price for the current minute, I notice the following:
Close price for current symbol is continuously updated, however the close price for the other symbol of pair, is not continuously updated.
Is there some way to get continuously updated close price of Foreign symbol as well? This will get in plotting more accurate current price of straddle.
I haven't tried the IB plugin but IB is very closely tied to AB.
For other local vendors, users have reported Foreign() calls not updating.
Follow-up question for Tomasz is if GetQuotesEx() is called for Foreign() calls.
I am referring to your post below in the same topic because for now I assume GetQuotesEx() is called and it could be a plugin issue.
GetQuotesEx is called for all symbols that were accessed in ANY way. I already explained it many times. This includes Foreign(). Everything is updated as data source sends updates. If you want to make sure that chart updates occur immediately go to Tools->Preferences, "Intraday" and make sure that "Realtime chart refresh interval" is set to 0. (requires professional license)
Hi @nsm51
the ticks were coming properly / continuously when the two symbols were added to RT quote window. It is only in charts that I was having the issue.
If everything is right, the ib plugin should update all data irrespective of foreign call or other chart requesting that data or not (provided the symbol is there in the master)
But I am not sure if the ib data plugin will pass this test.
Hi Tomasz
I changed the "Realtime chart refresh interval" to 0 . It was set to 1 earlier.
I am still facing the same issue.
Please find a screen recording for the same.
The realtime window shows the realtime data coming for both PE and CE.
In the chart however, only CE value is changing continuously. The PE value is not changing. It changed only once (in the recording), when the minute changed.
peer_close is visible in Title string, but while debugging(generally), why don't you plot all 3 separately?
that way, its easier for viewing, isn't it? plots of sym, pair and foreign_symbol
You need to understand how charting works. The formula that chart uses is executed WHEN currently selected symbol data changes. Changes on symbol referenced by Foreign DO NOT cause formula execution UNLESS selected symbol data changes too.
The SELECTED SYMBOL is the only driver for chart refreshes.
If you want refreshes that happen EVEN IF current symbol does NOT receive any new data, you have to request timed refreshes AFL Function Reference - REQUESTTIMEDREFRESH
Hi Tomasz
The Close for the selected symbol (CE in the video) is changing every second (or so). This updated value can be seen in the title (and it can be confirmed in the RT window as well).
The close value of the foreign symbol is also changing (as seen in the RT window). The value for foreign symbol is however not updated in chart (as seen the chart title).
During the recording, the value for foreign symbol changed only once when the minute changed.
Additionally, as much info as you can which is missing in your opening post. IB plugin version, AB version etc. It helps the others who cant see your machine
Hi @nsm51, @Tomasz
Here is another video where the other two plots are added to the chart.
In the video, the minute changed after ~6 seconds. One can see the change in the foreign symbol value at that time. Also, the value does match value in RT window at that time.
Other details are:
Amibroker - Version: 6.40.4 - Professional Edition (64-bit)
So, I finally updated to windows11 and with that I also did a new install of Amibroker in user/home directory.
I am happy to share that the real-time update of Foreign symbol is working in this setup. I am not sure what was the issue in older setup. Here is a video of the real-time update of symbol and its peer (foreign symbol)..