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

Notification

Icon
Error

Options
Go to last post Go to first unread
RabC  
#1 Posted : Monday, December 8, 2008 4:08:01 AM(UTC)
RabC

Rank: Newbie

Groups: Registered, Registered Users, Subscribers
Joined: 1/15/2008(UTC)
Posts: 4

Does anyone know the code to program John Carter's TTM Squeeze indicator. It seems to be available on every system apart from Metastock, cheers.

johnl  
#2 Posted : Wednesday, December 10, 2008 10:20:20 PM(UTC)
johnl

Rank: Advanced Member

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

Here is some logic for it I found on the internet:

When Bollinger Bands (BB) fit inside the Keltner Channel (KC), a breakout is about to occur. It works on longer term charts, such as 15 minute to daily charts.

This code creates an indicator that plots the ratio of BB width to KC width. When BB and KC widths are the same, the ratio (BBS_Ind)is equal to one (1). When the BB width is less than the KC Width (i.e. BB fit inside KC), the BBS_Ind is less than one and a breakout is indicated.

Sounds interesting so I will play around with it and post my results in a few days.


johnl  
#3 Posted : Friday, December 19, 2008 8:52:10 PM(UTC)
johnl

Rank: Advanced Member

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

Here is something that may start you in the direction you want:
I like the chart because you can see the squeeze.

{ ©Copyright 2004~2005 Jose Silva }
{ For personal use only }
{ http://www.metastocktools.com }

{ User inputs }
pds:=Input("Keltner/Bollinger Bands periods",
1,252,10);
spread:=Input("Keltner Bands % spread",
0,1000,100)/100;
dev:=Input("Bollinger Bands deviation",
.001,10,1);
plot:=Input("[1]Keltner, [2]Bollinger, [3]Keltner+Bollinger",1,3,1);

{ Keltner bands }
KBmid:=Mov(Typ(),pds,S);
KBtop:=KBmid+Mov(H-L,pds,S);
KBtopDiff:=(KBtop-KBmid)*spread;
KBtop:=KBmid+KBtopDiff;
KBbot:=KBmid-Mov(H-L,pds,S);
KBbotDiff:=(KBbot-KBmid)*spread;
KBbot:=KBmid+KBbotDiff;
KBwidth:=KBtop-KBbot;
KBwidthAvg:=Cum(KBwidth)/Cum(KBwidth>-1);

{ Bollinger bands }
BBtop:=BBandTop(C,pds,S,dev);
BBmid:=Mov(C,pds,S);
BBbot:=BBandBot(C,pds,S,dev);

{ Plot on price chart }
If(plot=1,KBtop,BBtop);
If(plot=1,KBmid,If(plot=2,BBmid,KBtop));
If(plot=1,KBbot,BBbot);
If(plot=1,KBbot,If(plot=2,BBbot,KBbot))
Derek Worswick  
#4 Posted : Tuesday, May 8, 2012 12:09:57 PM(UTC)
Derek Worswick

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 8/11/2005(UTC)
Posts: 102

Code: { User inputs } NPeriod :=Input("Bands Channel's Periods", 1,252,20); BBStdDev :=Input("Bollinger Bands Deviation",.001,10,2); KTStdDev :=Input("Keltner Bands Deviation",0.0,10,1.5); MoPeriod :=Input("Momentum Periods",1,50,12); MoEMA :=Input("Momentum EMA Periods",1,20,5); {Bollinger Bands} HBLine := BBandTop( C, NPeriod, E, BBStdDev); LBLine := BBandBot( C, NPeriod, E, BBStdDev); {Keltner Bands} HKLine := Mov(C,NPeriod,S) + KTStdDev * ATR(NPeriod); LKLine := Mov(C,NPeriod,S) - KTStdDev * ATR(NPeriod); MoHist := Mov((C - Ref(C,-MoPeriod)),MoEMA, E); BBUp := If((HBLine > HKLine) AND (MoHist > 0), MoHist, 0); BBDo := If((LBLine < LKLine) AND (MoHist < 0), MoHist, 0); BBMid1:= If((BBUp = 0) AND (BBDo = 0) AND (MoHist > 0), MoHist, 0); BBMid2:= If((BBUp = 0) AND (BBDo = 0) AND (MoHist < 0), MoHist, 0); BBUp {Histogram - Blue}; BBDo {Histogram - Red}; BBMid1 {Histogram - Gray}; BBMid2 {Histogram - Brown};
Derek Worswick  
#5 Posted : Tuesday, May 8, 2012 12:24:51 PM(UTC)
Derek Worswick

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 8/11/2005(UTC)
Posts: 102

To Moderator How do you create a "code Box or Panel to enter MS formula code Derek
jjstein  
#6 Posted : Tuesday, May 8, 2012 3:21:50 PM(UTC)
jjstein

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 5/13/2005(UTC)
Posts: 715
Location: Midwest, USA

Was thanked: 1 time(s) in 1 post(s)
Put between tags of * code* and * /code*, without the space after the asterisk.

RJ Brossart  
#7 Posted : Thursday, June 4, 2020 1:19:49 PM(UTC)
RJ Brossart

Rank: Newbie

Groups: Registered Users, Subscribers
Joined: 1/3/2015(UTC)
Posts: 1

Thank you (Derek) for your code regarding John Carter's TTM Squeeze.  I'm looking to try and set up the histogram with the original/typical color scheeme for the system: light red/dark red, light blue/dark blue and also the white/yellow dots for the zero line when the BB and Keltner channels cross and uncross?  I notice you have histogram colours for the last 4 lines of code, but I'm confused as to how to make these show up within the plotted histogram.  Any help would be much appreciated as I'm a considerable noob here regarding the metastock porgramming language

BBUp {Histogram - Blue}; BBDo {Histogram - Red}; BBMid1 {Histogram - Gray}; BBMid2 {Histogram - Brown};

Users browsing this topic
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.