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

[amibroker] Re: Programmatically set Current ticker?


  • Date: Tue, 16 Mar 2010 18:31:01 -0000
  • From: "Mike" <sfclimbers@xxxxxxxxx>
  • Subject: [amibroker] Re: Programmatically set Current ticker?

PureBytes Links

Trading Reference Links

Kieth,

My example was for an external javascript (e.g. .js file).

Trying to change the active symbol from within a running AFL is probably not a good idea (if at all possible) since you would effectively be executing AFL code that would be cutting your feet out from under yourself (i.e. running script over a symbol that changed the symbol before the script was finished running).

What would you expect the result to be if you had something like this:

_TRACE("Close is: " + Close);
<swap out symbol>
_TRACE("Close is: " + Close);

I'm not sure exactly what scenario you are trying to capture. But, what I was suggesting was to run an external javascript to drive AmiBroker, not driving AmiBroker from within AmiBroker.

However, to answer your question; Your problem is that you are mixing javascript and AFL incorrectly. You would just need to use AFL.

e.g.
AB = CreateObject(...);
Doc = AB.ActiveDocument;
Doc.Name = ...

Mike

--- In amibroker@xxxxxxxxxxxxxxx, Keith McCombs <kmccombs@xxx> wrote:
>
> Mike --
> That's probably what I need.  I'm going to have to come up to speed a 
> bit on jscipt first though.  Right now, I'm getting syntax error on the 
> AX = ... line below:
> 
> |AB = CreateObject("Broker.Application");
> EnableScript( "jscript" );
> AX = new ActiveXObject("Broker.Application");
> // Editor: Error 30. Syntax error|
> 
> I'm guessing that there is a M$ something that I have to install to fix it.
> 
> I'm also having problems understanding "AmiBroker's OLE Automation 
> Object Model" in the AB Users Manual.  Is there a "for Dummies" version 
> available somewhere?
> 
> Thanks for your help.
> -- Keith
> 
> 
> On 3/16/2010 05:15, Mike wrote:
> >
> > From javascript:
> >
> > var ab = new ActiveXObject("Broker.Application");
> >
> > ab.LoadDatabase(...);
> > ab.ActiveDocument.Name = "ORCL";
> >
> > If there is no active document (i.e. no open charts) then you will get 
> > an exception. Haven't gotten around to looking into how to set the 
> > active document when none present.
> >
> > Mike
> >
> > --- In amibroker@xxxxxxxxxxxxxxx <mailto:amibroker%40yahoogroups.com>, 
> > Keith McCombs <kmccombs@> wrote:
> > >
> > > Does anyone know how one might programmatically set the current ticker.
> > > Not SetForeign().
> > >
> > > My reason is that I have written a function that runs fine, as long as
> > > the 'current' ticker has some data. However, if the current ticker has
> > > no data, then the function does not work. Its purpose is to load new
> > > tickers and set static variables from a list. It doesn't actually _do_
> > > anything with the current ticker.
> > >
> > > I've looked through all the functions in the 5.20 manual and the OLE
> > > Object Model. But couldn't find anything that I thought might work.
> > >
> > > Thanks in advance, for any and all help.
> > > -- Keith
> > >
> >
> >
>




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

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