REMINDER ... Regards, Ton.
----- Original Message ----- From: Ton Sieverding To: [email protected] Sent: Wednesday, May 12, 2010 2:42 PM Subject: Re: [amibroker] Re: Passing Param value from jscript to afl Hi Herman, Did you ever make code for the following application - using mentioned functions in the UKB - or can you give me a link to code for this kind of application ? Persistent variables can also be used to save ticker-specific system parameters. For example, you could run an optimization and save the optimized parameters in a Persistent Variable encoded with the Ticker's name. Regards, Ton. ----- Original Message ----- From: Herman To: TA Sent: Wednesday, May 12, 2010 11:41 AM Subject: Re: [amibroker] Re: Passing Param value from jscript to afl you can use PersistentVariables, they can be read from any programming language because they are saved in small files. see http://www.amibroker.org/userkb/2007/04/24/persistent-variables/ herman As usual you're the man. The following is partial code that I am using /* retrieve automatic analysis object */ AA = AB.Analysis; /* backtest over symbols and all quotes*/ AA.ClearFilters(); AA.ApplyTo = 0; // use symbols AA.RangeMode = 3; // Last Day //AA.RangeN = 1; // Last Day FromDate = new Date; /* year, month-1, day, hour, min, sec (required by JScript date constructor) */ ToDate = new Date; // current time /* getVarDate is required to convert from JScript Date to OLE-automation date */ AA.RangeFromDate = FromDate.getVarDate(); AA.RangeToDate = ToDate.getVarDate(); AA.LoadFormula("Z:\\amibroker\\Formulas\\1Production\\O2.afl"); AA.Explore(); AA.Export("Z:\\Amibroker\\CSV FILES\\O2.csv"); AA.LoadFormula("Z:\\amibroker\\Formulas\\1Production\\O3.afl"); AA.Explore(); AA.Export("Z:\\Amibroker\\CSV FILES\\O3.csv"); .. .. O2.afl, O3.afl &... Ox.afl are identical except for different value for a variable. So rather than maintaining all these afl files (O2.afl, O3.afl &... Ox.afl) I want to loop thru variable values in jscript and pass the variable value to Ox.afl. something like: For (var = 1 to 100) AA.LoadFormula("Z:\\amibroker\\Formulas\\1Production\\O2.afl"); AA.Explore(); AA.Export("Z:\\Amibroker\\CSV FILES\\O2.csv"); Where diferrent values of var create a new explore and then is exported to Ox.csv From: [email protected] [mailto:[email protected]] On Behalf Of Mike Sent: Tuesday, May 11, 2010 4:01 PM To: [email protected] Subject: [amibroker] Re: Passing Param value from jscript to afl Are you asking if you can have a stand alone, external jscript that drives AmiBroker to fire off multiple Explores one after the other (i.e. using OLE Automation), altering AFL variables along the way? Or, are you asking if you can have jscript embedded in an AFL script that fires off multiple Explores one after the other? If the former, you can do any of the following: 1. jscript first writes desired values to file on disk, AFL Exploration reads values from disk file. 2. jscript first runs minimal AFL script, whose sole purpose is to set static variable(s), AFL Exploration references static variables 3. jscript first modifies .AFL file on disk, AFL Exploration runs normally. Mike --- In [email protected], "TA" <tagro...@...> wrote: > > Tomasz > > > > Would you or someone else please let me know if this is possible or not? TIA > > > > From: [email protected] [mailto:[email protected]] On Behalf > Of TA > Sent: Saturday, May 08, 2010 2:34 PM > To: [email protected] > Subject: [amibroker] Passing Param value from jscript to afl > > > > > > I want to run different explores and exporting the results to a cvs file, > using the same afl code with different param or variable values by using a > jscript and looping thru the param or var values. Is it possible to pass a > parameter or variable value from jscript to afl. TIA >
