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

[amibroker] Re: JAVA SCRIPT SIMPLE QUESTIONS


  • Date: Mon, 23 Nov 2009 17:27:38 -0000
  • From: "bistrader" <bistrader@xxxxxxxxx>
  • Subject: [amibroker] Re: JAVA SCRIPT SIMPLE QUESTIONS

PureBytes Links

Trading Reference Links

Brenton - Not 10 watchlist providing stocks but rather 10 csv files providing stocks in each with file names from In1 to In10.  Here, I am trying to: (1) do a rotational trading backtest on In1, (2) creating an exploration of this backtest's ~~~equity.  Do this over and over again for In2 through In10 as well.

Thanks for the example on using AutoIt rather than AutoIt running a JavaScript.  I will look around to find documentation on how to set the range dates, etc in the AutoIt files.

--- In amibroker@xxxxxxxxxxxxxxx, Brenton Hill <bphill0105@xxx> wrote:
>
> Hi Bistrader
> 
> If you're using AutoIT anyway, you can skip using Java Script altogether 
> and just control Amibroker direct from AutoIT.
> 
> In AutoIT use:
> 
> $AB = ObjCreate("broker.application")
> $AA = $AB.Analysis
> $AB.LoadDatabase("C:\\Amibroker\\FastTrack")
> 
> etc
> 
> Not sure about your Question 2, sorry.
> 
> If by ques 3, you mean you want to explore 10 different watchlists (eg 
> WL numbers 1 to 10) and export 10 csv files, then just put set filter, 
> explore and export in a loop
> 
> $Export_Directory = "C:\\Amibroker\\Temp\\"; // Location where Exported 
> data will be saved
> $ExportFileName = "MyCsvFile"; // Name of export file
> $ExportFile = Export_Directory + ExportFileName; // Name of above export 
> file with its path included
> 
>     For $i = 1 To 10
>         $AA.Filter( 0, "watchlist" ) = $i
>         $AA.Explore()
>         $AA.Export($ExportFile&$i&".csv")
>     Next
> 
> Brenton
> 
> bistrader wrote:
> >  
> >
> > I created the following Java Script to do an exploration on an afl and 
> > then export the exploration to a file. I have a few questions.
> >
> > 1. From a structure perspective, is there anything that I should 
> > include or exclude as I try to pick up Java Script.
> > 2. I can not figure out how to load a reference symbol like "RUT-I" 
> > with is the R2000 so that AmiBroker knows the valid market days.
> > 3. How to change the following if I want to loop through 10 csv files 
> > rather than just the watchlist 9 used in the following? That is, do 
> > this 10 times automatically but on csv files named In1.csv to 
> > In10.csv, if you will.
> >
> > By the way, I am going through a learning process to expand my 
> > knowledge on what to do in afl, what to do in Java Script and what to 
> > do in AutoIt. This is part of that process.
> >
> > // Build_JavaScript.js
> >
> > // This Java Script file should:
> > // 1. Load a Database
> > // 2. Run an exploration on an afl.
> > // 3. Export the exploration to a csv file.
> >
> > // ----------------------------------------------------------
> > // 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");
> >
> > // ----------------------------------------------------------
> > // Automatic Analysis Input and Export Information
> > // ----------------------------------------------------------
> > AFL_Directory = "C:\\Amibroker\\AFL\\"; // Location of AFL
> > AFL_ExploreFileName = "0_DataExport.afl"; // AFL program to get the 
> > data to be exported
> > AFL_ExploreFile = AFL_Directory + AFL_ExploreFileName; // Name of the 
> > above program with it's path included
> >
> > Export_Directory = "C:\\Amibroker\\Temp\\"; // Location where Exported 
> > data will be saved
> > ExportFileName = "MyCsvFile.csv"; // Name of export file
> > ExportFile = Export_Directory + ExportFileName; // Name of above 
> > export file with its path included
> >
> > // ----------------------------------------------------------
> > // Setup Exploration using info defined above
> > // ----------------------------------------------------------
> > AA.LoadFormula( AFL_ExploreFile );
> >
> > // Use the following to tell Amibroker what to Include/Exclude and 
> > what dates to use
> > //
> > // "index", "favorite", "market", "group", "sector", "index", "watchlist"
> > // 0 = include; 1 = exclude
> > // 0 = all stocks, 1 = current stock, 2 = use filter
> > // 0 = all quotes, 1 = n last quotes, 2 = n last days, 3 = from-to date
> > //
> >
> > // Set Filters
> > AA.ClearFilters();
> > // AA.Filter(0,"favorite") = 1; // Try this to load a long ticker 
> > which is favorites ^rut
> > AA.Filter(0,"watchlist") = 9; // 0 = Include; "watchlist" 57 contains 
> > the SP500 component stocks
> > AA.ApplyTo = 2; // 0 = all stocks, 1 = current stock, 2 = use filter
> >
> > // Set Dates
> > AA.RangeMode = 3; // 0 = all quotes, 1 = n last quotes, 2 = n last 
> > days, 3 = from-to date
> > //AA.RangeN = 5000;
> > AA.RangeFromDate = "12/31/2002";
> > AA.RangeToDate = "12/31/2099";
> >
> > // ----------------------------------------------------------
> > // Run exploration, export exploration to csv file
> > // ----------------------------------------------------------
> > {AA.Explore();}
> >
> > {AA.Export( ExportFile );
> >
> > AB.SaveDatabase();
> >
> > AB.RefreshAll();}
> >
> > //AA.ShowWindow(0); // 0 = all stocks, 1 = current stock, 2 = use filter
> >
> > // The End
> > // ----------------------------------------------------------
> >
> > 
> >
> >
> > __________ Information from ESET Smart Security, version of virus 
> > signature database 4628 (20091122) __________
> >
> > The message was checked by ESET Smart Security.
> >
> > http://www.eset.com
> 
> 
> 
> __________ Information from ESET Smart Security, version of virus signature database 4628 (20091122) __________
> 
> The message was checked by ESET Smart Security.
> 
> http://www.eset.com
>




------------------------------------

**** 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/