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

[amibroker] Re: TREND DETECTORS WITH VARIABLE PERIOD



PureBytes Links

Trading Reference Links

nand,
I have exactly the same idea [the difference in momentum can also be 
proved]. One point here : we do not know it in advance, it comes from 
the last 3 years experience. For an objective approach, we should 
measure the momentum somewhere in the middle of a trend and it is not 
that easy. I would appreciate your ideas on the subject.
Another point : since I made the smoothing period variable, I talk 
with the history of the trend [not only its static characteristics 
measured by an indicator] and may include other intermediate 
phenomena [divergences etc]. If the trend goes on and a divergence is 
detected, it is a signal to prepare a partial or total Sell [or 
Cover] and, consequently, decrease again the period value. The coding 
part may be a headache, but I think I can manage it.
Another final, for now, note : DEMA is excellent to adjust the 
transfer from fast to slow rate. It adds an internal damping, 
avoiding the gap. It is very similar to the real facts and may give a 
good realistic approach [I will post a theoretical note later on this 
subject].
Thank you 
Dimitris Tsokakis
--- In amibroker@xxxxxxxxxxxxxxx, "nkis22" <nkishor@xxxx> wrote:
> Dimitris, I have visually examined your TREND indicator
> and it seems set up very well in entry - thatis, entry
> on resumption after short pull back, for the longs BUT
> it is not so good for the shorts. This bears out the fact
> that momentum is different in nature on the upside vs the
> down side. 
> I will be experimenting with it for a week and then send
> u feedback.
> Thanks for your interesting ideas once again.
> 
> nand
> 
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "DIMITRIS TSOKAKIS" 
<TSOKAKIS@xxxx> 
> wrote:
> > See also a [descriptive] quantitative application for Crude Oil 
> > recent rally. This is the main idea : If you go long and the 
trend 
> is 
> > prolonged, the initial +20% changes to +30% [vs a theoretical 
+37%].
> > Not bad at all, especially if you are not on the train from the 
> > beginning [I think it happens many times. A delayed entry is not 
a 
> > crime, if you know the proper moment to leave the train...]
> > From my examination, this method skips the first two or three 
> > whipsaws. It will usually tell you to leave the trend BEFORE the 
> > ultimate peak and, I think, it protects you from sharp changes. 
In 
> > the CL case, you could easily loose 3months profits into 3 days 
and 
> > it is not good !![as you remember, the period was confused by 
> > military news and many traders decided to "wait for one more week 
> and 
> > then..." and lost one of the best oil movements...]
> > DT
> > --- In amibroker@xxxxxxxxxxxxxxx, "rmortonmd" <ronmd@xxxx> wrote:
> > > Thank you for your reply.  BTW, what do the  zero values at the 
> top 
> > > indicate?
> > > ron
> > > --- In amibroker@xxxxxxxxxxxxxxx, "DIMITRIS TSOKAKIS" 
> > > <TSOKAKIS@xxxx> wrote:
> > > > There are explanations after the // for many lines.
> > > > --- In amibroker@xxxxxxxxxxxxxxx, "rmortonmd" <ronmd@xxxx> 
> wrote:
> > > > > --- In amibroker@xxxxxxxxxxxxxxx, "DIMITRIS TSOKAKIS" 
> > > > > Dimitris,
> > > > > As a newbie to this program, I have seen a variety of 
> > > interesting 
> > > > > indicators and find this one to be most intriguing.  I have 
> > > several 
> > > > > questions about this particular indicator: (1) there are 7 
> > equal 
> > > > > signs 3 of which have values different than 0 and I was 
> > > wondering 
> > > > > what they indicated and if it were possible to label them 
in 
> > the 
> > > > > program.  (2) There are 3 curves, a yellow one, black one 
and 
> > > one 
> > > > > that alternates between red and green, I assume that the 
last 
> > > curve 
> > > > > indicates buy and sell signals but what are the other two?  
> > > Again, 
> > > > > is it possible to label these (in the comments section 
would 
> be 
> > > > > fine).
> > > > 
> > > > Plot(x,"",1,8);// fast trend detector, BLACK
> > > > Plot(xA,"",7,8);// slow trend detector, YELLOW
> > > > x1=DEMA(StochD(40),t1);// the variable trend detector, GREEN-
RED
> > > > The last line is GREEN for bullish trends and RED for bearish 
> > > trends.
> > > > Buy/sell signals need more requirements.
> > > > Green/Red bars at 50 gives the start and the end of the fast 
> > > uptrend.
> > > > Note that colours may change in your graph according to your 
> > > > preferences selection. In my colour pallete, 1 is black, 4 is 
> > red, 
> > > 5 
> > > > is green and 7 is yellow.
> > > > DT
> > > > > Thank you,
> > > > > ron
> > > > > <TSOKAKIS@xxxx> wrote:
> > > > > > Thank you for your comments.
> > > > > > It is not complete yet, I have to check a lot. I hope it 
> will 
> > > be 
> > > > > > simple at the end...
> > > > > > DT
> > > > > > --- In amibroker@xxxxxxxxxxxxxxx, "goldwing01" 
> > > <GOLDWING01@xxxx> 
> > > > > > wrote:
> > > > > > > Thank you Dimities nice piece of work with TREND 
> DETECTOR. 
> > I 
> > > > can 
> > > > > > see 
> > > > > > > what you are doing thanks.
> > > > > > > --- In amibroker@xxxxxxxxxxxxxxx, "Dimitris Tsokakis" 
> > > > > > <TSOKAKIS@xxxx> 
> > > > > > > wrote:
> > > > > > > > Some uptrends are sustainable for more than 10-20 
days.
> > > > > > > > A fast trend detector, like DEMA(StochD(40),20) would 
> buy 
> > > at 
> > > > > B0 
> > > > > > and 
> > > > > > > sell at S0.
> > > > > > > > The very next days it would force the trader to 
follow 
> > the 
> > > > > > > undesirable whipsaws W1, W2 and probably loose
> > > > > > > > a part of the B0/S0 profits.[see the black line]
> > > > > > > > A slow trend follower like DEMA(StochD(40),50) would 
> > start 
> > > at 
> > > > > B1
> > > > > > > [missing the interesting first 7 bars] 
> > > > > > > > and stop at S1[6 bars after the actual end of the 
> trend]. 
> > > The 
> > > > > use 
> > > > > > > of the slow period helps to avoid whipsaws but expose 
the 
> > > > profits
> > > > > > > > to a probable dramatic decrease after the actual 
peak. 
> If 
> > > the 
> > > > > > start 
> > > > > > > of the trend was sharp with the well known gap ups
> > > > > > > > then the remaining profits would not be similar to 
this 
> > > great 
> > > > > > trend.
> > > > > > > [see the yellow line].
> > > > > > > > The technical analyst wish would be 
> > > > > > > > 1. to begin ASAP, 
> > > > > > > > 2. avoid the whipsaws and 
> > > > > > > > 3. get out as closer to the actual peak.
> > > > > > > > It is the basic T/A problem with almost any indicator 
> and 
> > > > here 
> > > > > is 
> > > > > > a 
> > > > > > > solution proposal : the variable smoothing.
> > > > > > > > Begin with the fast indicator and, as the trend goes 
> on, 
> > > > > increase 
> > > > > > > smoothing factor adding +1 delay per bar.
> > > > > > > > If the trend holds for 20 bars, the beginning would 
be 
> > > per=20 
> > > > > and 
> > > > > > > today you would run a per=40.
> > > > > > > > If the trend stops for any reason, sharply back to 
> per=20 
> > > to 
> > > > > > begin 
> > > > > > > another, bearish cycle.
> > > > > > > > The result is the ENTRY/EXIT of the att. ^NDX gif
> > > > > > > > Paste in your IB the
> > > > > > > > 
> > > > > > > > /*TREND DETECTOR WITH VARIABLE PERIOD, by D. 
Tsokakis, 
> > > > > Apr2003*/
> > > > > > > > t=20;// the initial fast period
> > > > > > > > x=DEMA(StochD(40),t);
> > > > > > > > Plot(x,"",1,8);// fast trend detector
> > > > > > > > tA=50;// slow period
> > > > > > > > xA=DEMA(StochD(40),tA);
> > > > > > > > Plot(xA,"",7,8);// slow trend detector
> > > > > > > > Cond1=Ref(x,-1)==LLV(x,3);
> > > > > > > > Plot(50*Cond1,"",5,2);// the start of the fast uptrend
> > > > > > > > Cond2=Ref(x,-1)==HHV(x,3);
> > > > > > > > Plot(50*Cond2,"",4,2);// the end of the fast uptrend
> > > > > > > > k1=BarsSince(Cond1);// uptrend bar counter
> > > > > > > > k2=BarsSince(Cond2);// downtrend bar counter
> > > > > > > > Plot((k2>k1)*10,"",5,2);
> > > > > > > > Plot((k2<k1)*10,"",4,2);
> > > > > > > > t1=IIf(k2>k1,t+k1,t+k2);// the variable period
> > > > > > > > x1=DEMA(StochD(40),t1);// the variable trend detector
> > > > > > > > Plot(x1,"",(x1>Ref(x1,-1))*5+(x1<Ref(x1,-1))*4,8);
> > > > > > > > GraphXSpace=1; 
> > > > > > > > 
> > > > > > > > The method accepts further calibration if you replace 
> t1 
> > > with
> > > > > > > > coeff=0.5; // delay calibration, set coeff from 0.5 
to 
> 1.5
> > > > > > > > t1=IIf(k2>k1,t+coeff*k1,t+coeff*k2);// the calibrated 
> > > > variable 
> > > > > > > period
> > > > > > > > according to your needs.
> > > > > > > > The DEMA smoothing gives very reliable results and 
> > accepts 
> > > > > > variable 
> > > > > > > periods by design.
> > > > > > > > Dimitris Tsokakis


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Make Money Online Auctions! Make $500.00 or We Will Give You Thirty Dollars for Trying!
http://us.click.yahoo.com/yMx78A/fNtFAA/AG3JAA/GHeqlB/TM
---------------------------------------------------------------------~->

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 http://docs.yahoo.com/info/terms/