Nicolas

TTM Squeeze Oscillator and On price version

Category: Indicators By: Nicolas Created: May 1, 2017, 9:44 AM
May 1, 2017, 9:44 AM
Indicators
63 Comments
TTM Squeeze Oscillator and On price version

The TTM Squeeze Oscillator (by John Carter) measure the strength of the market and its momentum. It is built with the Bollinger and the Keltner bands. When the volatility increase, the Bollinger Bands are widening and are enveloping the Keltner channel, while when the market is consolidating the BB are inside the KC and the market is squeezing.

Squeeze on: Red dots appears on the oscillator, prepare for a consolidation breakout to come.

Market is trending, squeeze is off: Green dots

The trend momentum and direction is identifiable with the oscillator color:

  • light blue = trend is up ; dark blue = momentum of bullish trend is decreasing.
  • red = trend is down ; yellow = bearish momentum is decreasing.

In this version, I added the possibility to apply the indicator on the price also to color the candlesticks accordingly to the squeeze oscillator. So this indicator embed 2 indicators at once: the oscillator and the candlesticks painter. To get the coloured candlesticks, apply the indicator on the price and tick the “CandlesticksSqueeze” in the indicator settings.

The “squeezeDotsOffset” setting help you move the oscillator dots above/below the zero level of the oscillator. I found that sometime, the color overlay of the histogram and the dots were disturbing, so this offset can resolve this “problem”.

 

//PRC_TTM Squeeze for PRT v10.3| indicator
//27.04.2017
//Nicolas @ www.prorealcode.com
//Sharing ProRealTime knowledge

//---Settings
//length=20
//mult=2
//lengthKC=20
//multKC=1.5
//squeezeDotsOffset=0
//candlesticksSqueeze=0 //boolean variable
//---End of settings

//BB
basis = average[length](close)
dev = mult * Std[length](close)
upperBB = basis + dev
lowerBB = basis - dev

//KC
ma = average[lengthKC](close)
myrange = range[lengthKC]
rangema = average[lengthKC](myrange)
upperKC = ma+rangema * multKC
lowerKC = ma-rangema * multKC

value = (Highest[lengthKC](high)+Lowest[lengthKC](low)+average[lengthKC](close))/3
val = linearregression[lengthKC](close-value)

sqzOn = (lowerBB>lowerKC) AND (upperBB<upperKC)

if(sqzOn=1) then
 scolorR = 0
 scolorG = 255
else
 scolorR = 255
 scolorG = 0
ENDIF

if val>0 then
 sqz=-squeezeDotsOffset*pointsize
else
 sqz=squeezeDotsOffset*pointsize
endif

//histogram modifications
if val>0 and val>val[1] then
 plusI = val
 plusD = 0
 minusI = 0
 minusD = 0
 colorR=0
 colorG=245
 colorB=255
elsif val>0 and val<val[1] then
 plusI = 0
 plusD = val
 minusI = 0
 minusD = 0
 colorR=0
 colorG=0
 colorB=255
elsif val<0 and val<val[1] then
 plusI = 0
 plusD = 0
 minusI = 0
 minusD = val
 colorR=255
 colorG=0
 colorB=0
elsif val<0 and val>val[1] then
 plusI = 0
 plusD = 0
 minusI = val
 minusD = 0
 colorR=255
 colorG=255
 colorB=0
endif

//candlesticks squeeze painting
if CandlesticksSqueeze then
 drawcandle(open,high,low,close) coloured(colorR,colorG,colorB)
endif

RETURN plusI coloured(colorR,colorG,colorB) style(histogram,1) as "plus increase", plusD coloured(colorR,colorG,colorB) style(histogram,1) as "plus decrease", minusI coloured(colorR,colorG,colorB) style(histogram,1) as "minus increase", minusD coloured(colorR,colorG,colorB) style(histogram,1) as "minus decrease", sqz coloured(scolorR,scolorG,0) style(point,5) as "squeeze momentum"

 

Download
Filename: squeeze-with-dots-offset.png
Downloads: 774
Download
Filename: PRC_TTM-Squeeze-10.3.itf
Downloads: 1823
Download
Filename: TTM-Squeeze-on-price-chart.png
Downloads: 716
Nicolas
Nicolas Legend
I created ProRealCode because I believe in the power of shared knowledge. I spend my time coding new tools and helping members solve complex problems. If you are stuck on a code or need a fresh perspective on a strategy, I am always willing to help. Welcome to the community!
Author’s Profile

Comments

Dron
3 years ago
#

De lo mejorcito

Jodal
4 years ago
#

Bonjour Nicolas, Merci pour cet indicateur! Est-ce possible de configurer une alerte pour un changement de couleur (vert rouge) du squeeze momentum? (Je demande car je ne trouve pas comment faire) Pour pousser encore plus la chose en trading automatique, serait-il possible d'intégrer cet indicateur dans une stratégie? Si oui, je peux faire un post séparé sur le forum. Merci d'avance! Jo

Nicolas
4 years ago
#

Merci pour le post dans le forum en respectant les règles de publication énoncées dans le cadre jaune.

svdhoble
6 years ago
#

Hi how one can download the TTM squeeze indicator?

Nicolas
6 years ago
#

Attached files of this post are listed below "ProRealTime ITF files and other attachments :" title.

Bard
6 years ago
#

Loaded this great indicator into a chart tonight only to find great big rectangles denoting the squeeze? I don't remember these and have tried to find them in the code above to delete it but can't work out what lines of code are producing them? The line overwhelms the height of the indicator. Pls see image: https://www.dropbox.com/s/31b0sc7hltf6xei/ttm.png Cheers,

Tradingshed
6 years ago
#

HI, this code does not work for me, I have copied it and pasted it into V10.3 but it returns"syntax error". I have tried with and without the "candlestick waiting" part. Does anyone have this as a file to import directly into PRT? Thank you in advance.

Nicolas
6 years ago
#

The file to download is located at the bottom of the page, it is the case for any of the codes available in the library.

Axel98
7 years ago
#

Merci pour l'info

Axel98
7 years ago
#

Bonjour, y-aurait-t'il une raison pour que le code ne donne pas le bon résultat visuel avec PRT v.11 ? J'ai importé le code du fichier TIF et une affiché l'indicateur sur mon écran, les zones de squeeze ne semblent pas correspondre avec le graphique sur lequel j'ai affiché les BB et les canaux de Keltner... (désolé je ne vois pas comment ajouter une image écran dans mon commentaire :-/ ) Quelqu'un aurait une idée ?

Nicolas
7 years ago
#

Le canal de Keltner de la plateforme utilise un écart multiplicateur de 1 par défaut et on ne peut pas le changer. Celui du code de l'indicateur permet de modifier cet écart, par défaut à 1.5.

SYNDICATE
7 years ago
#

Is thee a ninja 8 vesion available?

theproday
8 years ago
#

@nicolas: Fantastic post thank you I was hoping you could also create the waves to be used in conjunction with this indicator, there are similar waves created in the past but the ones John Carter uses look much better. Could you create them? Link to the waves: https://www.simplertrading.com/waves/ Thanks in advance

Swingforfortune
7 years ago
#

https://www.prorealcode.com/prorealtime-indicators/wave-momentums/

Nicolas
8 years ago
#

Please open a new topic in the ProBuilder forum and ask about it. Please provide as much details as possible and possibly with screenshots. Thank you.

casamania
9 years ago
#

Hi Nicolas I am new to this so sorry, I am talking about the TT SQUEEZE FIRED screener. Thanks Gary

Nicolas
9 years ago
#

answered here: https://www.prorealcode.com/prorealtime-market-screeners/ttm-squeeze-fired-screener/#comment-4341

Nicolas
9 years ago
#

ok, so your query should be asked there: https://www.prorealcode.com/prorealtime-market-screeners/ttm-squeeze-fired-screener/ I'll answer you in this other post instead, thanks.

casamania
9 years ago
#

What great work this screener is thanks very much for sharing it. However would it be possible to get the instruments that have fired to remain on the screener in order ? because if you use the higher time frames is is possible to get into a trade on the second or third candle but the fired instruments disappear as soon as they have fired. Also is it possible to put an alert when something fires ? Thanks for your help

Nicolas
9 years ago
#

This code is not a screener but an indicator, I'm not sure I understand you correctly, are you referring to another code of the library?

mcha
9 years ago
#

bonjour, Je trouve cet indicateur très pertinent. Peut-on lui apporter deux modifications pour faciliter sa lecture sur le graphe? - rendre invisible l'histogramme lorsqu'on choisit de colorer les chandeliers - mettre alors les dot sous la forme de points placés sous chaque chandelier Merci par avance de votre aide

Nicolas
9 years ago
#

Il faudrait alors changer les lignes 82 à 85 avec ceci: //candlesticks squeeze painting if CandlesticksSqueeze then drawcandle(open,high,low,close) coloured(colorR,colorG,colorB) plusI=0 minusI=0 plusD=0 minusD=0 drawtext("▬",barindex,highest[length](high),Dialog,Bold,14) coloured(scolorR,scolorG,0) endif

mcha
9 years ago
#

Bonsoir Nicolas, Merci beaucoup pour ce complément de code, qui fait disparaitre l'histogramme du graphe et garde les dot signant une consolidation ou un trend selon la couleur. Merci également pour votre réactivité.

dzim0032
9 years ago
#

J'ai commencé à ingurgiter les vidéos explicatives sur la formation de programmation à PRT après ma dernière demande sur le ZigZag et c'est vraiment difficile.

dzim0032
9 years ago
#

C'est justement le TTM Squezze de John Carter que j'avais trouvé il y a quelques années sur le forum de ProAt je le mettrais prochainement avec les explications. Bonne soirée. Denis.

dzim0032
9 years ago
#

Voilà cela vient de fonctionner. L'erreur venait de moi. Lorsque dans la plateforme je voulais ajouter l'indic et cliquait sur  " ajouter prorealcode "  qui me dirigeait sur  le site je cliquais  sur le lien et là plus rien, alors le code était enregistré sur un dossier de l'ordi que je n'allais pas chercher au bon endroit. Idem si directement sur le site je faisais clic sur le lien "itf" enregistré et moi je n'allais pas le cherché là où il se trouvait.  Toutes mes excuses Nicolas. Par contre j'ai quand même une question : comment faire pour poster un code d'un indic ?

Nicolas
9 years ago
#

Je suis content que tu y soit arrivé par toi même :)

Si tu souhaites partager un code dans la "library", il faut utiliser le petit bouton "+" en haut à droite dans la barre de navigation à côté de ton avatar. 

dzim0032
9 years ago
#

je fais toujours clic droit pour ouvrir le menu contextuel de Windosw mais là : ouvrir le lien ds 1 nouvel onglet, ouvrir le lien ds 1 nouvelle fenêtre, enregistrer le lien sous et copier l'adresse du lien mais enregistrer sous un dossier quelconque  dans les 222 downloads j'en sans doute 5 où 6 

Nicolas
9 years ago
#

Il faut importer le fichier .itf téléchargé dans la plateforme en suivant ce tutoriel: https://www.prorealcode.com/import-export-prorealtime-code-platform/

ProRealCode ProRealCode
Loading...