logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
wahkao  
#1 Posted : Tuesday, June 19, 2007 8:32:06 PM(UTC)
wahkao

Rank: Newbie

Groups: Registered, Registered Users, Subscribers
Joined: 5/7/2007(UTC)
Posts: 9

detection of a 2 point down trend touch line

Hi fellow technical traders. i am trying to code an algorithm for the detection of a 2 point down trend touch in the last 6 months or so and automatically drawing the trendline. A 2 point down trend touch line is where the stock is trending down and the trendline is drawn across 2 of it's most highest more protruding highs. perhaps a picture would be better to explain this. The link for this picture is http://img501.imageshack.us/img501/7889/2pointgm0.jpg
Jose  
#2 Posted : Wednesday, June 20, 2007 12:08:17 AM(UTC)
Jose

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 1/19/2005(UTC)
Posts: 1,065
Location: Koh Pha-Ngan, Earth

Was thanked: 2 time(s) in 2 post(s)
Wahkao, try adapting the 2-point plot indicator from MetaStockTools.com. "Coding example of 2-point, x/y line plot - useful for creating automatic chart trendlines." Also take a look at the TrendLine indicator code from the same place. jose '-)
minnamor  
#3 Posted : Wednesday, June 20, 2007 1:42:59 AM(UTC)
minnamor

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 4/27/2005(UTC)
Posts: 126
Location: Italy

You could buy PowerPivots Plus and use this indicator (EOD) for all types of most recent trend lines:

PPivot:=Input("[1]minor,[2]intermediate,[3]major",1,3,2);
FTrough := LastValue( ExtFml("Powerpivots.NthPivotPrice",-Ppivot,0,1));
STrough := LastValue( ExtFml("Powerpivots.NthPivotPrice",-Ppivot,1,1));
DeltaVerticalU := FTrough - STrough;
DeltaHorizontalU := LastValue(ExtFml("Powerpivots.BarsSinceNthPivot",-Ppivot,1)) - LastValue(ExtFml("Powerpivots.BarsSinceNthPivot",-Ppivot,0));
DeltaPerBarU := DeltaVerticalU / DeltaHorizontalU;
BarNoSecondTrough := LastValue(Cum(1) - ExtFml("Powerpivots.BarsSinceNthPivot",-Ppivot,1));
TrendD := If(Cum(1) < BarNoSecondTrough, BarsSince(Cum(1) >= BarNoSecondTrough), STrough + (DeltaPerBarU * (Cum(1) - BarNoSecondTrough)));
Up:=If(FTrough >= STrough, TrendD, BarsSince(FTrough >= STrough));
FPeak := LastValue( ExtFml("Powerpivots.NthPivotPrice",Ppivot,0,1));
SPeak := LastValue( ExtFml("Powerpivots.NthPivotPrice",Ppivot,1,1));
DeltaVerticalD := FPeak - SPeak;
DeltaHorizontalD := LastValue(ExtFml("Powerpivots.BarsSinceNthPivot",Ppivot,1)) - LastValue(ExtFml("Powerpivots.BarsSinceNthPivot",Ppivot,0));
DeltaPerBarD := DeltaVerticalD / DeltaHorizontalD;
BarNoSecondPeak := LastValue(Cum(1) - ExtFml("Powerpivots.BarsSinceNthPivot",Ppivot,1));
TrendU := If(Cum(1) < BarNoSecondPeak, BarsSince(Cum(1) >= BarNoSecondPeak), SPeak + (DeltaPerBarD * (Cum(1) - BarNoSecondPeak)));
Dn:=If(FPeak <= SPeak, TrendU, BarsSince(FPeak <= SPeak));
Up;Dn;

regards.

wahkao  
#4 Posted : Wednesday, June 20, 2007 1:50:37 AM(UTC)
wahkao

Rank: Newbie

Groups: Registered, Registered Users, Subscribers
Joined: 5/7/2007(UTC)
Posts: 9

Jose wrote:
Wahkao, try adapting the 2-point plot indicator from MetaStockTools.com. "Coding example of 2-point, x/y line plot - useful for creating automatic chart trendlines." Also take a look at the TrendLine indicator code from the same place. jose '-)


thanks, will check it out
wahkao  
#5 Posted : Wednesday, June 20, 2007 1:57:39 AM(UTC)
wahkao

Rank: Newbie

Groups: Registered, Registered Users, Subscribers
Joined: 5/7/2007(UTC)
Posts: 9

minnamor wrote:

You could buy PowerPivots Plus and use this indicator (EOD) for all types of most recent trend lines:

PPivot:=Input("[1]minor,[2]intermediate,[3]major",1,3,2);
FTrough := LastValue( ExtFml("Powerpivots.NthPivotPrice",-Ppivot,0,1));
STrough := LastValue( ExtFml("Powerpivots.NthPivotPrice",-Ppivot,1,1));
DeltaVerticalU := FTrough - STrough;
DeltaHorizontalU := LastValue(ExtFml("Powerpivots.BarsSinceNthPivot",-Ppivot,1)) - LastValue(ExtFml("Powerpivots.BarsSinceNthPivot",-Ppivot,0));
DeltaPerBarU := DeltaVerticalU / DeltaHorizontalU;
BarNoSecondTrough := LastValue(Cum(1) - ExtFml("Powerpivots.BarsSinceNthPivot",-Ppivot,1));
TrendD := If(Cum(1) < BarNoSecondTrough, BarsSince(Cum(1) >= BarNoSecondTrough), STrough + (DeltaPerBarU * (Cum(1) - BarNoSecondTrough)));
Up:=If(FTrough >= STrough, TrendD, BarsSince(FTrough >= STrough));
FPeak := LastValue( ExtFml("Powerpivots.NthPivotPrice",Ppivot,0,1));
SPeak := LastValue( ExtFml("Powerpivots.NthPivotPrice",Ppivot,1,1));
DeltaVerticalD := FPeak - SPeak;
DeltaHorizontalD := LastValue(ExtFml("Powerpivots.BarsSinceNthPivot",Ppivot,1)) - LastValue(ExtFml("Powerpivots.BarsSinceNthPivot",Ppivot,0));
DeltaPerBarD := DeltaVerticalD / DeltaHorizontalD;
BarNoSecondPeak := LastValue(Cum(1) - ExtFml("Powerpivots.BarsSinceNthPivot",Ppivot,1));
TrendU := If(Cum(1) < BarNoSecondPeak, BarsSince(Cum(1) >= BarNoSecondPeak), SPeak + (DeltaPerBarD * (Cum(1) - BarNoSecondPeak)));
Dn:=If(FPeak <= SPeak, TrendU, BarsSince(FPeak <= SPeak));
Up;Dn;

regards.



oh that's nice but unforturnately it cuts through other prices. i plotted this with minor trendline setting
how about using the zigzag? i believe that work but i got a problem coding it
minnamor  
#6 Posted : Thursday, June 21, 2007 8:45:33 AM(UTC)
minnamor

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 4/27/2005(UTC)
Posts: 126
Location: Italy

I wouldn't worry about that. The PP based trendlines are based on Pivots and that is what matters. You can have highs or lows cutting through them but if they are not pivots then they are not significant in that timeframe. I would suggest drawing ATR bands around trendlines that would indicte range of importance of breach. For instance use ATR(5) ver-below trendline for primary, ATR(20) for intermediate and ATR(40) for major (levels as used in ominitrader for similar calculations). That should give a more meaningful interpretation. The same applies to simple support and resistance levels.

regards.

Users browsing this topic
Guest (Hidden)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.