PureBytes Links
Trading Reference Links
|
you can create afl from within afl
h
bistrader wrote:
Mike, I just responded to your other reply as I missed it for some reason. Thanks again for this. I will certainly use it!!
I will leave my post for help in creating an afl within _javascript_. I want to: (1) create an afl from within _javascript_; (2) feed to this something that changes like the watchlist number, a file name, a ticker name; (3) run an exploration on this afl; (4) delete this afl when done. Help with this will help me to do a bunch of stuff that I want to do in _javascript_. In time, I will be able to do this stuff better, but for now this "create an afl within _javascript_" will help a lot.
--- In amibroker@xxxxxxxxxxxxxxx, "Mike" <sfclimbers@xxx> wrote:
Bert,
Did you not see my post to your earlier thread? I gave you a working solution to simultaneously empty and populate the watchlist. Symbols not found in your input .csv file are removed from the list while symbols that are found in your .csv file are added to the list, all in a single loop.
See posting http://finance.groups.yahoo.com/group/amibroker/message/144269
Mike
--- In amibroker@xxxxxxxxxxxxxxx, "bistrader" <bistrader@> wrote:
I am working on a _javascript_ 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 _javascript_ 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/
__._,_.___
**** 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/
__,_._,___
|
|