[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: Cleanup script help



PureBytes Links

Trading Reference Links


Great idea Tomasz! Thanks a lot. I am now in love with Amibroker.

--- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <amibroker@xxxx>
wrote:
> Hello,
> 
> You don't need a script to do this.
> Run exploration:
> 
> Filter = MA(Volume,20) < 100000;
> AddColumn( MA(Volume,20) , "MA(V)");
> 
> then add result to watch list,
> then go to Symbol->Organize assignments,
> select watch list and all symbols in it and press "DELETE"
> 
> Best regards,
> Tomasz Janeczko
> amibroker.com
> ----- Original Message ----- 
> From: "jism1992" <gdihia@xxxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Saturday, November 20, 2004 9:59 PM
> Subject: [amibroker] Cleanup script help
> 
> 
> > 
> > 
> > How can I modify this script to delete all stocks with MA (VOLUME, 20)
> > < 100,000. I want to delete all stock with small volume. Thanks.
> > 
> > I am not even sure how to edit this file. Please help. Thanks a lot.
> > 
> > /*
> > ** AmiBroker/Win32 scripting Example
> > **
> > ** File: Cleanup.js
> > ** Created: Tomasz Janeczko, December 2th, 2000
> > ** Purpose: Cleanup the database from not traded stocks
> > ** Language: JScript (Windows Scripting Host)
> > */
> > 
> > /* detection threshold (in days)  */
> > var Threshold = 5; // one month for example 
> > /* by default do not delete */
> > var DeleteByDefault = true;
> > /* ask the user for the decision */
> > var AskUser = false;
> > /* a timeout to wait until default route (no deletion) is taken */
> > var Timeout = 5;
> > 
> > var oAB = new ActiveXObject("Broker.Application");
> > var fso = new ActiveXObject("Scripting.FileSystemObject");
> > var Shell = new ActiveXObject("WScript.Shell");
> > 
> > 
> > var oStocks = oAB.Stocks;
> > 
> > var MiliSecInDay = 24 * 60 * 60 * 1000;
> > 
> > var Continue = true;
> > 
> > var StockQty = oStocks.Count;
> > 
> > var oStocksToDelete = new Array;
> > var oStocksNotTraded = new Array;
> > 
> > if( ! AskUser ) WScript.Echo("Cleanup script started" );
> > 
> > for( i = 0; i < StockQty && Continue; i++ )
> > {
> > oStock = oStocks( i );
> > 
> > var Qty = oStock.Quotations.Count; 
> > 
> > var response = 0;
> > 
> > if( Qty > 0 )
> > {
> > oQuote = oStock.Quotations( Qty - 1 );
> > 
> > var oDate = new Date( oQuote.Date );
> > 
> > var Today = new Date();
> > 
> > DaysNotTraded = Math.floor( ( Today - oDate )/MiliSecInDay );
> > 
> > if( DaysNotTraded > Threshold )
> > {
> > if( AskUser ) response = Shell.popup( oStock.Ticker + " is not
> > traded since " + oDate.toLocaleString() + " (" + DaysNotTraded + "
> > days).\nDo you wish to delete it?\n(Press Cancel to end the process)",
> > Timeout, "Confirm delete", 3 + 256 );
> > else          response = -1; /* default */
> > }
> > }
> > else
> > {
> > if( AskUser ) response = Shell.popup( oStock.Ticker + " has no
> > quotes. Do you wish to delete it?",  Timeout, "Confirm delete", 3
+ 256 );
> > else          response = -1; /* default */
> > }
> > 
> > /* change default route if needed */
> > if( response == -1 && DeleteByDefault ) response = 6;
> > 
> > switch( response )
> > {
> > case -1:/* Timeout - fallback to no */
> > case 7: /* No */
> > oStocksNotTraded[ oStocksNotTraded.length ] = oStock.Ticker;
> > break;
> > case 6: /* Yes */
> > oStocksToDelete[ oStocksToDelete.length ] = oStock.Ticker;
> > break;
> > case 2: /* Cancel */
> > Continue = false;
> > break;
> > default: break;
> > }
> > }
> > 
> > if( oStocksToDelete.length > 0 && Shell.popup( "You are now about to
> > delete " + oStocksToDelete.length + " stock(s).\nDo you wish to
> > proceed?" , 0, "Confirm delete", 4 + 256 ) == 6 )
> > {
> > for( i = 0; i < oStocksToDelete.length; i++ )
> > {
> > oStocks.Remove( oStocksToDelete[ i ]  );
> > }
> > 
> > oAB.RefreshAll();
> > }
> > 
> > if( oStocksNotTraded.length > 0 && Shell.popup( "There are " +
> > oStocksNotTraded.length + " not traded stock(s) detected but not
> > deleted by your choice.\nDo you wish to save their tickers to
> > \"nottraded.txt\" file?" , 0, "Confirm save", 4 + 256 ) == 6 )
> > {
> > f = fso.OpenTextFile( "nottraded.txt", 2, true ); 
> > 
> > for( i = 0; i < oStocksNotTraded.length; i++ )
> > {
> > f.WriteLine( oStocksNotTraded[ i ]  );
> > }
> > 
> > f.Close();
> > }
> > 
> > WScript.Echo("Cleanup script finished" );
> > 
> > 
> > 
> > 
> > 
> > 
> > Check AmiBroker web page at:
> > http://www.amibroker.com/
> > 
> > Check group FAQ at:
http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
> > Yahoo! Groups Links
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> >





------------------------ Yahoo! Groups Sponsor --------------------~--> 
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/