Sub-second TImed Refresh via Registry

As mentioned in RequestTimedRefresh function i have enabled sub-second Time Refresh for multcharts v6.20.1 by tweaking the registry

My system 32 GB RAM and i7-7700k and my net speed is also blazing fast.

However when i still compare my broker terminal to amibroker quote( from the best data-feed vendor in my area ) , i still sometimes notice a difference in bid-asks between amibroker Realtime Quote and my trading terminal.

What could be the reason.

    • I tried reducing the number of live symbols .
    • Increase cache memory.
    • Upgrade my internet.
    • Reduce load on my CPU by closing unnecesary applications.

How can i match the bid-ask between amibroker and execution terminal to incur minimum slippage during real-time trading??

what do you have set as "Realtime chart refresh interval" ?

Bid/Ask is displayed on chart ? or in Amibroker Realtime Quote window ?

do you use a pro or standard version of Amibroker ?

Hi Rottor. Thanks for the instant reply.

1.) After setting the registry dword i have set the Realtime chart refresh interval - 0.5 sec

2.) Bid/Ask is displayed on Amibroker Realtime Quote window.

3.) Proferssional edition 64-bit v6.2.0

Any generous member in the community would like to throw some light in this matter??
It would be deeply appreciated?:smile:

From your description, your using a different data supplier then your brokerage?

First step in someone helping is knowing the data supplier and whether it’s a Amibroker built in plugin, and if your trading terminal means your brokerage provided software.

If your using two separate data feeds and they don’t line up, don’t think theirs much you could do with Amibroker. One of your data feeds is lagging.

Perhaps your seeing delayed data from your brokerage. Some brokerages like IB can be easy to miss a live subscription.

There is NO such setting in the registry as far as AmiBroker is concerned so you apparently got your information wrong.

Chart refresh interval is set in the Preferences (Tools->Preferences,"Intraday" tab and should be set to ZERO for Professional Edition) and it is NOT stored in registry.

Maybe i understood the afl help section on RequesTImedFunction wrong- https://www.amibroker.com/guide/afl/requesttimedrefresh.html.

Starting from version 5.30.3 RequestTimedRefresh supports sub-second (down to 0.1 sec) resolution, when enabled via registry setting (HKCU/Software/TJP/Broker/Settings/EnableHiresRTR, DWORD value = 1 )

This is what i thought could help me get sub-second refresh.

Am i missing something??

have you actually read Tomasz reply ? have you tried it already ?

@aakashtandon - you do NOT need RequestTimedRefresh. Refreshes are automatic if data source sends new ticks.
Of course this assumes that you are using supported and properly written data plugin (http://www.amibroker.com/guide/h_quotes.html)

If you are using 3rd party unsupported data source - you should complain to plugin vendor to fix their plugin, because refreshes MUST be automatic and MUST be properly triggered by plugin.

Hello Tomasz and everyone,

I found this question by using the forum's search facility. I am using AB Pro/RT version, and have recently upgraded from Win 7 to 10.

I am also trying to understand how screen refreshes work, in particular the function RequestTimedRefresh(). I notice that the registry option mentioned in this function's documention is no longer supported in Windows 10. Is this correct?

I have set the Chart refresh interval in the Preferences (Tools->Preferences,"Intraday" tab) to ZERO.

@Tomasz: Are you saying that the function RequestTimedRefresh() is not needed, and screen refreshes are triggered by the data vendor, DTN-IQFEED in my case?

I've done some tests using the following test code

DB_Name = GetDatabaseName();
Timeframe = Interval( 2 );
RequestTimedRefresh(0.1);
refreshType = "user";
if( Status("redrawaction") == 1 )
  refreshType = "timed";
_TRACE("Start " + DB_Name + ": " + Timeframe + " Screen refresh for " + Name() + ", refresh: (" + Status("redrawaction") + ") " + refreshType);

When I comment out the RequestTimedRefresh(), I get the following log, which indicates that the user-triggered refreshes occur once per second

|Start IQFeed: 1-minute Screen refresh for @ESH20, refresh: (0) user|F:\AmiBroker AFL\AFL\Custom\Test - empty.afl|9|142|13:29:44.90|
|Start IQFeed: 1-minute Screen refresh for @ESH20, refresh: (0) user|F:\AmiBroker AFL\AFL\Custom\Test - empty.afl|9|142|13:29:45.90|
|Start IQFeed: 1-minute Screen refresh for @ESH20, refresh: (0) user|F:\AmiBroker AFL\AFL\Custom\Test - empty.afl|9|142|13:29:46.92|

When I enable the function, the traces are interleaved with user- and timed-triggered refreshes:

|Start IQFeed: 1-minute Screen refresh for @ESH20, refresh: (1) timed|F:\AmiBroker AFL\AFL\Custom\Test - empty.afl|9|142|13:32:00.47|
|Start IQFeed: 1-minute Screen refresh for @ESH20, refresh: (0) user|F:\AmiBroker AFL\AFL\Custom\Test - empty.afl|9|142|13:32:01.17|
|Start IQFeed: 1-minute Screen refresh for @ESH20, refresh: (1) timed|F:\AmiBroker AFL\AFL\Custom\Test - empty.afl|9|142|13:32:01.48|
|Start IQFeed: 1-minute Screen refresh for @ESH20, refresh: (0) user|F:\AmiBroker AFL\AFL\Custom\Test - empty.afl|9|142|13:32:02.18|
|Start IQFeed: 1-minute Screen refresh for @ESH20, refresh: (1) timed|F:\AmiBroker AFL\AFL\Custom\Test - empty.afl|9|142|13:32:02.47|

I notice that the screen refreshes still occur about every second, but that separate user- and timer-triggered refreshes are done.

@polomora, quoting the docs:

Starting from version 5.30.3 RequestTimedRefresh supports sub-second (down to 0.1 sec) resolution, when enabled via registry setting (HKCU/Software/TJP/Broker/Settings/EnableHiresRTR, DWORD value = 1 )

So if you want to go below one second using RequestTimedRefresh() and If you don't have this (EnableHiresRTR) entry in the Registry:

HiRes1

... you need to create (add) it via --> New --> DWORD key and set it's value to 1.

I tested it a month ago when I was setting up my new WIN 10 workstation. At the beginning I also didn't have this entry and couldn't make RequestTimedRefresh() refresh more often than once per second. Now this limitation is gone ...

https://www.amibroker.com/guide/afl/requesttimedrefresh.html

https://www.amibroker.com/kb/2015/02/03/when-and-how-often-afl-code-is-executed/

https://www.amibroker.com/guide/h_rtsource.html

Best

5 Likes

Yes, if you are connected to a realtime plugin and you have set the Realtime chart refresh interval in the Preferences --> Intraday to ZERO (0), the chart should be refreshed automatically with every tick. So you dont't need (and shouldn't) be using RequestTimedRefresh() for that.

A quote from: https://www.amibroker.com/guide/w_preferences.html

Realtime chart refresh interval - defines interval between automatic chart refreshes in real-time mode. By default charts are refreshed every 3 seconds but in very volatile market you may prefer to set it to 1, so charts are refreshed every second in real-time mode.

New in 4.90 : To enable 'every tick' chart refresh in Professional Edition, go to Tools->Preferences, Intraday tab and enter ZERO (0) into "Intraday chart refresh interval" field. (note Standard Edition won't allow to do that).

Once you enter zero, AmiBroker will refresh all charts with every new trade arriving provided that the formulasyou use execute fast enough. If not, it will dynamically adjust refresh rate to maintain maximum possible refresh rate without consuming more than 50% of CPU (on average). So for example if your charts take 0.2 sec to execute AmiBrokerwill refresh them on average 2.5 times per second.

No, it is still supported in WIN 10. I have shown it in my first post. Everything works as described in the docs.

3 Likes

@Milosz,

Many thanks for your detailed reply. Thanks for taking the time to explain this.
Now working.

1 Like