I am using IB data plug-in, and want to do something Dan Zanger did many years ago. I want to play sounds when trades happen in a small watchlist. When a trade hits the bid, a higher pitch beep is played and when a trade hits the ask, a lower pitch beep is played.
Yes it is quite easy in AFL. Something along these lines:
// this code assumes you are using REAL TIME data source that
// provides Level-I data (IQFeed, eSignal, IB)
last = GetRTData("last");
bid = GetRTData("bid");
ask = GetRTData("ask");
if( last == bid ) PlaySound("C:\\path\\to\\file\\Higher.wav");
if( last == ask ) PlaySound("C:\\path\\to\\file\\Lower.wav");
Thanks Tomasz. I have a couple questions regarding implementation.
I need the chart refresh interval to be sub-second, and I understand that I can set it to 0 in the preferences. However, I don't want to let the refresh setting affect all charts to reduce performance overhead. Does the function RequestTimedRefresh(interval) support interval=0?
Regarding 32bit vs 64bit. I am using Windows 11 64bit machine, but currently have AmiBroker32 for TC2000, so I also run AB32 for IB plugin. If I switch to AB64 for IB plugin, does it perform better for this fast-refreshing code?
I found the answer to the first question which is setting the preference to ZERO and use the RequestTimedRefresh(interval) on the charts which I don't want to refresh too fast.
If you could, can you answer the second question?
You don't need to do anything. AmIBroker takes care about everything and you don't need to include REquestTimedRefresh, because with setting of 0, charts are refreshed based on their individual performance (i.e. faster are refreshed faster, slower are refreshed slower).
TC2000 is NOT available in 64-bit (I mean version compatible with the plugin).
You can use 64-bit for IB, if you wish, performance is a bit better, but the biggest advantage of 64-bit is not really speed but ability to use more than 4GB of RAM.