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

Re: [amibroker] How to pass variables from AFL to embedded JScript?



PureBytes Links

Trading Reference Links

Title: Re: [amibroker] How to pass variables from AFL to embedded JScript?


ozzyapeman,


You seem to have solved some problems I have been struggling with...can you tell me:


How do you detect that that the WF engine is starting the Backtest phase?

How do you detect that it has completed the Backtest phase?


I want certain code to execute, and log some data, at those points only.


Many tanks,

herman




Monday, May 11, 2009, 9:03:33 PM, you wrote:


>



Hello, hoping someone can help out here. During a Walk-Forward test, I am trying to pass From and To dates from the WF engine into an embedded JScript. I essentially want to do a "sub-optimization" as part of the backtest portion of the WF test. However, it seems that I cannot pass variables from the AFL to the JScript. 


Is there any way to pass the From and To dates into the JScript? Below is what I have. It generates an 'undefined source' error for these lines:



AA.RangeFromDate = FromDateStr;   

AA.RangeToDate   = ToDateStr;



Here is the AFL with embedded JScript:


    FromDateNum = Status"rangefromdate" );

    ToDateNum   = Status"rangetodate"   );


    FromDate    = DateTimeConvert2, FromDateNum );

    ToDate      = DateTimeConvert2, ToDateNum  );


    FromDateStr = DateTimeToStr( FromDate );

    ToDateStr   = DateTimeToStr( ToDate  );

    


    EnableScript"jscript" );

    <%


    Formula     = "F:\\SomeFormula.afl";

    Database    = "F:\\AB Databases\\MyIB";

    Settings    = "F:\\Some Settings.ABS";    


    AB = new ActiveXObject( "Broker.Application" );

    AA = AB.Analysis;


    AB.LoadDatabase( Database );

    AB.ActiveDocument.Name = "EURUSD";       

    AA.LoadFormula( Formula );              

    AA.LoadSettings( Settings);

    AA.ApplyTo       = 1;                  

    AA.RangeMode     = 3;                  

    AA.RangeFromDate = FromDateStr;  // * ERROR * 

    AA.RangeToDate   = ToDateStr;

    AA.Optimize( 0 );                     


    AA.Export ( "F:\\TestReport1.html" );


    %>







__._,_.___


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





Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___