OK. Thanks ... Hope it was a pleasant trip -)

Regards, Ton.

  ----- Original Message ----- 
  From: Herman 
  To: Ton Sieverding 
  Sent: Monday, May 17, 2010 9:38 PM
  Subject: Re: [amibroker] Re: Passing Param value from jscript to afl


    
  its been a couple of years since i wrote that. I had to go look what I wrote 
and to be honest I don't remember exactly what I had in mind. I didn't refer to 
a specific example, but mentioned one  example use for them. 

  I think that in those days I was individually optimizing many tickers in one 
optimization, for example all tickers in a Watchlist. These were lengthy 
optimizations and I wanted the min/max values to be ready for use in my system 
at the end of the optimization. You could use static variables but they would 
be gone the next day. 

  Hope this helps... you are taking me on a trip through memory lane :-)

  herman




       


        Oops my famous mistake. Being no clear enough when asking something ... 
You are giving a link for an userkb doc with persistent variable functions. In 
this userkb doc you are talking about an example for an optimalisation 
application using mentioned functions. So perhaps you have made an application 
for optimalisation using these functions or you can give me a link for such an 
application. I would like to see how this works out in an example ...
         
        Kind regards,
         
        Ton.
         
        ----- Original Message ----- 
        From: Herman
        To: Ton Sieverding
        Sent: Monday, May 17, 2010 1:08 PM
        Subject: Re: [amibroker] Re: Passing Param value from jscript to afl

          
        Hi Ton,

        not sure what you need. There is no 'specific' application I can think 
of. I use Persistent Variables all the time; it is really just a simplified way 
to use files to communicate between programs and/or computers, and to still 
have your variables when you power up the next day. Its nice to know the system 
state you were in the day before ;-)

        Persistent variables can be saved with the ticker's name embedded in 
the parameter name, just like you do with Static Variables. For simple values 
this could be PersistentVarSet( "AAPL" + "_BuyPrice", BuyPriceNum ); for arrays 
it gets more complicated. This results in a small file named AAPL_BuyPrice.pva, 
you can read this file from any other program. You can open it with NotePad to 
see the contents.

        You can also use them as flags to maintain orderly afl <-> JS operation 
(handshaking). For example afl could monitor a flag set by JS to indicates JS 
has completed its task. When afl has done its work it can clear the flag so 
that JS knows it can do another run. Similarly afl can set a flag that is 
monitored by JS to tell it to perform a function. 

        Not sure if this helps...

        best regards,
        herman

             



              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
                    >
                   



             



       


  

Reply via email to