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

RE: [amibroker] Jayson: add stock to wachtlist via AFL-code



PureBytes Links

Trading Reference Links




<FONT face="Comic Sans MS" 
size=2>Jayson,
<FONT face="Comic Sans MS" 
size=2> 
Thats ok, 
its one of those things where you start out to write just an outline and by the 
time your finished its just as easy to complete it and its something that I will 
use later too. I'm sure others could put this to use as well. 

<FONT face="Comic Sans MS" 
size=2> 
If you 
want to limit your scan to Watchlist 5 then you can change the code 
from:
<FONT face="Comic Sans MS" 
size=2> 
<FONT face="Comic Sans MS" 
size=2>this
<FONT 
face="Comic Sans MS" size=2>oAA.Filter( 0, "market" ) = 
2
<FONT 
face="Comic Sans MS" size=2> 
<FONT 
face="Comic Sans MS" size=2>to this
<FONT 
face="Comic Sans MS" size=2>oAA.Filter( 0, "watchlist" ) 
= 5
<FONT face="Comic Sans MS" 
size=2> 
That will 
have to effect of running the AFL on watchlist 5.
<FONT face="Comic Sans MS" 
size=2> 
<FONT face="Comic Sans MS" 
size=2>Regards,
<FONT face="Comic Sans MS" 
size=2>William
<FONT face="Comic Sans MS" 
size=2> 
Here is 
the detail from the Amibroker readme. If you have any more question just 
ask.
<FONT face="Comic Sans MS" 
size=2> 

full control over AA window via new OLE/COM interface:Analysis 
object (accessible via Broker.Application.Analysis)Methods:- 
Backtest(); - runs backtest - Explore(); - runs exploration- Scan(); - 
runs scan- Optimize(); - runs optimization- bool Report( FileName: 
String ) - saves report to the file or displays it if FileName = "" - bool 
Export( FileName: String ) - exports result list to CSV file- bool 
LoadFormula( FileName: String ) - loads AFL formula- bool SaveFormula( 
FileName: String ) - saves AFL formula- bool LoadSettings( FileName: String 
) - loads backtest settings- bool SaveSettings( FileName: String ) - saves 
backtest settings- ClearFilters() - removes all filters 
Properties:- long ApplyTo - defines apply to mode: 0 - all 
stocks, 1 - current stock, 2 - use filter- long RangeMode - defines range 
mode: 0 - all quotes, 1 - n last quotes, 2 - n last days, 3 - from-to date- 
long RangeN - defines N (number of bars/days to backtest)- DATE 
RangeFromDate - defines "From" date- DATE RangeToDate - defines "To" 
date- Filter( nType: short, Category : String ) - sets/retrieves filter 
settingnType argument defines type of filter 0 - include, 1 - 
excludeCategory argument defines filter category:"index", "favorite", 
"market", "group", "sector", "index", 
"watchlist"ExamplesClearFilters(); // 
clear all filters firstFilter( 0, "index" ) = 1; // include only 
indicesFilter( 1, "market" ) = 2; // exclude 2nd 
marketFull Example for Windows Scripting 
Host:======================================== 
/* create AB object */AB = new 
ActiveXObject("Broker.Application");
/* retrieve automatic analysis object */AA = 
AB.Analysis;
/* load formula from external file 
*/AA.LoadFormula("afl\\macd_c.afl");
/* optional: load settings */// 
AA.LoadSettings("the_path_to_the_settings_file.abs");
/* setup filters *//* backtest over symbols present in 
market 0 only (zero-based number) */AA.ClearFilters(); AA.Filter( 0, 
"market" ) = 0;
/* set apply to and range */AA.ApplyTo = 2; // use 
filtersAA.RangeMode = 0; // use all available quotes
/* run backtest and display report 
*/AA.Backtest();AA.Report(""); // empty file name means display 
report
 
<FONT face="Comic Sans MS" 
size=2> 
watchlist
<FONT face=Tahoma 
size=2>-----Original Message-----From: Jayson 
[mailto:jcasavant@xxxxxxxxxxxx]Sent: February 6, 2003 9:25 
PMTo: amibroker@xxxxxxxxxxxxxxxSubject: RE: [amibroker] 
Jayson: add stock to wachtlist via AFL-code
<SPAN 
class=384211905-07022003>William,
<SPAN 
class=384211905-07022003> 
Wow! I 
did not expect you to go to the trouble of writing the whole script out. Thank 
you so much!
<SPAN 
class=384211905-07022003> 
I 
adjusted the AFL to limit the exploration to a given watchlist using 
filter=inwatchlist(5) but if I understand you correctly the line 

<SPAN 
class=384211905-07022003> 

<FONT face="Comic Sans MS" 
size=2>oAA.Filter( 0, "market" ) = 2   filters the 
exploration to Market=2. Is that correct and if so to scan only a given 
watchlist would I simply eliminate that line or do I need to modify it to meet 
either the specific watchlist or group 255 for the whole 
database?
 
Thanks for your help
 <FONT face=Arial 
color=#0000ff size=2>Jayson 
<FONT face=Tahoma 
size=2>-----Original Message-----From: William Peters 
[mailto:williampeters1@xxxxxxxxxxxx]Sent: Thursday, February 06, 2003 
11:48 PMTo: amibroker@xxxxxxxxxxxxxxxSubject: RE: 
[amibroker] Jayson: add stock to wachtlist via AFL-code
<FONT face="Comic Sans MS" 
size=2>Jayson
<FONT face="Comic Sans MS" 
size=2> 
You will 
also have to make a few little changes to the vbs file to suit your specific 
requirements.
Look for 
these lines and change as required:
<FONT face="Comic Sans MS" 
size=2> 
<FONT face="Comic Sans MS" 
size=2>oAA.Filter( 0, "market" ) = 2
 
' set 
apply to and range oAA.ApplyTo = 2 '// use filtersoAA.RangeMode = 2 '// 
use all available quotes
<FONT face="Comic Sans MS" 
size=2> 
<FONT face="Comic Sans MS" 
size=2>Regards
<FONT face="Comic Sans MS" 
size=2>William
<FONT face="Comic Sans MS" 
size=2> 
<FONT face="Comic Sans MS" 
size=2> 
<FONT face=Tahoma 
size=2>-----Original Message-----From: William Peters 
[mailto:williampeters1@xxxxxxxxxxxx]Sent: Thursday 6, February 2003 
8:43 PMTo: amibroker@xxxxxxxxxxxxxxxSubject: [amibroker] 
Jayson: add stock to wachtlist via AFL-code
Hi 
Jayson,
<SPAN 
class=531083004-07022003> 
Ive 
created a routine that is run outside of Amibroker (just double-click the vbs 
file, its simular to a jscript file). There is also a sample afl file you will 
have to customise that will be the basis of your sector to watchlist code, you 
must put this AFL file in your Amibroker **Database** directory before running 
the code.
<SPAN 
class=531083004-07022003> 
So the 
steps are:
<SPAN 
class=531083004-07022003> 
1 Place 
the "MyAFLFormula.afl" file in the relevent Amibroker *Database* 
directory
2 
Customise the AFL code to suit your requirements and save.
3 Place 
the "RunAFLExplore.vbs" file in your Amibroker Scripts directory and double 
click to run.
<SPAN 
class=531083004-07022003> 
<SPAN 
class=531083004-07022003>There are many other things you could do with this 
type of code, the sky is the limit when you think about it.
<SPAN 
class=531083004-07022003> 
<FONT 
face="Comic Sans MS" size=2>If you have any 
questions please fire away.
<SPAN 
class=531083004-07022003> 
<SPAN 
class=531083004-07022003>Regards,
William 
Peters
 
ps. <FONT 
face="Comic Sans MS" size=2>There might be a way 
to run the whole thing from inside of Amibroker, i'll think about 
that. 
<SPAN 
class=531083004-07022003> 
<SPAN 
class=531083004-07022003> 
<FONT face=Tahoma 
size=2>-----Original Message-----From: Jayson 
[mailto:jcasavant@xxxxxxxxxxxx]Sent: Thursday 6, February 2003 7:44 
AMTo: amibroker@xxxxxxxxxxxxxxxSubject: RE: [amibroker] 
add stock to wachtlist via AFL-code
<SPAN 
class=313363915-06022003>William,
could 
you elaborate? Spefically what I would like to do is run a basket of stocks then 
assign the results to specific watch lists based on thier Sector assignments. So 
from the list of say 500 stocks send all the Cap goods candidates to watchlist 
"A", the Retail Candidates to watchlist "B" etc. 
<SPAN 
class=313363915-06022003> 
<SPAN 
class=313363915-06022003>TIA
 Jayson 
<FONT face=Tahoma 
size=2>-----Original Message-----From: William Peters 
[mailto:williampeters1@xxxxxxxxxxxx]Sent: Thursday, February 06, 2003 
12:51 PMTo: amibroker@xxxxxxxxxxxxxxxSubject: RE: 
[amibroker] add stock to wachtlist via AFL-code
<FONT face="Comic Sans MS" 
size=2>Stephan,
 
You could 
do it via the AA window using AFL and jscript or vbscript.
<FONT face="Comic Sans MS" 
size=2> 
<FONT face="Comic Sans MS" 
size=2>Regards,
<FONT face="Comic Sans MS" 
size=2>William
<FONT face="Comic Sans MS" 
size=2> 
<FONT face=Tahoma 
size=2>-----Original Message-----From: Jayson 
[mailto:jcasavant@xxxxxxxxxxxx]Sent: Thursday 6, February 2003 6:34 
AMTo: amibroker@xxxxxxxxxxxxxxxSubject: RE: [amibroker] 
add stock to wachtlist via AFL-code
<SPAN 
class=054542914-06022003>Stefan,
I do 
not believe there is though it would save me a lot of time updating on a weekly 
basis. AB is like the weather in New England ( Eastern US)....If you don't like 
it just give it a minute, it will surely change....
 Jayson 
<FONT face=Tahoma 
size=2>-----Original Message-----From: Schellhaus Stefan 
[mailto:stefan.schellhaus@xxxxxxxxxxx]Sent: Thursday, February 06, 
2003 3:42 AMTo: 'amibroker@xxxxxxxxxxxxxxxx'Subject: 
[amibroker] add stock to wachtlist via AFL-codeGood 
Morning Everybody,is it possible to add a stock to a watch list via afl-code 
in the automaticanalyser ?Best regards Stefan 







Yahoo! Groups Sponsor


  ADVERTISEMENT









Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.