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

RE: [amibroker] Re: Inline Backtester Metrics



PureBytes Links

Trading Reference Links

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@xxxxxxxxxps.com, Fred Tonetti <ftonetti@xx.> 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@xxxxxxxxxps.com [mailto:amibroker@xxxxxxxxxps.com]
On Behalf
> Of brian_z111
> Sent: Tuesday, May 20, 2008 2:31 AM
> To: amibroker@xxxxxxxxxps.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.spamfighter.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 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

__,_._,___