Bypass "User Consent" while Optimizing using OLE/Batch

Greetings Experts,

Trying to run Optimization externally:

AB = new ActiveXObject( "Broker.Application" ); // creates AmiBroker object
try
{ 
     NewA = AB.AnalysisDocs.Open( "C:\\TradingApps\\AmiBroker\\Formulas\\Custom\\# EOD Scheme\\OptimizerAPX.apx" );
	 if( NewA )
     { 
         NewA.Run( 4 ); // starts optimizer
		 while( NewA.IsBusy ) WScript.Sleep( 500 ); // check IsBusy every 0.5 second
		 NewA.Close(); // close new Analysis
     } 
} 
catch( err )
{ 
     WScript.echo( "Exception: " + err.message ); // display error that may occur
}

For some symbols the above script is getting halted because of the below precautionary warning.

Opt

Is there a solution using Batch or any other OLE command?

Thank you

There is also an option in Analysis Settings / Report to enable/disable "Warn before running time-consuming optimizations".

3 Likes

In APX file:

<ExtensiveOptimizationWarning>0</ExtensiveOptimizationWarning>