Retrieve number of bars in a symbol using OLE object model

Is it possible to retrieve the number of bars in a symbol using OLE object model? I tried to look for a suitable API function to do this but was not able to do so. Did I miss out anything?

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

You do not mention which number of bars.

Below one retrieves three different kind of number of bars (which may be equal depending on how it is called).

ldb = Status( "quickafllastdatabar" );
_TRACEF( "\n\nBarCount: %g bars", BarCount );
_TRACEF( "\nEntire bars of selected interval: %g bars", ldb + 1 );

if ( ParamTrigger("Retrieve #bars of base interval", "CLICK HERE")){
	AB = CreateObject( "Broker.Application" );
	stks = AB.Stocks();
	stk = stks.Item(Name());
	qts = stk.Quotations;
	bar_count = qts.Count;
	_TRACEF( "\n#Bars of base interval: %7.0f bars", bar_count );
}

24

3 Likes

Thank you for the solution. bar_count = qts.Count is what I want. It can be found in description for ADQuotations in AmiBroker Object Model

No, you should lookup Quotations object in the documentation, not ADQuotations. ADQuotations is different object (for advance-decline data only).

1 Like

Thanks for correction.

I tried to edit my original post which contained the error to avoid misleading readers but editing is no longer allowed after some time has elapsed.

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.