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 [email protected], "progster01" <progs...@...> 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 [email protected], "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 > > >
