PureBytes Links
Trading Reference Links
|
Hi DT,
thanks for all the labor!
My report results, using the old backtester, are identical to
yours! (with Yahoo EOD data(unpurified) and Amibroker 4.50.4.)
Slightly different(see attached), however, are
my:
a) equity plot Whereas your Title values are
identical to the right-side labels, mine are not. ( I use what I believe to be
the standard Equity Line code* that comes with Amibroker)
b) indicator plot (the numerical values in
the Title are slightly lower than yours)
Can anyone think of anything that explains the
differences?
thanks
-john
*Equity Line code:
//--equity-plot-- do not remove this line
MaxGraph=0<FONT
size=1>;GraphXSpace=5<FONT
size=1>;
GraphZOrder=1<FONT
size=1>;
Plot( <FONT color=#0000ff
size=1>Equity( <FONT color=#ff00ff
size=1>0, -2<FONT
size=1> ), "Equity",
-8, styleArea
);
/* now buy and hold simulation */
Short=Cover=0<FONT
size=1>;
Buy=Status<FONT
size=1>("firstbarintest"<FONT
size=1>);
Sell=Status<FONT
size=1>("lastbarintest"<FONT
size=1>);
SetTradeDelays(<FONT color=#ff00ff
size=1>0,0<FONT
size=1>,0,<FONT
color=#ff00ff size=1>0); PositionSize = -<FONT
color=#ff00ff size=1>100;<FONT color=#0000ff
size=1>
ApplyStop(0<FONT
size=1>,0,<FONT
color=#ff00ff size=1>0,<FONT color=#ff00ff
size=1>0);
ApplyStop(1<FONT
size=1>,0,<FONT
color=#ff00ff size=1>0,<FONT color=#ff00ff
size=1>0);
ApplyStop(2<FONT
size=1>,0,<FONT
color=#ff00ff size=1>0,<FONT color=#ff00ff
size=1>0);
Plot( <FONT color=#0000ff
size=1>Equity( <FONT color=#ff00ff
size=1>0, -2<FONT
size=1> ), "Buy&Hold",
-9 );
<BLOCKQUOTE
>
----- Original Message -----
<DIV
>From:
Dimitris
Tsokakis
To: <A title=amibroker@xxxxxxxxxxxxxxx
href="">amibroker@xxxxxxxxxxxxxxx
Sent: Wednesday, December 17, 2003 5:17
AM
Subject: [amibroker] Artificial
Intelligence, an introduction, ^N225 2003
Yuki wrote at <A
href="">http://groups.yahoo.com/group/amibroker/message/54931
<FONT face="Times New Roman"
size=2>"...There are a lot of people who missed the move this year,
and..."
What could we do not to miss the move ? Here is the
elementary AI proposal:
The first significant ^N225 trough was on Jan31, 2003 and
the very next significant peak was on Feb17.Suppose we follow this pattern
and then buy every x1 days after the first buy and sell every x2 days after
the first sell.By the end of the first 6 months we try to learn the rhythm
of the market and trade it for the next 6 months.The initial rhythm may
need corrections as the market changes, inspections every 15-20 days are
necessary.The results are interesting:There were 3 main rhythm
combinations [x1,x2], the [29,24] for 34 days, the [26,33] for the next 34
days and, finally, a potential combination [25,28] was detected around mid
September and it is valid untill now.Another important issue : The system
"understood" around mid July that x1 should be < x2. It means buys
should be more frequent than sells, a characteristic of bullish markets
[the more you delay a Sell, the more part of the bullish trend you
enjoy...]The black [29,24] equity line was a nice solution up to the end
of July, the white [26,33] up to the middle of August.The red [25,28] was
the most tenacious all year long.The trading parameters are
Settings
Initial Equity:
10000
Periodicity/Positions:
Daily/Long Short
Commissions:
0.50 %
Annual interest rate:
0.00%
Range:
30/5/2003 00:00:00 - 17/12/2003
Apply to:
Current Symbol
Margin requirement:
100
Futures mode:
No
Def. round lot size:
0
Def. Tick Size
0
Drawdowns based on:
Open prices
Long trades
Buy price:
Open
Sell price:
Open
Buy delay:
1
Sell delay:
1
Short trades
Short price:
Open
Cover price:
Open
Short delay:
1
Cover delay:
1
Stops
Maximum loss:
disabled
Profit target:
disabled
Value:
30.00
Value:
20.00
Exit at stop?
yes
Exit at stop?
no
Trailing stop:
disabled
Value:
5.00
Exit at stop?
no
FormulaSYM="^N225";in=DateNum()>=1030530;
STARTBUY=DateNum()==1030131;
STARTSELL=DateNum()==1030217;
startIP=DateNum()==1030530;
x=17;
// A Hi-pass filter
EVENT=BarsSince(startIP)%x==0;
k0=20;Plot(k0,"k0",Cum(1)%2,1);s0=60;
shape=33+2*(Cum(event)%10);
PlotShapes(shape*EVENT,colorRed);
Plot(0,"",1,1);Plot(100,"",1,1);Slevel=80;
G=0;
for(BuyFREQ=10;BuyFREQ<40;BuyFREQ++)
{
for(SellFREQ=10;SellFREQ<40;SellFREQ++)
{
Buy=BarsSince(STARTBuy)%Buyfreq ==0;Sell=BarsSince(STARTSell)%Sellfreq==0;Short=Sell;Cover=Buy;
Buy=ExRem(Buy,Sell);Sell=ExRem(Sell,Buy);Short=ExRem(Short,Cover);Cover=ExRem(Cover,Short);
e1=Equity(1,0);E11=ValueWhen(EVENT,E1);G=IIf(G>E11,G,E11);
}}
BFpass=0;SFpass=0;
for(BuyFREQ=10;BuyFREQ<40;BuyFREQ++)
{
for(SellFREQ=10;SellFREQ<40;SellFREQ++)
{
Buy=BarsSince(STARTBuy)%Buyfreq ==0;Sell=BarsSince(STARTSell)%Sellfreq==0;Short=Sell;Cover=Buy;
Buy=ExRem(Buy,Sell);Sell=ExRem(Sell,Buy);Short=ExRem(Short,Cover);Cover=ExRem(Cover,Short);
e1=Equity(1,0);
E11=ValueWhen(EVENT,E1);
BF1=IIf(E11==G,BuyFREQ,0);BFpass=BFpass+BF1;
SF1=IIf(E11==G,SellFREQ,0);SFpass=SFpass+SF1;
G=IIf(E11==G,0,G);
}}
Buy=BarsSince(STARTBuy)%bfpass ==0;Sell=BarsSince(STARTSell)%sfpass==0;Short=Sell;Cover=Buy;
Buy=ExRem(Buy,Sell);Sell=ExRem(Sell,Buy);Short=ExRem(Short,Cover);Cover=ExRem(Cover,Short);
Overall performance summary
Total net profit:
4079.56
Total commissions paid:
895.39
Return on account:
40.80 %
Open position gain/loss
-34.86
Buy&Hold profit:
2121.88
Bars (avg. days) in test:
137 (201)
Buy&Hold % return:
21.22%
System to Buy&Hold index:
92.26%
Annual system % return:
86.13%
Annual B&H % return:
41.83%
System drawdown:
-339.32
B&H drawdown:
0.00
Max. system drawdown:
-961.08
B&H max. drawdown:
-1793.58
Max. system % drawdown:
-8.11%
B&H max. % drawdown:
-13.39%
Max. trade drawdown:
-961.08
Max. trade % drawdown:
-8.11%
Trade drawdown:
-484.71
Total number of trades:
8
Percent profitable:
75.0%
Number winning trades:
6
Number losing trades:
2
Profit of winners:
4696.27
Loss of losers:
-719.72
Total # of bars in winners:
117
Total # of bars in losers:
15
Commissions paid in winners:
677.37
Commissions paid in losers:
218.01
Largest winning trade:
1390.45
Largest losing trade:
-380.40
# of bars in largest winner:
23
# bars in largest loser:
9
Commission paid in largest winner:
110.42
Commission paid in largest loser:
117.32
Average winning trade:
782.71
Average losing trade:
-359.86
Avg. # of bars in winners:
19.5
Avg. # bars in losers:
7.5
Avg. commission paid in winner:
112.90
Avg. commission paid in loser:
109.01
Max consec. winners:
3
Max consec. losers:
1
Bars out of the market:
2
Interest earned:
0.00
Exposure:
98.5%
Risk adjusted ann. return:
87.41%
Ratio avg win/avg loss:
2.18
Avg. trade (win & loss):
497.07
Profit factor:
6.53
Performance for ^N225
Total net profit:
4079.56
Total commissions paid:
895.39
Return on account:
40.80 %
Open position gain/loss
-34.86
Buy&Hold profit:
2121.88
Bars (days) in test:
137 (201)
Buy&Hold % return:
21.22%
System to Buy&Hold index:
92.26%
Annual system % return:
86.13%
Annual B&H % return:
41.83%
System drawdown:
-339.32
B&H drawdown:
0.00
Max. system drawdown:
-961.08
B&H max. drawdown:
-1793.58
Max. system % drawdown:
-8.11%
B&H max. % drawdown:
-13.39%
Max. trade drawdown:
-961.08
Max. trade % drawdown:
-8.11%
Trade drawdown:
-484.71
Total number of trades:
8
Percent profitable:
75.0%
Number winning trades:
6
Number losing trades:
2
Profit of winners:
4696.27
Loss of losers:
-719.72
Total # of bars in winners:
117
Total # of bars in losers:
15
Commissions paid in winners:
677.37
Commissions paid in losers:
218.01
Largest winning trade:
1390.45
Largest losing trade:
-380.40
# of bars in largest winner:
23
# bars in largest loser:
9
Commission paid in largest winner:
110.42
Commission paid in largest loser:
117.32
Average winning trade:
782.71
Average losing trade:
-359.86
Avg. # of bars in winners:
19.5
Avg. # bars in losers:
7.5
Avg. commission paid in winner:
112.90
Avg. commission paid in loser:
109.01
Max consec. winners:
3
Max consec. losers:
1
Bars out of the market:
2
Interest earned:
0.00
Exposure:
98.5%
Risk adjusted ann. return:
87.41%
Ratio avg win/avg loss:
2.18
Avg. trade (win & loss):
497.07
Profit factor:
6.53
For Indicator builder see the timing coefficients variations
and the more important equity lines with the code
// ^N225 timing for
2003STARTBUY=DateNum()==1030131;// first
troughSTARTSELL=DateNum()==1030217;// first
peakstartIP=DateNum()==1030530;// inspections and trading
startx=17;// The Hi-pass
filterEVENT=BarsSince(startIP)%x==0;k0=10;Plot(k0,"k0",Cum(1)%2,1);s0=60;shape=33+2*(Cum(event)%10);PlotShapes(shape*EVENT,colorIndigo);Plot(0,"",1,1);Plot(50,"",1,1);G=0;for(BuyFREQ=10;BuyFREQ<40;BuyFREQ++){for(SellFREQ=10;SellFREQ<40;SellFREQ++){Buy=BarsSince(STARTBuy)%Buyfreq
==0;Sell=BarsSince(STARTSell)%Sellfreq==0;Short=Sell;Cover=Buy;Buy=ExRem(Buy,Sell);Sell=ExRem(Sell,Buy);Short=ExRem(Short,Cover);Cover=ExRem(Cover,Short);e1=Equity(1,0);E11=ValueWhen(EVENT,E1);G=IIf(G>E11,G,E11);}}BFpass=0;SFpass=0;for(BuyFREQ=10;BuyFREQ<40;BuyFREQ++){for(SellFREQ=10;SellFREQ<40;SellFREQ++){Buy=BarsSince(STARTBuy)%Buyfreq
==0;Sell=BarsSince(STARTSell)%Sellfreq==0;Short=Sell;Cover=Buy;Buy=ExRem(Buy,Sell);Sell=ExRem(Sell,Buy);Short=ExRem(Short,Cover);Cover=ExRem(Cover,Short);e1=Equity(1,0);E11=ValueWhen(EVENT,E1);BF1=IIf(E11==G,BuyFREQ,0);BFpass=BFpass+BF1;SF1=IIf(E11==G,SellFREQ,0);SFpass=SFpass+SF1;G=IIf(E11==G,0,G);}}Plot(BFPASS,"\nBFpass",colorBlack,8);Plot(SFPASS,"SFpass",colorBlue,8);
// the 3 main equity lines
BuyFREQ=29;SellFREQ=24;Buy=BarsSince(STARTBuy)%Buyfreq
==0;Sell=BarsSince(STARTSell)%Sellfreq==0;Short=Sell;Cover=Buy;Buy=ExRem(Buy,Sell);Sell=ExRem(Sell,Buy);Short=ExRem(Short,Cover);Cover=ExRem(Cover,Short);e1=Equity(1,0);Plot(E1,"["+WriteVal(Buyfreq,1.0)+","+WriteVal(Sellfreq,1.0)+"]",colorblack,8+styleLeftAxisScale);<FONT
size=2>
BuyFREQ=26;SellFREQ=33;Buy=BarsSince(STARTBuy)%Buyfreq
==0;Sell=BarsSince(STARTSell)%Sellfreq==0;Short=Sell;Cover=Buy;Buy=ExRem(Buy,Sell);Sell=ExRem(Sell,Buy);Short=ExRem(Short,Cover);Cover=ExRem(Cover,Short);e1=Equity(1,0);Plot(E1,"["+WriteVal(Buyfreq,1.0)+","+WriteVal(Sellfreq,1.0)+"]",colorwhite,8+styleLeftAxisScale);
BuyFREQ=25;SellFREQ=28;Buy=BarsSince(STARTBuy)%Buyfreq
==0;Sell=BarsSince(STARTSell)%Sellfreq==0;Short=Sell;Cover=Buy;Buy=ExRem(Buy,Sell);Sell=ExRem(Sell,Buy);Short=ExRem(Short,Cover);Cover=ExRem(Cover,Short);e1=Equity(1,0);Plot(E1,"["+WriteVal(Buyfreq,1.0)+","+WriteVal(Sellfreq,1.0)+"]",colorred,8+styleLeftAxisScale);
Dimitris TsokakisSend BUG REPORTS
to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to
suggest@xxxxxxxxxxxxx-----------------------------------------Post
AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A
href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check
group FAQ at: <A
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Yahoo! Groups Links
To visit your group on the web, go to:<A
href="">http://groups.yahoo.com/group/amibroker/
To unsubscribe from this group, send an email to:<A
href="">amibroker-unsubscribe@xxxxxxxxxxxxxxx
Your use of Yahoo! Groups is subject to the <A
href="">Yahoo! Terms of Service.
Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Yahoo! Groups Sponsor
ADVERTISEMENT
Yahoo! Groups Links
To visit your group on the web, go to:http://groups.yahoo.com/group/amibroker/
To unsubscribe from this group, send an email to:amibroker-unsubscribe@xxxxxxxxxxxxxxx
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
|