PureBytes Links
Trading Reference Links
|
You can use the following function, originally based on a version by
TJ:
function FindStatAtEndTrade (Stat, dt, Value)
{
found = -1;
for( i = 0; i < BarCount AND found==-1; i++ )
{
if( dt[ i ] == Value ) found = i;
}
result = Null;
if( found > 1 ) result = Stat[ found ];
return result;
//return IIf( found != -1, Stat[ found], Null ); // Stat at
end /close of trade
}
Also, look at message #83288 for Paul's example, and Graham also has
posted examples on this (I think).
PS
--- In amibroker@xxxxxxxxxxxxxxx, "gp_sydney" <gp.investment@xxx>
wrote:
>
> You need to pass your indicator arrays, or at least the values on
the
> entry days, to the custom backtest procedure. For the whole arrays,
I
> think you need to use AddToComposite and Foreign, or for individual
> values you can use dynamic/static variables with appropriate names
> (eg. including stock code plus entry date/time).
>
> No idea about fundamental data though.
>
> Regards,
> GP
>
>
>
> --- In amibroker@xxxxxxxxxxxxxxx, "trustdnb" <trustdnb@> wrote:
> >
> > Thanks for the tip GP, but I am still coming up a little short for
> > what I am trying to accomplish. What I want to do is show the
value of
> > chosen indicators (e.g. RSI, ROC, etc.) for each trade that was
> > entered. I would also like to add a few columns that display
> > fundamental indicators (mkt cap, EPS, etc.). The problem is that
the
> > arrays that hold the "bar-by-bar" RSI values are not directly
> > available to the backtester on a "trade-by-trade" basis.
> >
> > The only workaround I have been able to come up with is to use
> > PositionScore. If I want to see the RSI values for each trade. I
> > simply set PositionScore = RSI (14) and then show the RSI value by
> > using trade.score(). There are two problems however: (1) I cant
show
> > more than one value this way and (2) Using PositionScore will
change
> > the trades that my system takes.
> >
> > Is there a better way to do this? Here is my current code:
> >
> > PositionScore = RSI (14);
> > SetCustomBacktestProc("");
> >
> > if( Status("action") == actionPortfolio )
> > {
> > bo = GetBacktesterObject();
> > bo.Backtest(1);
> >
> > NumTrades = 0;
> >
> > for( trade = bo.GetFirstTrade(); trade; trade = bo.GetNextTrade
() )
> > {
> >
> > trade.AddCustomMetric("RSI", trade.score() );
> > NumTrades++;
> > }
> >
> > bo.ListTrades();
> >
> > }
> >
> > --- In amibroker@xxxxxxxxxxxxxxx, "gp_sydney" <gp.investment@>
wrote:
> > >
> > > You can do this with the high-level custom backtester interface.
> > >
> > > See example 3 in the help section "Adding custom backtest
metrics".
> > >
> > > Regards,
> > > GP
> > >
> > >
> > > --- In amibroker@xxxxxxxxxxxxxxx, "trustdnb" <trustdnb@> wrote:
> > > >
> > > > Is is possible to add custom columns to the backtest results
> screen?
> > > > What I would like to be able to do is sort my trade results
by net
> > > > profit or by winners/losers and see if the winners all have
low RSI,
> > > > high relative strength, etc. Alternatively, is there a way to
> add per
> > > > trade profit or win/loss to the exploration screen? The
exploration
> > > > doesn't seem to have access to the trade variables (e.g.
> > > > Buyprice/Sellprice).
> > > >
> > > > Thanks,
> > > > Muhammad
> > > >
> > >
> >
>
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@xxxxxxxxxxxxxxx
mailto: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/
|