When showing Config Dialog, how to know selected periodicity?

While showing Config Dialog for a Data Plugin, how to know selected periodicity?
List of symbols adding to the database will differ from database periodicity. How to know which selected period?

When the plugin is loaded after AB startup,

You will get REASON_DATABASE_LOADED

argument received PluginNotification* pn;

pn->pWorkspace->TimeBase ...
// store this in your plugin
// it is the DB base time interval

also, when a symbol is accessed, GetQuotesEx( ... int nPeriodicity ....)
this corresponds to the symbols request

You should always supply Quotation* pQuotes in base time interval

1 Like

I am using PLUGINAPI int Notify( struct PluginNotification *pNotifyData ) to get to know TimeBase.
What I am asking is: while creating a new database!
May be I will use PLUGINAPI int SetTimeBase( int nTimeBase ).
But I wonder if there is any better way?

That is called when user changes or selects base time interval.
This includes the first interaction when DB is being created.

So if the base time interval is not supported, you return false and AB will tell user that it is not supported.

Confid Dialog is opened "after" the settings dialog is loaded, when you click configure.

I see, It is called when Database settings closing :frowning:

maybe you can explain your flow more clearly as to what you are targeting?

In my data-plugin, there will be more than 15 data fields available for EOD data and 10 data fields available for 1Minute and 5Minute data. So that when creating EOD database, beside normal data, I will add a sub symbol for each "main" symbol. Sub symbol will contain leftover fields from main symbol. for example: for symbol VNM I will create S_VNM, the 2 symbols will contains 15 fields so that in AFL, I can query 15 fields. But with Minute data, 8 fields is enough and people can select from 10 fields available, For Tick data, the is no extra fields to select.

Minute and Tick do not have S_xxx symbols!

thanks to Amibroker for OI, Aux1 and Aux2 fields but still not enough!

That why I wanto to know which is currently selected Timebase (in database settings)

but this is specific to "at the time of DB creation" right?

Dialogs work like that, data is received ON_OK_BUTTON_EVENT

So your Config Dialog should be sort-of generic, lets say.
Then from first use, maybe you can enable/disable certain fields depending on whether it is EoD base time or not.

you could also set 2 groups in your config dialog, when that OK is clicked, you update a variable, say eod=True.
Because in Configure() you have completed (CConfigDlg) oDlg.DoModal() == IDOK block

After that Dialog closes, then user clicks ok of the DB settings page, you can match this eod variable in SetTimeBase() as well.

This way, you will not allow the user to proceed with the wrong combination of choices.
They will go back to click config, correct the options and then click config_ok again.

My Database is EOD but why in PLUGINAPI int Notify( struct PluginNotification *pNotifyData ) pNotifyData ->pWorkspace->TimeBase is 0 instead of 86400?

I did not note all base time intervals, but they are encoded something like this

eod = 0
hourly = 2
15min = 3
1 min = 5
1 sec = 8
tick = 9

this is from old notes, just check again

so, assuming 5 min=4, 15 sec =6, 5 sec = 7 ( enum )

1 Like

I have tested and it is correct

1 Like

My plugin run on Amibroker 6.40.4 x64. But both Amibroker and VS2019 will shutdown when I try to Attach process to debug. What did I do wrong? They both run in Administrator.

For debugging, highest supported version is 6.10 x64

After that, there are security measures which will not allow.

what about x86? Which version can I debug?

it will be the same from for both bitness.
From data plugin perspective, it does not matter which version you use because the interface has not changed. V6.10x64 is good enough.

The only added feature after 6.2 is

PLUGINAPI int DataPluginCmd(
LPCTSTR pszCommand, struct CommandData* pCmdData);

Where can I download 6.10?

You login from members area. The link i sent you works so far. otherwise you need permission from support.

1 Like

I found on the website but cannot download becaus it is not available!
http://www.amibroker.com/members/bin/AmiBroker6100.exe
http://www.amibroker.com/members/bin/AmiBroker6100x64.exe

you need to login to members area, or sign-in when the login window prompts