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

RE: [amibroker] Re: How to save Metrics in Composites for Individual BTs



PureBytes Links

Trading Reference Links

Average ? … I suspect from a variety of things you have posted over the years that you are also well beyond the “average” user …

 

I suspect the average user never wrote anything utilizing Equity() or ~~~Equity … In point of fact I can’t say that the bulk of what I write involve these either … Beyond that there is undoubtedly a surprisingly large percentage of users who are visual in nature and who have yet to click the backtest button and may never do so …

 

Those who are interested in one aspect of AB or another and also have a propensity for beating drums do contribute to pushing the envelope of AB’s capabilities …

 

That’s a good thing … Even if it isn’t seen initially by all as being so …

 


From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of Herman
Sent: Tuesday, July 29, 2008 6:12 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: RE: [amibroker] Re: How to save Metrics in Composites for Individual BTs

 

This is a reply to several emails.

Someone questioned whether it is wise for me to wait for the metric function to be provided. Well, I never "wait" for canned solutions; I always find a work around to solve my problems in some other way. However, doing this is sometimes frustrating and it certainly is a big drain on my time. If this is so for me than this must be so for many other users. When I push for new functions I do this with a community spirit, not just to get what "I" want/need; I push for it because some of these functions are long overdue and make common sense to have. 

To give you an example: I remember that many years ago I was pushing for the equity(), I even wrote/posted my own afl Equity(), and the hbEquity() DLL that featured Equity Feedback arguments. Look at it today: who could design a system without the AB Equity()? Metric functions are just as important as the equity(); they are the next logical step. There is no escape, eventually they will be there. So, why not lead the pack? Hmmm, Coming to think of this is actually very funny :-) I remember that at the time, before we had the AB equity(), Tomasz wrote something like he is writing today: "it is doable in AFL; see Herman's AFL Equity() implementation". That was in 2002.. grrr. Shows you how slow ideas evolve in TA. I ought to have been a millionaire by now...well, perhaps next year ;-)

Paul, please look at the MA() example posted by Al V. It demonstrates the asymptotic behaviour of metrics provided by the composite solution provided by Tomasz. I do not understand how you can create, reconstruct, or reverse engineer, a period-based metric function from an all-bars solution giving true values. If it is possible please give a complete solution.

Fred, I think that the way you design systems OLE/automation is indeed the solution. However you do not represent the average AB user - you fall in the 1% of users who have the expertise to run their own show.  

Indeed Fred posted (thanks again Fred!) some very nice code awhile back that I was converting to a getPerformancemetric() for posting on the UKB, however I haven't had time to finish it (major hardware problems). Let me tell you though that this is NOT something that every AB user wants to write, to make it a general function it already amounted to some 600 lines of code. And there are MAJOR headaches to make it match AA BT results - which is imo essential. Not to mention that the code should work under all conditions without errors. If there are any volunteers to finish and verify the code you may email me privately.

Tomasz, this is not a case of what is doable, it is a case of providing what is needed, and of making easy-to-use AFL tools available to everyone. This is the age of Quantitative and Automated trading; trading by the charts is mostly for beginners, aspiring traders, and investors. If one is trading a quantitative/mechanical system that cannot be backtested, does one really have a "system"? Everyone loves AFL, but everyone hates having to get involved (spend significant time and never be an expert) in learning secondary programming languages and/or sophisticated techniques, just to get some relatively simple idea of the ground. I am not claiming that it is not doable in afl. I am only 'claiming' that performance metrics that can be used easily, by everyone without a degree in programming, might put more money in a trader's pockets than 75% of the traditional indicators, or cosmetic functions, ever will.

There is a common phrase going around on this list that reads "it is easily done", "it is doable",  just in the last two weeks we have seen several examples of this. Each 'easy solution' would require one to become expert in some specialty (OLE,CBT,..) that would take at least a few months (part-time work). After that we may find out that things are not static, ahhh, we need to keep on learning. After that we find out that, surprise, we are no as smart as we thought we were - and we ask ourselves whether we are stupid or what? Then, after sweating it out and burning a lot of hours, we come to a point where we can actually test our HG idea, ahh another surprise! The idea doesn't work!!! We have all traveled this road. Time wasted, and wasted and wasted, because the tools we need to 'efficiently' develop/test ideas, are not available. Perhaps this is why TA evolves so slowly, innovation is throttled. Note that I am not critical of the AmiBroker product, it is undoubtedly the best product around.

Tomasz mention that a portfolio backtester must be called in all cases. I think portfolio trading is something like the Equity function: using as it you will NOT know how your system/stocks are interacting. You CANNOT make intelligent trading decisions based solely on the Portfolio Report. For a well-designed trading system, i.e., where one knows what is going on "inside" the system, running a portfolio backtest is the last step in system design. We need individual backtest metrics. Just because we have tools like Portfolio backtester, CBT, OLE, doesn't mean that these should be used to provide all solutions - that would exclude 95% of all users. Regarding processing time, I cannot understand why these functions cannot be based on simple (old) backtests. Why should it take a built-in function longer to calculate a metric than a user-written solution based on the equity(), CBT, OLE, and what have you. That doesn't make sense. If these metrics can be obtained suing the BT/OLE, why can't all that be placed into a formal AFL function?

Some users use composites to assess market movements. Similarly metric-composites can be used to assess 'system performance'. I think it is important to separate the various components used in system design. We have market-wide, stock-specific, individual, system, portfolio, foreign, and many other factors that should be considered individually. Who said system design was easy? :-)

That my two-nickel's worth Fred ;-) once in awhile it is fun to beat around the bush.

Herman

Ps. the length of this email proves that I finally got my hardware up and running smoothly :-) I am taking a break from the headaches, but its back to work now.


-----Original Message-----
From: amibroker@xxxxxxxxxps.com [mailto:amibroker@yahoogroups.com]On
Behalf Of Paul Ho
Sent: July 28, 2008 10:24 PM
To: amibroker@xxxxxxxxxps.com
Subject: [amibroker] Re: How to save Metrics in Composites for
Individual BTs


You dont need to call a separate backtest for every bar, you only
need to call backtest only with the custom backtester code. For the
matrix concerned, all you need is to understand the relationship
between its current value and its value "lookback" bars ago, you can
then reconstruct the "lookback" matrix the way you want.
take UI for example,
 UI[Br] = SQRT[Sum(DR)from bars 1 to Br)/Br
and UI[Br - Lb} = SQRT(sum(Dr) from bars 1 to [Br - lb])/Br;

So function UIwithLookBack(Lb)
{
    Pr = barindex() * Foreign("~UI.....", "C");
    result = Pr ^ 2 - ref(Pr, -lb)^2;
    result = sqrt(result);
    result = result /lb;
    return result;
}
All you need to do is to understand the relationship between
different bars of the matrix that you're interested. It is not
particularly hard.
/Paul.

--- In amibroker@xxxxxxxxxps.com, "Al Venosa`" <avcinci@xxx> wrote:
>
> Dear TJ and Fred:
>
> Thank you for these suggestions. However, what I am asking for is a
simple
> AFL function in which we can specify the lookback period for the
metric in
> question, nothing more. To observe the difference, you can simply
substitute
> an MA() for the required function, as shown below. When you view
the graph,
> you will see, I think, what I am talking about.
>
> Plot(C,"",1,128);
> Plot(MA(C,50),"FixedLookBack",colorRed,1); // the requested solution
> Plot(MA(C,BarIndex()),"ExistingNow",colorBlue,1); // TJ's and Fred's
> solution.
>
> I believe what TJ has suggested, if I am interpreting it correctly,
is that
> I would be running a backtest for each bar in a loop, which would
be complex
> and very slow. Maybe I'm asking the same thing. If so, tell me, and
I'll
> desist. An alternative solution is to use the Walk Forward
Individual
> Backtester to implement a system that uses performance metrics as
position
> score.
>
> BTW, Fred, are you willing to share the complete working code for
your
> 2-line export?
>
> Thank you.
>
> Al V.
>
>
> On 7/28/08, Tomasz Janeczko <groups@xxx> wrote:
> >
> >    Hello,
> >
> > It is doable with custom backtester and not so complicated.
> >
> > As described in detail here:
> > http://www.amibroker.com/guide/a_custommetrics.html
> >
> > You have direct access to ANY backtest performance metric using
> > GetPerformanceStats() function of backtester object.
> >
> > There is no obstacle in calling it every bar and storing the
result in the
> > array if you wish.
> >
> > Let say you want UPI as array.
> >
> >
> > // your trading system here
> > Buy = ...
> > Sell = ...
> >
> > SetCustomBacktestProc("");
> >
> > /* Now custom-backtest procedure follows */
> >
> > *if*( Status("action") == *actionPortfolio* )
> > {
> >     UPI = 0;
> >     bo = GetBacktesterObject();
> >
> >     bo.PreProcess();
> >
> >     *for*( bar = 0; bar < *BarCount*; bar++ )
> >     {
> >       bo.ProcessTradeSignals( bar );
> >
> >       st = bo.GetPerformanceStats(0); // get stats for all trades
> >
> >       UPI[ bar ] = st.GetValue("UlcerPerformanceIndex");
> >    }
> >
> >     bo.PostProcess();
> >
> >     AddToComposite( UPI, "~~~UPI", "X", *atcFlagDefaults* | *
> > atcFlagEnableInPortfolio* );
> > }
> >
> >
> > Now ~~~UPI ticker will contain bar-by-bar values of Ulcer
Performance
> > Index.
> >
> > As for "specifying lookback period" it is doable by creating Xth
composites
> > (and X backtests) each containing values for specified
> > lookback period.
> >
> > As for Equity() - this is SINGLE security (OLD) backtest. It has
no
> > comparision to portfolio level backtest that
> > must go through entire portfolio. The complexity of portfolio
backtest is
> > Nth times the single security backtest
> > where N is number of symbols in portfolio. Therefore it is not
feasible to
> > be calculated on-the-fly in real time like
> > single-security backtest (i.e. Equity()).
> >
> >
> > Best regards,
> > Tomasz Janeczko
> > amibroker.com
> >
> > ----- Original Message -----
> > *From:* Al Venosa` <avcinci@xxx>
> > *To:* amibroker@xxxxxxxxxps.com
> > *Sent:* Monday, July 28, 2008 1:02 AM
> > *Subject:* Re: [amibroker] Re: How to save Metrics in Composites
for
> > Individual BTs
> >
> > Thanks, Fred, but I haven't a clue how to do OLE/Automation, and
I wonder
> > how many AB users out there really do. That's why I was calling
for a
> > simple, non-painful, easy-to-use AFL function that would do this
for the
> > non-techie/programmer, and if it existed, AB would be the only
trading
> > software out there that would be able to do this. I bet It would
be a profit
> > bonanza for TJ.
> >
> > Al V.
> >
> > On 7/27/08, Fred Tonetti <ftonetti@xxx> wrote:
> >>
> >>    I agree that this would be nice to have as directly as you
have laid
> >> out .
> >>
> >>
> >>
> >> However, while somewhat painful, one can with Equity() and a
list of
> >> trades calculate all the performance metrics as of any given bar
or if you
> >> prefer as arrays of values .
> >>
> >>
> >>
> >> This could be fully automated with OLE/Automation
> >>
> >>
> >>  ------------------------------
> >>
> >> *From:* amibroker@xxxxxxxxxps.com
[mailto:amibroker@yahoogroups.com] *On
> >> Behalf Of *Al Venosa
> >> *Sent:* Sunday, July 27, 2008 11:29 AM
> >> *To:* amibroker@xxxxxxxxxps.com
> >> *Subject:* [amibroker] Re: How to save Metrics in Composites for
> >> Individual BTs
> >>
> >>
> >>
> >> Having read this interesting thread begun last week, I'd like to
> >> continue it with a follow-on question/comment that I think, if
TJ were
> >> to implement it, would make Amibroker infinitely more useful to
the
> >> actual trader. It would be awesome if we could have simple-to-
use AFL
> >> functions that read AFL backtest metrics directly. Adding a
lookback
> >> period would make them immensely more useful as indicators. What
I am
> >> suggesting is to have a function like:
> >>
> >> getEquityMetric ( MetricName,LookBackPeriod);
> >>
> >> The example code provided by TJ gives us only the cumulative
value of
> >> each metric. What I'm suggesting is to go beyond this one
cumulative
> >> output number and create metric arrays with a specified lookback
> >> period. Then, when we plot these metrics in an indicator, we can
> >> visually look for correlations with price charts. For example,
one
> >> could plot winning trades/month and see if they change with
trend. Or
> >> one could look at AverageWin or UPI and see how that changes with
> >> trend. These are all correlations that are best analyzed
visually (in
> >> an Indicator) but can ONLY be analyzed if we have access to these
> >> metrics for variable lookback periods.
> >>
> >> Another use for these functions would be as a positionscore in a
> >> trading system. What better way is there to select
tickers/systems to
> >> trade than the actual performance of those tickers or systems?
The
> >> procedure may require a preliminary scan/exploration to create
metric-
> >> composites that can be read by the trading system and used as a
> >> positionscore. Critical here is that the metric can be read for
any
> >> specified lookback period, i.e. 10 bars, 100 bars, etc. So the
> >> function must have a period argument, which is the most important
> >> factor. We already have equity(). Why not expand this with the
other
> >> backtest metrics?
> >>
> >> Undoubtedly, all this can be implemented using the custom
backtester,
> >> but this solution probably excludes >95% of all AmiBroker users.
> >>
> >> TJ, would this be possible to implement?
> >>
> >> Al Venosa
> >>
> >> --- In amibroker@xxxxxxxxxps.com <amibroker%
40yahoogroups.com>, "Herman"
> >> <psytek@> wrote:
> >> >
> >> > Thank you TJ :-) you saved the day once more !
> >> >
> >> > Great stuff.
> >> >
> >> > If someone is wondering why I wanted this program... You can
design
> >> trading
> >> > systems and use performance metric arrays as powerful
Indicators. It
> >> is
> >> > somewhat similar to trading the equity curve. Price arrays can
have
> >> > qualities that can make your trading systems fail but that are
> >> undetectable
> >> > with traditional indicators.
> >> >
> >> > However, you can design small trading systems that target
specific
> >> price
> >> > characteristics, like patterns, trends, volatility, cycles,
etc.
> >> Using the
> >> > code below gives you statistical information about these
> >> characteristics in
> >> > a form that can be plotted, and be used in other trading
systems.
> >> >
> >> > Thanks everyone for your help!
> >> > have a great trading day!
> >> > herman
> >> >
> >> > // Demo trading system
> >> > Short = Cover = 0;
> >> > Buy = Cross( MACD(), Signal() );
> >> > Sell = Cross( Signal(), MACD() );
> >> > // Using the CBT to retrieve/save metrics
> >> > if( Status("action") == actionBacktest ) StaticVarSetText
( "Symbol",
> >> > Name() );
> >> > SetOption( "UseCustomBacktestProc", True );
> >> > if ( Status( "action" ) == actionPortfolio )
> >> > {
> >> > bo = GetBacktesterObject();
> >> > bo.PreProcess();
> >> > MyHistStat1 = Null;
> >> > for ( bar = 0; bar < BarCount; bar++ )
> >> > {
> >> > bo.ProcessTradeSignals( bar );
> >> > stats = bo.GetPerformanceStats( 0 );
> >> > MyHistStat1[ bar ] = stats.GetValue( "UlcerIndex" ); // any
metric
> >> can be
> >> > retrieved
> >> > }
> >> > bo.PostProcess();
> >> > AddToComposite( MyHistStat1, "~~~UI_" + StaticVarGetText
> >> ( "Symbol" ), "X",
> >> > atcFlagEnableInPortfolio | atcFlagDefaults );
> >> > }
> >> > PlotForeign( "~~~UI_"+Name(), "UlcerIndex Historical",
colorRed,
> >> > styleLine );
> >> >
> >> > -----Original Message-----
> >> > From: amibroker@xxxxxxxxxps.com <amibroker%40yahoogroups.com>
[mailto:
> >> amibroker@xxxxxxxxxps.com <amibroker%40yahoogroups.com>]On
> >> Behalf
> >> > Of Tomasz Janeczko
> >> > Sent: July 25, 2008 5:49 AM
> >> > To: amibroker@xxxxxxxxxps.com <amibroker%40yahoogroups.com>
> >> > Subject: [SPAM]Re: [SPAM]Re: [amibroker] How to save Metrics in
> >> Composites
> >> > for Individual BTs
> >> >
> >> >
> >> > Herman,
> >> >
> >> > You forgot the CORRECTION I mentioned:
> >> >
> >> > StaticVarSetText( "Symbol", Name() ); must NOT be called
> >> unconditionally,
> >> > but THIS way:
> >> >
> >> >
=====================================================================
> >> > if( Status("action") == actionBacktest ) StaticVarSetText
( "Symbol",
> >> > Name() );
> >> > ==============================================================
> >> >
> >> > Best regards,
> >> > Tomasz Janeczko
> >> > amibroker.com
> >> > ----- Original Message -----
> >> > From: Herman
> >> > To: amibroker@xxxxxxxxxps.com <amibroker%40yahoogroups.com>
> >> > Sent: Friday, July 25, 2008 11:36 AM
> >> > Subject: RE: [SPAM]Re: [amibroker] How to save Metrics in
Composites
> >> for
> >> > Individual BTs
> >> >
> >> >
> >> > Still NO GO.
> >> > I am loading the code in the AA, select a watchlist, run an
> >> Individual
> >> > backtest, and Refresh the WorkSpace. I get the BT report with
> >> individual
> >> > results. I get two Composites in my Composites Group. One is
named
> >> > ~~~EQUITY, the other ~~~UI_~~~EQUITY. The first makes sense
but the
> >> second
> >> > indicates that the StaticVar does not return the ticker name.
> >> >
> >> > >> It appears that in this code the function Name() returns
> >> "~~~EQUITY" and
> >> > does not return the name for the ticker being tested, it
behaves as
> >> if the
> >> > ~~~EQUITY composite is the ticker being tested.
> >> > Can anyone confirm this?
> >> >
> >> > Thanks again!
> >> > Herman
> >> >
> >> > // Demo trading system
> >> > Short = Cover = 0;
> >> > Buy = Cross( MACD(), Signal() );
> >> > Sell = Cross( Signal(), MACD() );
> >> > // Using the CBT to retrieve/save metrics
> >> > StaticVarSetText( "Symbol", Name() );
> >> > SetOption( "UseCustomBacktestProc", True );
> >> > if ( Status( "action" ) == actionPortfolio )
> >> > {
> >> > bo = GetBacktesterObject();
> >> > bo.PreProcess();
> >> > MyHistStat1 = Null;
> >> > for ( bar = 0; bar < BarCount; bar++ )
> >> > {
> >> > bo.ProcessTradeSignals( bar );
> >> > stats = bo.GetPerformanceStats( 0 );
> >> > MyHistStat1[ bar ] = stats.GetValue( "UlcerIndex" ); // any
metric
> >> can be
> >> > retrieved
> >> > }
> >> > bo.PostProcess();
> >> > AddToComposite( MyHistStat1, "~~~UI_" + StaticVarGetText
> >> ( "Symbol" ), "X",
> >> > atcFlagEnableInPortfolio | atcFlagDefaults );
> >> > }
> >> > PlotForeign( "~~~UI_"+Name(), "UlcerIndex Historical",
colorRed,
> >> > styleLine );
> >> >
> >> >
> >> >
> >> >
> >> > -----Original Message-----
> >> > From: amibroker@xxxxxxxxxps.com <amibroker%40yahoogroups.com>
[mailto:
> >> amibroker@xxxxxxxxxps.com <amibroker%40yahoogroups.com>]On
> >> Behalf
> >> > Of Tomasz Janeczko
> >> > Sent: July 25, 2008 4:08 AM
> >> > To: amibroker@xxxxxxxxxps.com <amibroker%40yahoogroups.com>
> >> > Subject: [SPAM]Re: [amibroker] How to save Metrics in
Composites for
> >> > Individual BTs
> >> >
> >> >
> >> > It will work OK.
> >> > Individual backtest *is* portfolio backtest but just portfolio
> >> consisting of
> >> > one symbol at a time.
> >> >
> >> > Note that one should select "Individual Backtest" (not "OLD"
> >> backtest) from
> >> > AA->Backtest drop down.
> >> >
> >> > One correction though
> >> > StaticVarSetText( "Symbol", Name() );
> >> >
> >> > should be called only when NOT in portfolio mode
> >> >
> >> > so
> >> >
> >> > if( Status("action") == actionBacktest ) StaticVarSetText
( "Symbol",
> >> > Name() );
> >> >
> >> > // Demo trading system
> >> > Short = Cover = 0;
> >> > Buy = Cross( MACD(), Signal() );
> >> > Sell = Cross( Signal(), MACD() );
> >> >
> >> > // Using the CBT to retrieve/save metrics
> >> > SetOption( "UseCustomBacktestProc", True );
> >> > if ( Status( "action" ) == actionPortfolio )
> >> > {
> >> > bo = GetBacktesterObject();
> >> > bo.PreProcess();
> >> > MyHistStat1 = Null;
> >> > for ( bar = 0; bar < BarCount; bar++ )
> >> > {
> >> > bo.ProcessTradeSignals( bar );
> >> > stats = bo.GetPerformanceStats( 0 );
> >> > MyHistStat1[ bar ] = stats.GetValue( "UlcerIndex" ); // any
metric
> >> can be
> >> > retrieved
> >> > }
> >> > bo.PostProcess();
> >> > AddToComposite( MyHistStat1, "~~~UI_" + StaticVarGetText
( "Symbol" )
> >> +
> >> > "_HISTORICAL", "X", atcFlagEnableInPortfolio |
atcFlagDefaults );
> >> > }
> >> >
> >> > ----- Original Message -----
> >> > From: Paul Ho
> >> > To: amibroker@xxxxxxxxxps.com <amibroker%40yahoogroups.com>
> >> > Sent: Friday, July 25, 2008 4:45 AM
> >> > Subject: RE: [amibroker] How to save Metrics in Composites for
> >> Individual
> >> > BTs
> >> >
> >> >
> >> > First of all. You use Status{"action") == actionPortfolio,
> >> individual
> >> > backtest wont go through there.
> >> >
> >> >
> >> >
> >> > From: amibroker@xxxxxxxxxps.com <amibroker%40yahoogroups.com>
[mailto:
> >> amibroker@xxxxxxxxxps.com <amibroker%40yahoogroups.com>]
> >> On Behalf
> >> > Of Herman
> >> > Sent: Friday, 25 July 2008 9:31 AM
> >> > To: amibroker@xxxxxxxxxps.com <amibroker%40yahoogroups.com>
> >> > Subject: Re: [amibroker] How to save Metrics in Composites for
> >> Individual
> >> > BTs
> >> >
> >> >
> >> > Thank you Tomasz, but this code still does not work. I changed
the
> >> StaticVar
> >> > to the Text type.
> >> >
> >> > Can you help some more ... ? or does anyone else see the
problem?
> >> >
> >> > TIA,
> >> > Herman
> >> >
> >> > StaticVarSetText( "Symbol", Name() );
> >> > // Demo trading system
> >> > Short = Cover = 0;
> >> > Buy = Cross( MACD(), Signal() );
> >> > Sell = Cross( Signal(), MACD() );
> >> >
> >> > // Using the CBT to retrieve/save metrics
> >> > SetOption( "UseCustomBacktestProc", True );
> >> > if ( Status( "action" ) == actionPortfolio )
> >> > {
> >> > bo = GetBacktesterObject();
> >> > bo.PreProcess();
> >> > MyHistStat1 = Null;
> >> > for ( bar = 0; bar < BarCount; bar++ )
> >> > {
> >> > bo.ProcessTradeSignals( bar );
> >> > stats = bo.GetPerformanceStats( 0 );
> >> > MyHistStat1[ bar ] = stats.GetValue( "UlcerIndex" ); // any
metric
> >> can be
> >> > retrieved
> >> > }
> >> > bo.PostProcess();
> >> > AddToComposite( MyHistStat1, "~~~UI_" + StaticVarGetText
( "Symbol" )
> >> +
> >> > "_HISTORICAL", "X", atcFlagEnableInPortfolio |
atcFlagDefaults );
> >> > }
> >> > PlotForeign( "~~~UI_HISTORICAL", "UlcerIndex Historical",
colorRed,
> >> > styleLine );
> >> >
> >> > -----Original Message-----
> >> > From: amibroker@xxxxxxxxxps.com <amibroker%40yahoogroups.com>
[mailto:
> >> amibroker@xxxxxxxxxps.com <amibroker%40yahoogroups.com>]On
> >> Behalf
> >> > Of Tomasz Janeczko
> >> > Sent: July 24, 2008 3:00 PM
> >> > To: amibroker@xxxxxxxxxps.com <amibroker%40yahoogroups.com>
> >> > Subject: [SPAM]Re: [amibroker] How to save Metrics in
Composites for
> >> > Individual BTs
> >> >
> >> >
> >> > The same code. The only distinction is that you need to run
> >> INDIVIDUAL
> >> > backtest
> >> > and use Static variable to save name
> >> >
> >> > StaticVarSet Text ("Symbol", Name() );
> >> > // Demo trading system
> >> > Short = Cover = 0;
> >> > Buy=Cross( MACD(), Signal() );
> >> > Sell=Cross( Signal(), MACD() );
> >> >
> >> > // Using the CBT to retrieve/save metrics
> >> > SetOption("UseCustomBacktestProc", True );
> >> > if( Status("action") == actionPortfolio )
> >> > {
> >> > bo = GetBacktesterObject();
> >> > bo.PreProcess();
> >> > MyHistStat1 = Null;
> >> >
> >> > for(bar=0; bar < BarCount; bar++)
> >> > {
> >> > bo.ProcessTradeSignals( bar );
> >> > stats = bo.GetPerformanceStats( 0 );
> >> > MyHistStat1[ bar ] = stats.GetValue("UlcerIndex"); // any
metric
> >> can be
> >> > retrieved
> >> > }
> >> >
> >> > bo.PostProcess();
> >> > AddToComposite( MyHistStat1, "~~~UI_" + StaticVarGet Text
> >> ("Symbol") +
> >> > "_HISTORICAL", "X", atcFlagEnableInPortfolio |
atcFlagDefaults );
> >> > }
> >> >
> >> > PlotForeign("~~~UI_HISTORICAL", "UlcerIndex Historical",
colorRed,
> >> > styleLine );
> >> >
> >>
> >> ------------------------------
> >> I am using the free version of SPAMfighter for private users.
> >> It has removed 512 spam emails to date.
> >> Paying users do not have this message in their emails.
> >> Try SPAMfighter <http://www.spamfighter.com/len> for free now!
> >>
> >
> > 
> >
>



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

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html
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:
    mailto:amibroker-digest@xxxxxxxxxps.com
    mailto:amibroker-fullfeatured@yahoogroups.com

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

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



I am using the free version of SPAMfighter for private users.
It has removed 513 spam emails to date.
Paying users do not have this message in their emails.
Try SPAMfighter for free now!
__._,_.___

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html




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

__,_._,___