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

Re: [amibroker] INCLUDE subroutines



PureBytes Links

Trading Reference Links

> 1.  The optimization (of just one Core logic module) was very very slow
> (normally a 1-2 minute pass of 5800 steps took 11 minutes when done thru
> the INCLUDE statement.  Could it be that it is looking up the CORE code
> on each pass?

AmiBroker uses simple caching of formula but if many formulas use
#includes this caching may not be effective. 
So if you want to speed it up make sure that no other formula is
parsed during optimization (by closing Indicator windows)

Still using #include one could easily grow resulting pre-processed
file so much that it is slow just because of the size (amount of code).

> 
> 2.  (Counter to #1), when I made a change in the key constants within
> the Core code, resaved it, reloaded the Analysis code and ran a
> backtest, the results used the original constants---IOW, it did not
> recognize the changes I had made in the called code.  I fiddled with it,
> but the only way I was able to get the changes recognized was to exit AB
> and restart AB.  Then the changes were recognized and the different
> results were displayed.  

You are experiencing caching side effect.
As far as it is possible entire formula is pre-processed once (all include
files are included) and resulting formula is cached in the memory,
until you change the main formula (the one that contains #includes).
You can simply add a space or any other thing (a comment)
to the main formula present in AA window and it will cause re-doing 
#includes.
There is no need to restart.


Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "Ken Close" <closeks@xxxxxxxx>
To: "AmiBroker List" <amibroker@xxxxxxxxxxxxxxx>
Cc: "'Tomasz Janeczko'" <tj@xxxxxxxxxxxxx>
Sent: Sunday, April 06, 2003 6:28 PM
Subject: [amibroker] INCLUDE subroutines


> All:  I have done some work using a lot of include statements and wanted
> you to know about what I have done.  I also am requesting comments on
> some unusual observations. Perhaps if Tomasz replies, we can all learn
> some more about using the INCLUDE statement.
> 
> Background:
> 
> I have built a series of files using a "CORE" file, a "PLOT" file, and
> an "ANALYSIS" file.  While I realize that the commands are context
> sensitive, I am using so many different combinations of code lines, that
> it seems more simple to separate them. I also only need to change the
> CORE code one place and all indicators, backtests, combinations, etc.,
> will reflect the changes properly.
> 
> Also, as a small point, if I have a PLOT statement within the logic and
> I then use the Equity Plot (Tonetti's enhanced code), I get the Plot of
> the Equity lines PLUS the PLOT statement that is within the main code
> lines, which obviously distorts the equity display.  I avoid this with
> the separate PLOT subroutine.
> 
> DETAILS:
> 
> I call the "Core" code the following   T1C_NAME.afl.  It has all of the
> logic for the T1 "signal" I am building.
> 
> I call the Plotting code "T1P_NAME.afl, and it just contains some plot
> statements and the INCLUDE function calling T1C_NAME.afl.
> 
> I call the Analysis coce "T1A_NAME,afl, and it just contains the
> buy/sell logic and INCLUDE function calling T1C_NAME.afl.
> 
> As the NAME code evolves, I only have to change it one place.
> 
> I have found it very convenient to build combined signals with something
> like (not proper syntax--just trying to illustrate the idea):
> 
> INCLUDE (C:\......\T1C_NAME.afl;
> T1 = some logic...
> 
> INCLUDE (C:\......\T2C_NAME2.afl;
> T2 = some logic...
> 
> TSum = T1 + T2 + ....   (you should get the idea).
> 
> As I moved into Optimization, I observed the following two things
> (comment needed from Tomasz or others on this):
> 
> 1.  The optimization (of just one Core logic module) was very very slow
> (normally a 1-2 minute pass of 5800 steps took 11 minutes when done thru
> the INCLUDE statement.  Could it be that it is looking up the CORE code
> on each pass?
> 
> 2.  (Counter to #1), when I made a change in the key constants within
> the Core code, resaved it, reloaded the Analysis code and ran a
> backtest, the results used the original constants---IOW, it did not
> recognize the changes I had made in the called code.  I fiddled with it,
> but the only way I was able to get the changes recognized was to exit AB
> and restart AB.  Then the changes were recognized and the different
> results were displayed.  
> 
> So the question is:  during optimize does the include statement go and
> read the original code on every pass, and if this is so, why do manual
> changes made to the called code not get recognized without exiting the
> program and restarting it??
> 
> I hope some of you find this interesting and if you have any comments or
> suggestions, please fire away.
> 
> Thanks,
> 
> Ken
> 
> 
> 
> 
> Send BUG REPORTS to bugs@xxxxxxxxxxxxx
> Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
> -----------------------------------------
> Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
> (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> --------------------------------------------
> Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
> 
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 
> 
> 
> 

------------------------ Yahoo! Groups Sponsor ---------------------~-->
Make Money Online Auctions! Make $500.00 or We Will Give You Thirty Dollars for Trying!
http://us.click.yahoo.com/yMx78A/fNtFAA/i5gGAA/GHeqlB/TM
---------------------------------------------------------------------~->

Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

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