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

RE: [amibroker] TREND DETECTORS WITH VARIABLE PERIOD (II)



PureBytes Links

Trading Reference Links




<SPAN 
class=965284414-21042003>DT,
I am 
trying to understand what you are doing here. Are you looking to make entry 
after the static and variable indicator diverge? does not this leave you 
vulnerable to the stock becoming exhausted with you late in the emerging trend? 
I am trying to see the possible pitfalls of using this going forward rather than 
looking back at the result......
<SPAN 
class=965284414-21042003> 
<SPAN 
class=965284414-21042003>TIA<FONT color=#0000ff face=Arial 
size=2>Jayson 
<FONT face=Tahoma 
size=2>-----Original Message-----From: Dimitris Tsokakis 
[mailto:TSOKAKIS@xxxxxxxxx]Sent: Monday, April 21, 2003 5:56 
AMTo: amibroker@xxxxxxxxxxxxxxxSubject: [amibroker] TREND 
DETECTORS WITH VARIABLE PERIOD (II)
Here is an alternative.
The first method was increasing the smoothing period for every 
trendy day, from the beginning till the end.
It will do it even if the trend lasts 3 or 13 or 53 
bars.
A more realistic approach is to increase the period AFTER some 
threshhold bars.
Keep the smoothing fast up to the 20th trendy bar and 
then increase the period to stay more in the market and enjoy
the last [and the most interesting] part of the [prolonged] 
trend.
This will help to ignore the premature exit signals, ignore 
the probable first pull-backs and catch the usual double peak
formation, but, the code will examine this possible scenario 
AFTER the 20 confirmed trend bars.
The gif speaks better :
The initial trend detector is the 
black  DEMA(StochD(40),20). 
The variable detector stays closely for the first 20 bars and 
then changes to a much slower mode.[green-red line]
The obvious benefit is to ignore premature exit at the first 
peak P1, re-entry at R1 and goes to a final exit at P2.
The code for IB is
 
t=20;x=<FONT 
size=2>DEMA(StochD<FONT 
size=2>(40),t);<FONT 
size=2>Plot(x,""<FONT 
size=2>,1,<FONT 
size=2>8<FONT 
face="Times New Roman">);
tA=50;xA=<FONT 
size=2>DEMA(StochD<FONT 
size=2>(40),tA);<FONT 
face=Verdana size=2><FONT 
face="Times New Roman">//Plot(xA,"",7,8);<FONT face=Verdana 
size=2>
Cond1=Ref(x,-<FONT 
size=2>1)==LLV<FONT 
size=2>(x,3);<FONT 
size=2>Plot(50<FONT 
size=2>*Cond1,"",<FONT 
size=2>5,2<FONT face=Verdana 
size=2>);<FONT 
face="Times New Roman">
Cond2=Ref(x,-<FONT 
size=2>1)==HHV<FONT 
size=2>(x,3);<FONT 
size=2>Plot(50<FONT 
size=2>*Cond2,"",<FONT 
size=2>4,2<FONT face=Verdana 
size=2>);<FONT 
face="Times New Roman">
k1=BarsSince<FONT 
size=2>(Cond1);k2=BarsSince<FONT face=Verdana 
size=2>(Cond2);<FONT 
face=Verdana size=2>
Plot((k2>k1)*10<FONT 
size=2>,"",<FONT 
size=2>5,2<FONT 
size=2>);Plot((k2<k1)*<FONT 
size=2>10,""<FONT 
size=2>,4,<FONT 
size=2>2<FONT 
face="Times New Roman">);<FONT face=Verdana 
size=2><FONT 
face="Times New Roman">
Coeff=2;
trendbars=20;// calibrate here the start 
of variable smoothing<FONT 
face=Verdana size=2>
t1=IIf(k2>k1 AND 
k2>trendbars,t+coeff*k1,IIf<FONT face=Verdana 
size=2>(k1>k2 AND 
k1>trendbars,t+coeff*k2,t));<FONT 
face="Times New Roman">
x1=DEMA(<FONT 
size=2>StochD(40<FONT 
face=Verdana size=2>),t1);<FONT 
face=Verdana size=2>
Plot(x1,""<FONT 
size=2>,(x1>Ref(x1,-<FONT 
size=2>1))*5<FONT 
size=2>+(x1<Ref(x1,-<FONT 
size=2>1))*4<FONT 
size=2>,8<FONT face=Verdana 
size=2>);<FONT 
face="Times New Roman">
GraphXSpace=2<FONT face=Verdana 
size=2>;
 
Dimitris 
Tsokakis
 Send 
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 
Your use of Yahoo! Groups is subject to the <A 
href="">Yahoo! Terms of Service. 







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.