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

Notification

Icon
Error

Options
Go to last post Go to first unread
SuperHedgie  
#1 Posted : Friday, February 6, 2009 12:21:50 AM(UTC)
SuperHedgie

Rank: Newbie

Groups: Registered, Registered Users
Joined: 2/6/2009(UTC)
Posts: 3

Hi,

I was wondering if anybody could teach me how to program an indicator that would signal to me a possibility of a double top/bottom happening. Basically what this means is that on reaching the same height as the first peak a signal would appear on the chart.

Alternatively , programming an indicator that would signal to me a DT/DB has just happen even before it reaches the confirmation line of a DT/DB would be great as well. I've tried Bulkowskis DT/DB formula but somehow it doesnt work on my system and i've no prgramming knowledge at all so i dont knw how to tweak it to work on my charts.

Also is it worth it to get the metastock programming guide by David Jenys or the formulas that he is selling? Thanks in advance for the help guys

Cheers,

Shaun

johnl  
#2 Posted : Friday, February 6, 2009 10:34:40 PM(UTC)
johnl

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 11/7/2005(UTC)
Posts: 602


You should be able to use the Peak() and Trough() functions to identify past tops and bottoms. Is there any code for the formula you quoted?


SuperHedgie  
#3 Posted : Saturday, February 7, 2009 10:32:55 PM(UTC)
SuperHedgie

Rank: Newbie

Groups: Registered, Registered Users
Joined: 2/6/2009(UTC)
Posts: 3

Ive also got John Murphy's Chart Pattern Recognition software but i dont really knw how to modify it to get wht i want. The Bulkowski's DT/DB Formula is attached below, Thanks for help mate.

DOUBLE TOPS

PK:=Zig(C,10,%)<Ref(Zig(C,10,%),-1) AND Ref(Zig(C,10,%),-1)>Ref(Zig(C,10,%),-2);

TR:=Zig(C,10,%)>Ref(Zig(C,10,%),-1) AND Ref(Zig(C,10,%),-1)<Ref(Zig(C,10,%),-2);

PK1:=PeakBars(1,C,10);

PK2:=PeakBars(2,C,10);

(ValueWhen(1,PK,Ref(C,-1))/ValueWhen(2,PK,Ref(C,-1))>.96 AND ValueWhen(1,PK,Ref(C,-1)) / ValueWhen(2,PK,Ref(C,-1))<1.04) AND PK2-PK1>=10 AND Cross(ValueWhen(1,TR,Ref(C,-1)),C)

DOUBLE BOTTOMS

PK:=Zig(C,10,%)<Ref(Zig(C,10,%),-1) AND Ref(Zig(C,10,%),-1)>Ref(Zig(C,10,%),-2);

TR:=Zig(C,10,%)>Ref(Zig(C,10,%),-1) AND Ref(Zig(C,10,%),-1)<Ref(Zig(C,10,%),-2);

TR1:=TroughBars(1,C,10);

TR2:=TroughBars(2,C,10);

(ValueWhen(1,TR,Ref(C,-1))/ValueWhen(2,TR,Ref(C,-1))>.96 AND ValueWhen(1,TR,Ref(C,-1)) / ValueWhen(2,TR,Ref(C,-1))<1.04) AND TR2-TR1>=10 AND Cross(C,ValueWhen(1,PK,Ref(C,-1)))

johnl  
#4 Posted : Sunday, February 8, 2009 8:48:17 PM(UTC)
johnl

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 11/7/2005(UTC)
Posts: 602

I modified as below. It is easier to see what the variable are up to.


{DOUBLE TOPS}
PK:=Zig(C,10,%)<Ref(Zig(C,10,%),-1) AND Ref(Zig(C,10,%),-1)>Ref(Zig(C,10,%),-2);
TR:=Zig(C,10,%)>Ref(Zig(C,10,%),-1) AND Ref(Zig(C,10,%),-1)<Ref(Zig(C,10,%),-2);
PK1:=PeakBars(1,C,10);
PK2:=PeakBars(2,C,10);
a1:=ValueWhen(1,PK,Ref(C,-1))/ValueWhen(2,PK,Ref(C,-1))>.96;
a2:=ValueWhen(1,PK,Ref(C,-1))/ValueWhen(2,PK,Ref(C,-1))<1.04;
a3:=PK2-PK1>=10;
a4:=Cross(ValueWhen(1,TR,Ref(C,-1)),C);
a1+a2+a3{+a4};
{--------------------------------}
{DOUBLE BOTTOMS}
PK:=Zig(C,10,%)<Ref(Zig(C,10,%),-1) AND Ref(Zig(C,10,%),-1)>Ref(Zig(C,10,%),-2);
TR:=Zig(C,10,%)>Ref(Zig(C,10,%),-1) AND Ref(Zig(C,10,%),-1)<Ref(Zig(C,10,%),-2);
TR1:=TroughBars(1,C,10);
TR2:=TroughBars(2,C,10);
b1:=ValueWhen(1,TR,Ref(C,-1))/ValueWhen(2,TR,Ref(C,-1))>.96;
b2:=ValueWhen(1,TR,Ref(C,-1))/ValueWhen(2,TR,Ref(C,-1))<1.04;
b3:=TR2-TR1>=10;
b4:=Cross(C,ValueWhen(1,PK,Ref(C,-1)));
b1+b2+b3{+b4}
{------------------------------------}
SuperHedgie  
#5 Posted : Sunday, February 8, 2009 9:13:21 PM(UTC)
SuperHedgie

Rank: Newbie

Groups: Registered, Registered Users
Joined: 2/6/2009(UTC)
Posts: 3

Thanks John will try it out and see if it works, Thanks a lot for help again really appreciate it mate.

vladimir  
#6 Posted : Tuesday, September 7, 2010 11:35:53 AM(UTC)
vladimir

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 7/1/2007(UTC)
Posts: 33

Hi, I also learning how to scan for double stochastic top/bottom on the month chart within a date range. How do I change above formula to a) use stochastic indicators b) within a date range c) on the month timeframe using exploration ? Please give some advise. Thank you
johnl  
#7 Posted : Tuesday, September 7, 2010 4:34:40 PM(UTC)
johnl

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 11/7/2005(UTC)
Posts: 602

You could do something like:
and playing around with the Stoch() and Cross() variables.


a1:=Stoch(8,3);
a2:=Cross(a1,50);
a3:=Cross(50,a1);
{-----------------------------}
PK:=ValueWhen(1,a2=1,C);
TR:=ValueWhen(1,a3=1,C);
PK1:=BarsSince(a2=1);
PK2:=BarsSince(a3=1);
a1:=ValueWhen(1,PK,Ref(C,-1))/ValueWhen(2,PK,Ref(C,-1))>.96;
a2:=ValueWhen(1,PK,Ref(C,-1))/ValueWhen(2,PK,Ref(C,-1))<1.04;
a3:=PK2-PK1>=10;
a4:=Cross(ValueWhen(1,TR,Ref(C,-1)),C);
a1+a2+a3{+a4};

For monthly... use: Explorer,edit.options to set your explorer to monthly data.
Date Range... play around with year(), month() and dayofmonth() functions.
vladimir  
#8 Posted : Friday, September 10, 2010 10:46:44 AM(UTC)
vladimir

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 7/1/2007(UTC)
Posts: 33

Hi Johnl

First, thank for your help on the code.

I am testing them out.

BTW, if I want to check for double top from year 2006/06 onwards,

I have added the following to my exploration filter, year() >= 2006 and month()>=6

Will metastock scan it from 2006/06 onwards ? How do I enable it to scan from

2006/06 onwards by monthly timeframe.

FYI, I have set the exploration period to monthly timeframe.

Thank you

johnl  
#9 Posted : Friday, September 10, 2010 8:09:13 PM(UTC)
johnl

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 11/7/2005(UTC)
Posts: 602

The time comparisons only work for me when I compare YYYYMMDD.
The month()>6 might leave out the first 6 months of every year.

vladimir  
#10 Posted : Friday, September 10, 2010 10:45:34 PM(UTC)
vladimir

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 7/1/2007(UTC)
Posts: 33

Hi Johnl

Thank for your advise on code that will miss out the beginning first 6 months using

month() > 6.

1. How do you compare it using YYYYMM. I can't convert year()+month() to integer to compare. Please advise on this part.

2. kindly help to briefly explain this part of the code, why a1 >.96 and a2 <1.04,

I know the usage of the functions but not the logic behind.

a1:=ValueWhen(1,PK,Ref(C,-1))/ValueWhen(2,PK,Ref(C,-1))>.96;
a2:=ValueWhen(1,PK,Ref(C,-1))/ValueWhen(2,PK,Ref(C,-1))<1.04;

I still testing how to accurately count the double stochastic tops, if only there is

some functions to count the same events happening.

Thank you

johnl  
#11 Posted : Monday, September 13, 2010 7:20:43 PM(UTC)
johnl

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 11/7/2005(UTC)
Posts: 602

This thread should help:

http://forum.equis.com/forums/thread/17025.aspx

The .96 and 1.04 can be anything. Change them to see how it affects the signal.
vladimir  
#12 Posted : Monday, September 13, 2010 7:50:34 PM(UTC)
vladimir

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 7/1/2007(UTC)
Posts: 33

Hi Johnl

Thank for the help and code sample, it will improve my

understanding of MS language and usage.

Currently, I am using the Forum.dll DateRang function to solve my issue.

In the meantime, i still testing my double top of Stoch, result still not to my

expectation.

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.