You don't need to close AB. Just use save or save all.

 

From: amibroker@yahoogroups.com [mailto:amibro...@yahoogroups.com] On Behalf
Of Keith McCombs
Sent: Friday, August 20, 2010 11:16 AM
To: amibroker@yahoogroups.com
Subject: Re: [amibroker] Problem with ExportImage in AB 5.30.4?

 

  

Progster --
I recently noticed, with 5.30.4, something that may be related to the
problem you are having.  Maybe not.

After a walk forward test, ~~~ISEQUITY and ~~~OSEQUITY are not written to
disk until AB is closed.  Same goes for ~~~EQUITY after a backtest.  This is
driving me up a wall.  I used to copy and rename these files for safe
keeping while AB was running.  Now I have to close AB first.  Very
inconvenient.
-- Keith


On 8/20/2010 05:12, Progster wrote: 

  

Hi,

Is is possible that the AB OLE Automation Object Model call 
ExportImage() is broken in AB 5.30.4?

Despite everything I could think of to try, the images always come out 
blank, like those attached.

Neither of the codes below work, and yet each was said to work on the 
list in the past.

Operational attempts have included:

AB Open Dbl-Click on script
AB Open Run script from command window

AB Closed Dbl-Click on script
AB Closed Run script from command window

Results are always either: server error, AB crash, or it runs and 
produces the blank chart.

When AB is open, it doesn't matter what layout/chart is up. Still no joy.

What could be (not) happening here???

- Progster

-----------

// ImageTest_01.js
AB = new ActiveXObject("Broker.Application");
AB.ActiveWindow.ExportImage( "test.gif", 640, 480 );

// ImageTest_02.js

iWatchList = 8; /// you can define watch list number here

AB = new ActiveXObject("Broker.Application");
Qty = AB.Stocks.Count; for( i = 0; i < Qty; i++ )
{
Stk = AB.Stocks( i );
if( iWatchList < 32 )
{
if( Stk.WatchListBits & ( 1 << iWatchList ) )
{
Doc = AB.Documents.Open( Stk.Ticker );
WScript.Sleep( 4000 ); // 4 seconds delay
AB.ActiveWindow.ExportImage(Stk.Ticker + ".png")
Doc.Close();
}
}
else
{
if( Stk.WatchListBits2 & ( 1 << ( iWatchList - 32 )) )
{
Doc = AB.Documents.Open( Stk.Ticker );
AB.ActiveWindow.ExportImage(Stk.Ticker + ".png")
WScript.Sleep( 4000 ); // 4 seconds delay
Doc.Close();
}
}
}



Reply via email to