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

[amibroker] Re: script to add to watchlists



PureBytes Links

Trading Reference Links

--- In amibroker@xxxxxxxxxxxxxxx, "murthysuresh" <money@xxx> wrote:
>
> Hello
> I was planning to script adding to watchlist based on hotkeys. for 
> somereason, this script does not add to the watchlist. i get no errors. 
> can someone point the mistake. 
> 
> 
> var oShell = WScript.CreateObject("WScript.Shell");
> var oAB = new ActiveXObject("Broker.Application");
> 
> 
> //get the ticker currently active in AmiBroker
> Ticker = oAB.ActiveDocument.Name;
> WScript.Echo(Ticker );
>  Ticker.WatchListBits |=10;
>  oAB.SaveDatabase();
> 
> thanks in advance.
>

How about this:

var oShell = WScript.CreateObject("WScript.Shell");
var oAB = new ActiveXObject( "Broker.Application");

//get the ticker currently active in AmiBroker
Ticker = oAB.ActiveDocument.Name;
oAS = oAB.Stocks;
oAT = oAS.Item(Ticker);
watchlist = 10;

if (watchlist <= 32)
        oAT.WatchListBits |= 1 << watchlist;
else
        oAT.WatchListBits2  |= 1 << ( watchlist - 32 );
oAB.refreshall();


Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.17.19/663 - Release Date: 2/1/2007 2:28 PM