Robert - I think you'll have to use jScript or VB to drive AB.  I didn't fire 
this up this morning and it may have errors but I'm shipping  a clip to give an 
example how LAYOUTS, TEMPLATES and TABS can be selected from jScript.   From 
the dates in the zoom to range it appears I haven't tried this for a couple of 
years.  It was a test routine and note that I was going for 3 specific stocks. 

It's in the manual, of course in the COM object documentation.   Good luck 
finding it. 

Hope this helps
Joe 





AB = new ActiveXObject("Broker.Application");
AW = AB.ActiveWindow;
 
for( i = 1000; i < 1003; i++ )
{
Stk = AB.Stocks( i );
 WScript.Sleep( 2000 ); // 2 seconds delay
  Doc = AB.Documents.Open( Stk.Ticker );
   if(AB.LoadLayout("C:\\Program 
Files\\AmiBroker\\AFL\\Composites\\Holdings.aly"));
   {
   WScript.Echo("Load Layout Successful"); 
   }
   if(AW.LoadTemplate("HIA.aly"));
   {
   WScript.Echo("Template Load Successful"); 
   }
   AW.SelectedTab=1;  // Switch to tab 0,1,2,3
  
   if(AW.ZoomToRange("2006-1-3","2006-3-7"));
   {
   WScript.Echo("Zoom Successful"); 
   }  
   
   AB.ActiveWindow.ExportImage(Stk.Ticker + ".png")
   WScript.Sleep( 2000 ); // 2 seconds delay
    
 Doc.Close(); 
 
}    


  ----- Original Message ----- 
  From: Robert Grigg 
  To: [email protected] 
  Sent: Sunday, January 20, 2008 5:02 AM
  Subject: [amibroker] Creating Chart element from .afl files in Backtest, 
Scans and Explorer


  I am new to Amibroker and to this forum, but with considerable
  experience with both Wealthlab Developer and Metastock.

  I am attempting to build some integrated afl scripts (as templates)
  that work accurately in Backtest, Scan and Explorer modes.

  The greatest difficulty I am experiencing is generation of multi pane
  charts from within the afl script. I find I can generate signals and
  indicators to be written on an existing chart but I cannot call up
  either a stored layout or template.

  I am most probably missing something. Can someone put me on the right
  track? What is the best way to generate or manage a complex chart
  from within an afl that accurately represents the current state of
  Backtest, Exploration or Scan?

  Robert 



   

Reply via email to