PureBytes Links
Trading Reference Links
|
I am working on a Java Script and am taking one step at a time. I want this section of the js to empty a watchlist. I have googled a lot and have commands that are javascript and visual basic. This is my error, but I am learning. Here is what I have on this should so far. Help appreciated.
// emptyWatchlist.js
// This Java Script file should:
// 1. Load a Database
// 2. Call a function to empty a watchlist. This function ...
// a. Creates an afl
// b. Runs an exploration on this afl to empty watchlist 10.
// THIS AFL DOES NOT WORK YET
// ----------------------------------------------------------------------------
// Create AmiBroker object and get Analysis object
// ----------------------------------------------------------------------------
var AB, AA, i;
AB = new ActiveXObject("Broker.Application");
AA = AB.Analysis;
// ----------------------------------------------------------------------------
// Load Database
// ----------------------------------------------------------------------------
AB.LoadDatabase("C:\\Amibroker\\FastTrack");
// ----------------------------------------------------------------------------
// Load Reference Ticker into AmiBroker
// ----------------------------------------------------------------------------
AB.ActiveDocument.Name = "RUT-I"; // Set RUT-I as reference ticker
// ----------------------------------------------------------------------------
// Empty Watchlist 10
// ----------------------------------------------------------------------------
var WatchlistNumber = 10
WLEmpty_Directory = "C:\\Amibroker\\Temp\\";
WLEmpty_ExploreFileName = "Empty_Watchlist.afl";
WLEmpty_ExploreFile = WlEmpty_Directory + WLEmpty_ExploreFileName;
emptyWatchlist.call(10);
//Call emptyWatchlist; // does not work?
// ----------------------------------------------------------------------------
// Afl Code to Empty a Watchlist
// ----------------------------------------------------------------------------
var Emptya = "list = GetCategorySymbols( categoryWatchlist, ";// Add watchlist number later
var Emptyb = " );"; // Use Chr(34) later to add quotes
var Emptyc = "for( i = 0; ( sym = StrExtract( list, i ) ) != ";
var Emptyd = "; i++ )";
var Emptye = "{";
var Emptyf = " CategoryRemoveSymbol(sym, categoryWatchlist, ";
var Emptyg = " );";
var Emptyh = " Filter=1;";
var Emptyi = "}";
var Emptyj = "AddTextColumn(sym ,";// Use Chr(34) later to add quotes
var Emptyk = "Ticker";
var Emptyl = ");";
// ----------------------------------------------------------------------------
// Function to create an afl that will Empty a Watchlist
// ----------------------------------------------------------------------------
function emptyWatchlist
{
Dim bolResult
Dim FrmlaFile
var Result = WSH.popup("Emptying a Watchlist")
var FrmlaFile = FS.CreateTextFile(WLEmpty_ExploreFile, True)
With FrmlaFile
.WriteLine Emptya + cstr(WatchlistNumber) + Emptyb
.WriteLine Emptyc + Chr(34) + Chr(34) + Emptyd
.WriteLine Emptye
.WriteLine Emptyf + cstr(WatchlistNumber) + Emptyg
.WriteLine Emptyh
.WriteLine Emptyi
.WriteLine Emptyj + Chr(34) + Emptyk + Chr(34) + Emptyl
.Close
End With
Set FrmlaFile = Nothing
With AA
.ApplyTo = 1;
.RangeMode = 2;
.RangeN = 1;
.ClearFilters();
.Filter(0, "watchlist") = WatchlistNumber
bolResult = .LoadFormula(WLEmpty_ExploreFile)
If bolResult Then
.Explore();
End If
End With
AB.RefreshAll()
//End function
}
// That is it.
------------------------------------
**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.
TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com
TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/amibroker/join
(Yahoo! ID required)
<*> To change settings via email:
amibroker-digest@xxxxxxxxxxxxxxx
amibroker-fullfeatured@xxxxxxxxxxxxxxx
<*> 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/
|