Hi.

I thought that supplying a runnable script that only needed a missing bit added 
at an identified point would be most helpful way to ask about this subject.

However, since no one has even so much as said "Yes, that can be done.", I'm 
starting to wonder if it can be done at all, and I'm also wondering if 
supplying a script made my question seem more complicated to read and reply to 
than intended.

So, script aside, I will try to re-ask this question in the simplest form I can 
come up with:

Is it possible using the AB object model to:

a.   Open AB, open a chart, apply an AFL, SEE THE CHART WITH YOUR AFL APPLIED, 
then dismiss and quit.

or

b.   Open AB, load a template, SEE THE TEMPLATE DISPLAYED, then dismiss and 
quit.


Responses that would be helpful to me at this point include:

1.  I wanted to do that too, but I wasn't able to make it happen.  :-(
2.  I've done that.  It can be done.  Keep at it.  Good luck!  :-P
3.  I've done that, here's how ...  :-)
4.  Are you blind?  Exactly how to do it (with a working example!) is right 
here in the docs:<  link>     :-[

Load, display, dismiss - that should be all I need ...

- Progster


On 7/9/2010 11:25 AM, Progster wrote:
> [Attachment(s) <#TopText> from Progster included below]
>
> Hi.
>
> Using OLE/jscript, I would like to do the following:
>
> 1. Start AB
> 2. Choose a database
>
> In a loop across multiple symbols (symbol names known in advance):
>
> 3a. Open a chart and apply an AFL
>
> or
>
> 3b. Open a saved layout that has a given AFL applied
>
> 4. Quit AB
>
> I've done a good amount of both Googling and experimenting, but I
> haven't hit on the right sequence yet to accomplish this.
>
> It is only step 3 that I'm having a problem with. My problem is not
> executing the loop. That seems fine.
>
> However, nothing I have found or tried opens/loads a chart and
> applies/runs an AFL.
>
> Below is skeleton code that runs.
>
> If someone is able to be so kind as to fill in the missing bit, I'd
> really appreciate it. If there's more than one way to do it,
> alternative solutions are very welcome.
>
> Thanks.
>
> ---
>
> /*
> LoopDemo_01.js
>
> _01 201007089 Initial "empty" skeleton by Progster
>
> It is recommended to run this file in a command window, like so:
>
> >cscript LoopDemo_01.js
>
> Lines commented with // *** will need to be edited to reflect
> the local environment
>
> Goals:
>
> 1. Start AB
> 2. Choose a database
>
> In a loop across multiple symbols (symbol names known in advance):
>
> 3a. Open a chart and apply an AFL
> or
> 3b. Open a saved layout that has a given AFL applied
>
> 4. Quit AB
>
> */
>
> function pausecomp(millis)
> {
> var date = new Date();
> var curDate = null;
>
> do { curDate = new Date(); }
> while(curDate-date < millis);
> }
>
> // General paths and setup definitions
> Settings_Directory = "C:\\Amibroker_Formula_Root\\"; // ***
> SettingsFileName = "Futures_01.ABS"; // ***
>
> Layout_Directory = "C:\\AmiBroker_Data\\US-PremiumData\\Layouts\\"
> // ***
> LayoutFileName = "MyLayout.ALY"; // ***
>
> SettingsFile = Settings_Directory + SettingsFileName;
> WScript.Echo( "SettingsFile: " + SettingsFile );
>
> LayoutFile = Layout_Directory + LayoutFileName;
> WScript.Echo( "LayoutFile: " + LayoutFile );
>
> AFL_Directory = "C:\\Amibroker_Formula_Root\\Custom\\"; // ***
>
> // Create AmiBroker object
> AB = new ActiveXObject("Broker.Application");
>
> // Load Database
> AB.LoadDatabase("C:\\Amibroker_Data\\US-PremiumData"); // ***
>
> // Test of changing symbols // ***
> var symbols = new Array(4);
> symbols[0] = "$SPX" ;
> symbols[1] = "GOOG" ;
> symbols[2] = "AAPL" ;
> symbols[3] = "SPY" ;
> // symbols[] = "" ;
>
> for (idx = 0; idx <= 3; idx++)
> {
> next_symbol = symbols[idx];
> WScript.Echo( "Working on: " + next_symbol);
>
> // Aim is to load a chart here, and load code (which will run
> and generate the desired result)
>
> ChartFileName = "My_Chart_File.afl"; // ***
> ChartFile = AFL_Directory + ChartFileName;
> WScript.Echo(ChartFile);
>
> pausecomp( 1000 ) ;
> }
>
> AB.SaveDatabase();
> AB.RefreshAll();
>
> pausecomp( 1000 ) ;
>
> WScript.Echo("Closing AmiBroker");
> AB.Quit();
>
> WScript.Echo("Pipeline is Done.");
>
> 


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

**** 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-dig...@yahoogroups.com 
    amibroker-fullfeatu...@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscr...@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

Reply via email to