Local Database save option help

Just want 1 year data in my local data storage not more than
that so what should be appropriate “No of Bars” in Local Database save option?
Local Database save option

What should be the appropriate “No of Bars” in Database setting for real-time Tick Data of 50 symbols for smooth running of amibroker?
Database setting

I don’t know that’s why I ask?
I am using Tick data. What should be Max no of bars to limit my data storage to 1 year?
Thanks…

That depends on symbol. Hyper active symbols like ES, SPY, QQQQ can send hundreds of ticks per second. Inactive can send few ticks per second or even less. Now it also depends on how long instrument is traded. If it is traded for 8 hours it will use 8 hours * 3600 seconds * tickspersecond ticks everyday. You can do the math yourself. It is just multiplication.

1 Like

Any solution to delete current day messed up data.....
Open up Quote Editor ... selecting each and every symbol in database … using shift to select from begin of the day to end … then click delete … cumbersome process.....:tired_face:

@Fossil, as an alternative, you could do it using the OLE interface using an external script.

As basic models for this kind of operations, you could study the scripting examples that you'll find in this KB:

http://www.amibroker.com/kb/2015/01/13/how-to-delete-quotes/

For some strange reasons the 2 JScript examples in that page are displayed in a single row of code with no line feeds.

Here are the "expanded" versions:

// THIS IS NOT AFL
// This is Windows script to be run from the outside of AmiBroker
function RemoveAllQuotes( Name )
{
    AB = new ActiveXObject( "Broker.Application" );
    Stk = AB.Stocks( Name );
    Quotes = Stk.Quotations;
    iQty = Quotes.Count;

    for( i = iQty - 1; i >= 0; i-- )
    {
        Quotes.Remove( i );
    }

    AB.RefreshAll();
}
RemoveAllQuotes( "MSFT" );
WScript.Echo( "Completed" );
// THIS IS NOT AFL
// This is Windows script to be run from the outside of AmiBroker
function RemoveQuotesWithZeroVolume( Name )
{
    AB = new ActiveXObject( "Broker.Application" );
    Stk = AB.Stocks( Name );
    Quotes = Stk.Quotations;
    iQty = Quotes.Count;
    cnt = 0;

    for( i = iQty - 1; i >= 0; i-- )
    {
        qt = Quotes.Item( i );

        if( qt.Volume == 0 )
        {
            cnt++;
            Quotes.Remove( i );
        }
    }

    AB.RefreshAll();
    return cnt;
}

n = RemoveQuotesWithZeroVolume( "MSFT" );
WScript.Echo( "Removed " + n + " quotes with zero volume" );

If scripting is something that you'll like to use, first, take some time to correctly understand the AmiBroker's OLE Automation Object Model.

Then you can use the above samples as a model to develop your own code.

:stop_sign: Don't forget to backup your database before testing this kind of scripts: you are dealing with REMOVE methods.

This seems like a good opportunity to try and learn how to write a script!

1 Like

If you are using LATEST AmiBroker (6.27.1) you can delete range of quotes directly from chart. Mark the range (F12 and Shift+F12, or double click on range begin/end) and then select Edit->Delete Range

2 Likes

@beppe
KB article ... I know but no deep knowledge about coding so in a dilemma try or not to try. Anyway taking reference from cleanup.js file I will give a try ……

@Tomasz
using 6.20

My first jscript ..:sunglasses:

function CountAllQuotes( Name )
{
        AB = new ActiveXObject( "Broker.Application" );
        Stk = AB.Stocks( Name );
        Quotes = Stk.Quotations;
        iQty = Quotes.Count;
        cnt = 0;

        for( i = iQty - 1; i >= 0; i-- )
        {
            cnt++;
        }

        AB.RefreshAll();
    return cnt;
}

n = CountAllQuotes( "MSFT" );
WScript.Echo( "no of Quotes:- " + n );