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

Re: [amibroker] COM Object Statement Works One Place but Not another



PureBytes Links

Trading Reference Links

Did you get the error when you invoked "Verify syntax" in the Formula Editor window? If so, you can ignore the error and try to run it (Explore).
The error will disappear at run time. Then if you go back to Formula Editor after you run it, the error won't re-occur.

When you invoke "Verify syntax" in the Formular Editor for the first time, the variable cs is not initiated yet. Running it once should fix the error.

  ----- Original Message ----- 
  From: Ken Close 
  To: amibroker@xxxxxxxxxxxxxxx 
  Sent: Monday, August 14, 2006 9:27 PM
  Subject: [amibroker] COM Object Statement Works One Place but Not another



  This is really puzzling.  I successfully have used the following CompositeLoad procedure (from Dan Clark).  It runs and creates great ATCs/

  Tonight, I copied this portion from one working code file to a new one, and then got an error for a statement that works in the original file.  How can that be?

  Code Snippit:
  Filter=1;

  AB = CreateStaticObject("Broker.Application");

  //Procedure to add to Composite values

  procedure CompositeLoad(Sym, SymName, CloseVal, OpenVal, HighVal, LowVal, VolVal, 
   OpenIntVal, ATCFlags, TargetWLNbr)
     {
     //Add To Composite
     AddToComposite(CloseVal,   Sym, "C", ATCFlags);
     AddToComposite(OpenVal,    Sym, "O", ATCFlags);
     AddToComposite(HighVal,    Sym, "H", ATCFlags);
     AddToComposite(LowVal,     Sym, "L", ATCFlags);
     AddToComposite(VolVal,     Sym, "V", ATCFlags); 
     AddToComposite(OpenIntVal, Sym, "I", ATCFlags); 
     
     //Modify Names
     cs        = AB.Stocks(Sym) ;                      
     cs.FullName = SymName          ;                 <<<<<<<<<<<<<<< Error in this statement ***
   
     // Add to Watchlists
     if (TargetWLNbr != 0)
         CategoryAddSymbol(Sym, categoryWatchlist, TargetWLNbr); 
     }

  *** Error 18:  COM object variable not initiated or has invalid type.

  Since I copied the lines from one working file into a new one, how can this line get an error?
  What step am I missing?
  Can someone explain what this line and the one above it are doing?
  Right now I can not get it to produce an ATC when I comment out the cs.FullName line.

  Thanks for any help,
  Ken