Hello,

The automation code in question fails if you are running OPTIMIZATION in 
parallel
because your code switches databases (calls LoadDatabase) in the middle of 
optimization.
How this could possibly work when in the middle of optimization you are 
throwing the database away?
Don't run optimization while you are switching databases!

Best regards,
Tomasz Janeczko
amibroker.com
  ----- Original Message ----- 
  From: Louis Préfontaine 
  To: [email protected] 
  Sent: Thursday, May 22, 2008 6:58 PM
  Subject: Re: [amibroker] amiquote lack of control


  Here is the bug:

  AmiBroker version 5.09.0.4880
   ( cooltool.dll 5.9.0,  mfc42.dll 6.2.4131,  msvcrt.dll 7.0.2600 )

  Microsoft Windows XP version 5.1 (Build 2600)
  Service Pack 2.0
  Common Controls: 6.0

  Unhandled exception
  Type:    CSysException
  Code:    c0000005
  Description:    ACCESS VIOLATION
  Address:    00424A4C



  AFL Parser status:
  Processing stage: NONE
  Formula ID: 0 ()
  Action 5 (BACKTEST)

  Additional information:

  Empty stock database.

  Workspace:
  Data source = (local), Data local mode = 1, NumBars = 1000

  Preferences:
  Data source = (local), Data local mode = 1, NumBars = 1000

  Command history:
  2938 - Shows database settings--Database settings
  2863 - Organize assignments to markets, groups, industries--Organize 
assignments
  2863 - Organize assignments to markets, groups, industries--Organize 
assignments
  2823 - Displays categories: groups, markets, sectors, industries--Categories
  2863 - Organize assignments to markets, groups, industries--Organize 
assignments
  3044 - Export watch list
  2828 - Shows Analyser - a tool to test systems & explore market--Auto-Analyser
  57617 - Open this workspace
  2940 - Refresh charts only--Refresh

  Cache manager stats:
  Number of list elements: 0
  Number of map elements: 0
  Hash table size: 5987

  Memory status:
    MemoryLoad: 42 %
    TotalPhys:      1564144K  AvailPhys:       897744K
    TotalPageFile:  3509328K  AvailPageFile:  3020988K
    TotalVirtual:   2097024K  AvailVirtual:   1926916K

  Last Windows message:
  HWnd:    0x1802ea
  Msg:    0x0110
  wParam:    0x00170380
  lParam:    0x00000000

  Detailed exception information:
  Broker.exe caused a EXCEPTION_ACCESS_VIOLATION in module Broker.exe at 
001B:00424A4C

  Call Stack:
  001B:00424A4C Broker.exe

  CPU Registers:
  EAX=00000000  EBX=00000001  ECX=0012F5E8  EDX=0000BCE6  ESI=01F6C696
  EDI=01F6C588  EBP=00000D72  ESP=00000D7A  EIP=00000000  FLG=00010246
  CS=001B   DS=0023  SS=0023  ES=0023   FS=003B  GS=0000



  2008/5/22 Louis Préfontaine <[EMAIL PROTECTED]>:

    Hi again again again, (lol),

    Sorry for all the messages.  I am just so excited about this, cause this 
will help me a lot since I often work in the evening and can't use Yahoo 
current day data.

    I worked a bit and it seems the second code you sent me works fine.  Works 
perfectly!

    The only problem...  is that it corrupts the optimization I was doing.  
It's bug it seems, because at the moment when Amiquote tries to update the 
database (which is optimizing at the same time) it created a situation where a 
window pops up and asks me if I want to continue even if Amibroker is now 
unstable.  Even if I click "yes" the optimization is dead and I have to 
re-begin it from scratch.. A bit frustrating!


    Thanks,
    Louis


    2008/5/22 Louis Préfontaine <[EMAIL PROTECTED]>:

      Hi again,

      Ok, I think that I understand a bit more how it works.  The file.js will 
open Amiquote, who will then save the files to a .adq file, which is Yahoo 
daily.  But this file is only good for one day (until the next time I run the 
script), so if for whatever reason I can't manuallu import the ASCII to the 
database then I am in trouble.

      Would it be possible with the same type of script to run Amiquote, to 
download the quotes AND to save them to the database (current, or chosen one) 
directly so that whatever happens the quotes will always be there when I come 
back?


      Thanks,

      Louis


      2008/5/22 Louis Préfontaine <[EMAIL PROTECTED]>:

        Ok I ran an exploration with phony parameter (C>1) and saved the result 
to a watchlist and then exported the watchlist to a .tsl file.  

        Now I ran the script; it said "No tickers found in Amibroker" but then 
it began downloading the information as I wanted it to do.

        But then, my question is: how to take that information back to the 
Database I am using?  If I understand correctly (I did some research on the 
site) the .tls is simply a ticker list with no more information, so where is 
going the information and how to make sure that that information will go 
straight back to the database?

        Thanks,

        Louis


        2008/5/22 Louis Préfontaine <[EMAIL PROTECTED]>:


          Hi Chris,

          Thanks for your help.

          The problem I have is that...  I am not sure how to use the .tls 
files!  In fact, I never used them; instead I would simply use the 
"Auto-updated quotes" from the "Tools" menu in AB to automatically download the 
quotes from Amibroker.   So, I see in the code that you posted that I need to 
have the .tls files setted, and I am not sure how to do this.  

          1) How to take the tickers in my current database and put them in the 
.tls;
          2) How to be sure that the next morning when I will open AB it will 
open the good database and that the database will contain the new information 
from the .tls file.

          I guess this must be a really simple thing, but I still didn't get 
it... yet!


          Thanks,

          Louis


          2008/5/22 Chris DePuy <[EMAIL PROTECTED]>:


            You could try this.. (where big = your database name).  If you have 
questions about detailing this, then you might want to do a 
"site:www.amibroker.com AB.LoadDatabase" search and see what is on the ami site.
            Good luck


            /********************Amibroker open to 
database***********************/
            AB = new ActiveXObject("Broker.Application");
            AB.LoadDatabase("C:\\Program Files\\Amibroker\\Big");
            AB.Visible = true;

            /* retrieve automatic analysis object */ 
            AA = AB.Analysis; 


            /********************Amiquote retrieve 
current***********************/

            AQ = new ActiveXObject("AmiQuote.Document");

            AQ.Open("C:\\Program files\\Amibroker\\amiquote\\Big.tls");
            AQ.GetSymbolsFromAmiBroker();
            FromDate = new Date(2006,7,1,0,0,0);

            /* 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 */
            AQ.From = FromDate.getVarDate();
            AQ.To = ToDate.getVarDate();
            AQ.AutoImport = true; // import automatically

            AQ.Source = 1; // Yahoo Current

            AQ.Download(); // starts download
            // wait until download and import is finished
            while( AQ.DownloadInProgress || AQ.ImportInProgress )
            {
                WScript.sleep(5000); // wait 5 seconds before querying status 
again
            }

            /********************Amiquote retrieve current 
(end)***********************/

              
              ----- Original Message ----- 
              From: Louis Préfontaine 
              To: [email protected] 
              Sent: Thursday, May 22, 2008 8:33 AM
              Subject: Re: [amibroker] amiquote lack of control


              Thanks,

              This is what I was looking for...

              Unfortunately, I know nothing  (nada, niet, rien) of this 
language.   I don't use any .tls folder; is it possible to build such script 
that would automatically look into AB and update the quotes in the selected 
database?  Or would it be better to save my current databse in .tls?

              Thanks,

              Louis



              2008/5/22 Chris DePuy <[EMAIL PROTECTED]>:


                Yuki had asked in "Re: [amibroker] amiquote lack of control"  
now Louis has asked in "Is it possible to run Amiquote automatically".  Here is 
how to get Amiquote to run by itself from "outside" of Amibroker.


                Amibroker and its related programs are easy to make work from 
other programs, like DOS boxes, or by double clicking in windows.

                1)   
http://www.google.com/search?hl=en&q=site%3Awww.amibroker.com+OLE+amiquote&btnG=Google+Search

                2) Now, here's some code to try (copy this into notepad).
                AQ = new ActiveXObject("AmiQuote.Document");
                AQ.Open("C:\\mysymbols.tls");

                FromDate = new Date(1995,5,1,0,0,0);
                /* 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 */
                AQ.From = FromDate.getVarDate(); 
                AQ.To = ToDate.getVarDate(); 

                AQ.AutoImport = true; // import automatically
                AQ.Source = 0; // Yahoo Historical

                AQ.Download(); // starts download

                // wait until download and import is finished
                while( AQ.DownloadInProgress || AQ.ImportInProgress )
                {
                    WScript.sleep(5000); // wait 5 seconds before querying 
status again
                }

                WScript.echo("Download and import complete");


                3) Keep in mind, that you have to use notepad to create this.  
And call it, yuki.js and then save it.  Then, double click yuki.js and it'll 
run a bunch of stuff in amiquote automatically.

                4) If you are interested, you can use "Scheduled Tasks" to run 
yuki.js at scheduled times (See ramvilas 's email from 5/22/08)



                  ----- Original Message ----- 
                  From: Yuki Taga 
                  To: Tomasz Janeczko 
                  Sent: Sunday, May 11, 2008 5:35 PM
                  Subject: Re: [amibroker] amiquote lack of control


                  Is there anything for "normal" people? I mean people who look 
at the
                  link you have provided and say, "Gee, that looks like it 
should be
                  useful, somehow, but what now?" People who think OLE is 
something you
                  shout in Spain, at a bullfight?

                  Yuki

                  Saturday, May 10, 2008, 5:29:13 AM, you wrote:

                  TJ> Hello,

                  TJ> Automation via "keyboard simulation" is not reliable.
                  TJ> Reliable way to automate is to use OLE interface
                  TJ> and that is proper way to automate AmiQuote

                  TJ> http://www.amibroker.com/guide/aqobjects.html

                  TJ> Best regards,
                  TJ> Tomasz Janeczko
                  TJ> amibroker.com
                  TJ> ----- Original Message ----- 
                  TJ> From: "Yuki Taga" <[EMAIL PROTECTED]>
                  TJ> To: <[email protected]>
                  TJ> Sent: Friday, May 09, 2008 1:37 PM
                  TJ> Subject: [amibroker] amiquote lack of control

                  >>I use a keyboard automation program (Automate) to do a lot 
of routine
                  >> tasks, including tasks that must get done when I'm on 
vacation.
                  >> (When I'm on vacation, it means I don't even log into a 
computer for
                  >> *any* reason -- in fact, I don't even want to *see* a 
computer when
                  >> I'm on vacation.)
                  >> 
                  >> I also keep a database of selected US indices and symbols 
(not
                  >> large), that I update with Yahoo (dead-on accuracy is not 
necessary).
                  >> But with Amiquote, I cannot toggle between 'Current' and
                  >> 'Historical', because there is no way to do this via the 
keyboard.
                  >> 
                  >> Unfortunately, some Yahoo symbols have daily data, but no 
historical
                  >> data. I like to run 'Current' in the morning (my time), and
                  >> 'Historical' in the afternoon. Then I'm covered.
                  >> 
                  >> I have asked on more than one occasion that keyboard 
control be added
                  >> to Amiquote, but it is apparently a very low priority. 
However, my
                  >> next paid Amibroker upgrade will be an equally low 
priority unless
                  >> there is a way to accomplish what I feel I need to do.
                  >> 
                  >> Anyone?
                  >> 
                  >> Yuki
                  >> 
                  >> 
                  >> ------------------------------------
                  >> 
                  >> Please note that this group is for discussion between 
users only.
                  >> 
                  >> To get support from AmiBroker please send an e-mail 
directly to 
                  >> SUPPORT {at} amibroker.com
                  >> 
                  >> For NEW RELEASE ANNOUNCEMENTS and other news always check 
DEVLOG:
                  >> http://www.amibroker.com/devlog/
                  >> 
                  >> For other support material please check also:
                  >> http://www.amibroker.com/support.html
                  >> Yahoo! Groups Links
                  >> 
                  >> 
                  >> 















   

Reply via email to