PureBytes Links
Trading Reference Links
|
If you are planning on having many systems, but few custom backtester implementations, then you could update your Custom_Backtesting.afl to #include whichever system that you want to test, then run the Custom_Backtesting.afl script. Any variables required by the custom backtester are expected to be defined in whichever System.afl you #include.
e.g.
System.afl
Buy = DayOfWeek() == 1; Sell = DayOfWeek() == 5; MyBackTestVar = true;
Custom_BackTesting.afl
#include <System.afl>
SetCustomBacktestProc("");
if (Status("action") == actionPortfolio) { if (IsNull(VarGet("MyBackTestVar"))) { _TRACE("MyBackTestVar was undefined."); } else if (MyBackTestVar) { _TRACE("MyBackTestVar was true."); } else { _TRACE("MyBackTestVar was false."); }
bo = GetBacktesterObject(); bo.Backtest();
// Add custom metrics here... } If you are planning on having many custom backtest implementations, but few systems, then you can update System.afl to #include whichever custom backtest you want to test, then run the Ssytem.afl script. Any variables required by the custom backtester would be expected to be passed as procedure parameters.
System.afl
#include <CustomBacktest.afl>
Buy = DayOfWeek() == 1; Sell = DayOfWeek() == 5; MyBackTestVar = true;
SetCustomBacktestProc("");
if (Status("action") == actionPortfolio) { RunCustomBackTest(MyBackTestVar); }
Custom_Backtesting.afl
procedure RunCustomBackTest(Var) { if (Var) { _TRACE("Var was true."); } else { _TRACE("Var was false."); }
bo = GetBacktesterObject(); bo.Backtest();
// Add custom metrics here... }
Mike
--- In amibroker@xxxxxxxxxxxxxxx, Radek Simcik <radek.simcik@xxx> wrote: > > Hi there, > > I did not figure out how to pass a value from my system.afl to my > custom_backtesting.afl > > Now I can call custom_backtesting.afl using SetCustomBacktestProc from > any system.afl. > > But I want to be able to pass different values to my > custom_backtesting.afl from different systems.afl without changing > custom_backtesting.afl code. > > I really do not know how to do it. Any ideas? > > Thank you, > > Radek > > On Fri, Mar 20, 2009 at 7:00 PM, Mike sfclimbers@xxx wrote: > > 1. Have a look at custom metrics. > > http://www.amibroker.com/guide/a_custommetrics.html > > > > 2. You can refer to any defined variable from within your custom backtest > > code. Those variables can be defined in any .afl file and #include into the > > current .afl > > http://www.amibroker.com/guide/afl/afl_view.php?id=1 > > > > 3. Divide your logic into modular files and #include as needed. e.g. > > buysell.afl, backtest.afl (#include's buysell.afl), explore.afl (#include's > > buysell.afl). > > > > Mike > > > > --- In amibroker@xxxxxxxxxxxxxxx, Radek Simcik radek.simcik@ wrote: > >> > >> hi all, > >> > >> could anybody give me a hint how I can add > >> - position score > >> - results per ticker not per trade > >> - trigger date > >> > >> to my backtesting result window? > >> > >> Also is there any way how I can pass parameter to my customized > >> backtester afl from my system afl? In case I want to have two separate > >> afl files? > >> > >> I want to have one special condition in my exploration but not in my > >> backtest/optimization. Is there any way I do not have to take care of > >> it manually? > >> > >> Thank you, > >> > >> Radek > >> > > > > >
__._,_.___
**** 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/
__,_._,___
|