PureBytes Links
Trading Reference Links
|
Yes, that is a mistake not allowing for no movement. Good point.
GetOption is also nicer.
brian_z
--- In amibroker@xxxxxxxxxxxxxxx, Fred Tonetti <ftonetti@xxx> wrote:
>
> PS .
>
>
>
> You can get Initial Equity this way .
>
>
>
> InitEq = GetOption("InitialEquity");
>
>
>
> Beyond that your code to determine where buys and sells occurred
won't fly
> because it doesn't take into account where price is unchanged from
one bar
> to the next.
>
>
>
> _____
>
> From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx]
On Behalf
> Of brian_z111
> Sent: Tuesday, May 20, 2008 3:03 AM
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: [amibroker] Re: Inline Backtester Metrics
>
>
>
> Thanks Fred,
>
> Appreciate the help.
> I am a pretty rough coder.
>
> brian_z
>
> --- In amibroker@xxxxxxxxx <mailto:amibroker%40yahoogroups.com>
ps.com, Fred
> Tonetti <ftonetti@> wrote:
> >
> > For a variety of reasons I won't get into here, I wouldn't call
> Equity() a
> > zillion times.
> >
> >
> >
> > Call it once and then use the result i.e.
> >
> >
> >
> > CurEq = Equity();
> >
> >
> >
> > _____
> >
> > From: amibroker@xxxxxxxxx <mailto:amibroker%40yahoogroups.com>
ps.com
> [mailto:amibroker@xxxxxxxxx <mailto:amibroker%40yahoogroups.com>
ps.com]
> On Behalf
> > Of brian_z111
> > Sent: Tuesday, May 20, 2008 2:31 AM
> > To: amibroker@xxxxxxxxx <mailto:amibroker%40yahoogroups.com>
ps.com
> > Subject: [amibroker] Inline Backtester Metrics
> >
> >
> >
> > Herman,
> >
> > IBM PartI
> >
> > I am not sure if this is along the lines that you are
investigating.
> > It might be a starting point.
> > Sophisticated functions can be built from the concept.
> >
> > Example of using single symbol equity function to back calculate
> the
> > trade series.
> >
> > I used buy Tues(C) and sell Thurs(C) with one month of data to
test
> > the code as I went along (this gave me unambiguous signals with
> only
> > one signal at a time - I believe you can use an eq flag to dump
> dual
> > signals for real life use).
> >
> > Note: some weeks don't have Mons or Fris so I wanted to avoid no
> > signals, caused by short weeks, during testing
> >
> > I used barindex() > 4 to cut out the first week in the month so
> that
> > I started with no signals for a few bars before the first buy.
> >
> > I left the plot code in there but commented out (I plotted each
> line
> > to test the veracity of the code).
> >
> > Note that when the trade series is used to recreate the eq curve
> (as
> > a cross check) it only matches on the exit bars for each trade.
> > I tried it on 10 years of Yahoo data and the final eqs matched to
2
> > decimal places (rounded off).
> >
> > //P_InLineEquity
> > //code to reverse engineer the trade series from the equity curve
> > //it is reversed at the end to check the accuracy of the method
> >
> > InitialEq = 10000;//input required
> >
> > SetOption("InitialEquity", InitialEq );
> >
> > Buy = BarIndex() > 4 AND DayOfWeek() == 2;//use your own
> > Sell = BarIndex() > 4 AND DayOfWeek() == 4;//use your own
> >
> > BuyPrice = C;//use your own
> > SellPrice = C;//use your own
> >
> > Plot(Equity(),"Equity",5,1);
> >
> > Entry = IIf(Equity() == Ref(Equity(),-1) AND Equity() != Ref
(Equity
> > (),1),1,0);
> >
> > //Plot(Entry,"Entry",1,1);
> >
> > Exit = IIf(Equity() != Ref(Equity(),-1) AND Equity() == Ref(Equity
> > (),1),1,0);
> >
> > //Plot(Exit,"Exit",2,1);
> >
> > TradeSeries = IIf(Exit ==1,ValueWhen(Exit == 1,
> SellPrice,1)/ValueWhen
> > (Entry == 1, BuyPrice,1),1);
> >
> > //Plot(TradeSeries,"TradeSeries",1,1);
> >
> > GF = 1;//GrowthFactor
> >
> > for (i = 1; i < BarCount; i++)
> > {
> > GF[i] = GF[i-1] * TradeSeries[i];
> > }
> >
> > //codesters might be able to make the above loop better/prettier?
> > //Plot(GF,"GrowthFactor",5,1);
> >
> > Plot(InitialEq * GF,"CalculatedEquity",1,1);
> >
> >
> >
> >
> > _____
> >
> > I am using the free version of SPAMfighter for private users.
> > It has removed 456 spam emails to date.
> > Paying users do not have this message in their emails.
> > Try SPAMfighter <http://www.spamfigh
<http://www.spamfighter.com/len>
> ter.com/len> for free now!
> >
>
>
>
>
> _____
>
> I am using the free version of SPAMfighter for private users.
> It has removed 456 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@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/
|