PureBytes Links
Trading Reference Links
|
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);
------------------------------------
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/
|