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

[amibroker] Re: Pass data from 1st pahse of backtest to 2nd phase


  • Date: Thu, 18 Feb 2010 00:41:37 -0000
  • From: "Pmxgs" <pmxgs@xxxxxxxxxx>
  • Subject: [amibroker] Re: Pass data from 1st pahse of backtest to 2nd phase

PureBytes Links

Trading Reference Links

 Thanks for your answer and suggestions.

 I'm actually struggling a bit because I'm trying to write code for a system that scales trades at different price levels, so in some bars I have to calculate the average entry price (and for this I need to know when the last trade ended), but the exit signal, which depends on portfolio equity is determined in the 2nd phase. So I have a kind of chicken-egg problem, because to calculate the next trade entry price I need to know when a trade has exited,which is only determined in the final(2nd) phase of the backtest. And in the 2nd phase I don't have access to all price arrays, indicators arrays, etc, as you said. 
I will probably have to simplify and make an assumption of some sort.



--- In amibroker@xxxxxxxxxxxxxxx, "progster01" <progster@xxx> wrote:
>
> 
> It can definitely be done with static variables.  Details and best way to reach your goal may depend on exactly what data you want to pass.
> 
> One thing that slowed me down when I first tried to do this sort of thing was not properly recalling the context of phase 2 of the backtest.  The symbol price data and your per-symbol TA calcs are gone in phase 2, the active symbol is ~~~EQUITY, and what you have to work with are the signal and trade lists which were constructed in phase 1.
> 
> Of course, if you've saved something as a static, it will be there also.
> 
> If your desired data-to-pass is per-symbol data, be sure to name your statics that way.  Then, in the CBT, you can determine the symbol being processed via trade.symbol or signal.symbol, re-construct the correct static name, and access the saved static data.
> 
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "Pmxgs" <pmxgs@> wrote:
> >
> > Hi,
> > 
> >  I need to pass some data from the first phase of the baktest to the 2nd phase.
> > 
> >  I think that both addtocomposit and static variables can do this, but I'm not sure.
> > 
> >  What is the best way do do it?
> > 
> >  thanks
> >
>




------------------------------------

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

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    amibroker-digest@xxxxxxxxxxxxxxx 
    amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

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