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

[amibroker] C vs (H+L)/2 [part two]



PureBytes Links

Trading Reference Links




Here is an interesting alternative:
The basic idea is to buy when
a. Cross(<FONT 
size=2>0,R), like the first below described 
systemI
b. R makes a peak.
Since R is very smooth, instead of using the Peak function, we 
may have the same result with <FONT 
color=#000000>Ref<FONT 
size=2>(R,-1)==<FONT 
size=2>HHV(R,3<FONT face=Verdana 
size=2>);<FONT 
face="Times New Roman">
Sell conditions may remain the same.
The full code is
 
// Trade ^N225 with ^NDX data, II<FONT face=Verdana 
size=2>
N="^NDX"<FONT 
face="Times New Roman">;
O=Foreign(N,<FONT 
size=2>"O");H=Foreign<FONT 
size=2>(N,"H");L=<FONT 
size=2>Foreign(N,"L"<FONT 
size=2>);C=Foreign(N,<FONT 
size=2>"C"<FONT 
face="Times New Roman">);
t0=50<FONT 
face="Times New Roman">;
T1=5<FONT 
face="Times New Roman">;
R0=RSIA(C,T1)-<FONT 
size=2>RSIA((H+L),T1);Plot<FONT 
size=2>(R0,"",<FONT 
size=2>1,1<FONT face=Verdana 
size=2>);
R0=DEMA<FONT 
face="Times New Roman">(R0,T0);
R1=DEMA<FONT 
face="Times New Roman">(R0,T0);
R2=DEMA<FONT 
face="Times New Roman">(R1,T0);
R3=DEMA<FONT 
face="Times New Roman">(R2,T0);
R4=DEMA<FONT 
face="Times New Roman">(R3,T0);
R5=DEMA<FONT 
face="Times New Roman">(R4,T0);
R=R5;Plot(R,<FONT 
size=2>"",2<FONT 
size=2>,8<FONT 
face="Times New Roman">);
X=Optimize(<FONT 
size=2>"X",30<FONT 
size=2>,20,<FONT 
size=2>40,1<FONT face=Verdana 
size=2>);
Buy=Cross(<FONT 
size=2>0,R) OR Ref<FONT 
size=2>(R,-1)==<FONT 
size=2>HHV(R,3<FONT 
face=Verdana size=2>);<FONT 
face="Times New Roman">
Buy=ExRemSpan<FONT face=Verdana 
size=2>(Buy,X);<FONT 
face="Times New Roman">
Sell=Ref<FONT 
face="Times New Roman">(Buy,-X);
Short=Sell;<FONT 
face="Times New Roman">Cover=Buy;
 
The II system is equally profitable but in a 
different style :
System I worked with 
8trades/6winners/2losers
System II works with 20trades/13 
winners/7losers, the distance between signals is shorter. 
Although the final profit is almost the same, 
shorter intervals help for better control.
It is interesting to watch the recent systemII 
"decisions"
Buy on May13.
Sell/short on June24.
Cover/Buy again the very next bar, 
June25.
Sometimes <FONT 
face="Times New Roman">systems have a close touch to the tough trading reality 
!!
The general and detailed description is in 
sysII gif.
Dimitris Tsokakis
PS1 A typo on sysI was corrected 
below. 
PS2 Both systems are experimental, no trading experience available, any 
opinions appreciated.
 
----- Original Message ----- 
From: <A 
href="" title=tsokakis@xxxxxxxxx>Dimitris Tsokakis 

To: <A href="" 
title=amibroker@xxxxxxxxxxxxxxx>amibroker@xxxxxxxxxxxxxxx 
Sent: Monday, July 07, 2003 10:45 AM
Subject: C vs (H+L)/2

Close is not always in the middle of H, L distance. 
Some periods C is >(H+L)/2 and some other C is < 
(H+L)/2.
The difference
 <FONT 
size=2>R0=RSIA<FONT 
size=2>(C,T1)-RSIA<FONT 
size=2>((H+L),T1);Plot<FONT 
size=2>(R0,"",<FONT 
size=2>1,1<FONT 
size=2>);
for a fast period T1=5 is a measure of this 
property.
The line is too noisy and needs cascade smoothing 
[without significant delays] to reveal
the interesting signal. DEMA is the proper 
smoothing function, since it reduces the delay.
A five-step smoothing would be like 
this
R1=DEMA(R0,T0);<FONT 
face=Arial>
R2=DEMA(R1,T0);<FONT 
face=Arial>
R3=DEMA(R2,T0);<FONT 
face=Arial>
R4=DEMA(R3,T0);<FONT 
face=Arial>
R5=DEMA(R4,T0);
For a period T0 around 50, the noise is totally 
removed and the resulting curve is quite 
expressive. It crosses zero and becomes negative 
during the important uptrends and it
is positive during bearish 
intervals.
Buy=Cross(<FONT 
size=2>0,R);
is a simplified buy condition.
Significant uptrends usually last more than 20 
bars. After the first peak and the first
retracement, the market gives some more potential, 
visualised from double peaks, 
divergences etc. These observations advise to avoid 
long positions for more than 40 bars
[the bears will not disguise their feelings for 
long...]
X=Optimize(<FONT 
size=2>"X",28<FONT 
size=2>,20,<FONT 
size=2>40,1<FONT 
size=2>);Buy=<FONT 
size=2>ExRemSpan(Buy,X);Sell=<FONT 
size=2>Ref(Buy,-X);
expresses the requirement to sell 20 to 40 bars 
later.
The extended smoothing can express the influence of 
a leader market, like ^NDX, to 
dependent markets like ^N225 or 
^GDAXI.
^N225 is one of the most difficult markets, 
directionality is very poor and many trading systems
fail.
Let us use ^NDX data, follow the above description 
and apply it to ^N225.
The project sounds a bit absurd but it is 
not.
 
// Trade ^N225 with ^NDX data, I<FONT 
face=Arial>
N="^NDX";<FONT 
size=2>
O=Foreign(N,<FONT 
size=2>"O");H=Foreign<FONT 
size=2>(N,"H");L=<FONT 
size=2>Foreign(N,"L"<FONT 
size=2>);C=Foreign(N,<FONT 
size=2>"C");<FONT 
face=Arial>
t0=50;<FONT 
size=2>
T1=5;<FONT 
size=2>
R0=RSIA<FONT 
size=2>(C,T1)-RSIA<FONT 
size=2>((H+L),T1);Plot<FONT 
size=2>(R0,"",<FONT 
size=2>1,1<FONT 
size=2>);
R0=DEMA<FONT 
face=Arial>(R0,T0);
R1=DEMA<FONT 
face=Arial>(R0,T0);
R2=DEMA<FONT 
face=Arial>(R1,T0);
R3=DEMA<FONT 
face=Arial>(R2,T0);
R4=DEMA<FONT 
face=Arial>(R3,T0);
R5=DEMA<FONT 
face=Arial>(R4,T0);
R=R5;Plot<FONT 
size=2>(R,"",<FONT 
size=2>2,8);
X=<FONT 
size=2>Optimize(<FONT 
size=2>"X",28<FONT 
size=2>,20,<FONT 
size=2>40,1<FONT 
size=2>);<FONT 
face=Arial>
Buy=Cross(<FONT 
size=2>0,R);
Buy=<FONT 
size=2>ExRemSpan<FONT 
size=2>(Buy,X);
Sell=<FONT 
size=2>Ref<FONT 
face=Arial>(Buy,-X);
Short=Sell;
Cover=Buy;
 
The Long part give since Jan2000 
a return on account +42% [the respective ^N225 B&H return was 
-50%]
with an exposure 14% and max 
system drawdown -14.6%
The full Long/Short system gives 
a net profit +193% [max sys drawdown -21%] , wich is quite satisfactory 
for
tough markets like ^N225. The 
distribution of profits for x=20 to 40 bars interval is not bad at all. 
 
 
//^N225 [50,5,5,28]=+45%LONG, +193% LONG/SHORT
//[50,5,5,30]=+193%
<FONT color=#000000 face=Verdana 
size=2> 






Yahoo! Groups Sponsor












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



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



Attachment:
nn.gif
Description: GIF image
Attachment:
nn1.gif
Description: GIF image

Attachment: Description: "Description: GIF image"

Attachment: Description: "sysII.gif"

Attachment: Description: "Attachment:"