SuperTrend adaptive periods (r-squared)

v10.3
SuperTrend adaptive periods (r-squared)

New SuperTrend indicator version made of adaptive periods with comparison made from the coefficient of determination / average of the least squares.

The adaptive formula makes the SuperTrend more reactive to the little fluctuation of the market while still doing what it is supposed to do: be a trend following indicator.

Another great idea of this indicator is to draw “floating levels” above or below the SuperTrend which are calculated with percentage of the highest and lowest values of the SuperTrend within the last Y “flLookBack” periods. These floating levels could act as filter to detect / prevent false trend reverse.

The adaptive function code of this indicator can be use in many other indicators and new original concept, I suppose I’ll post more of them into the library in the future days/weeks.
Another indicator made of this kind of adaptive periods if the r-squared adaptive exponential moving average already posted in the prorealtime code library here.

Share this

Risk disclosure:

No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.

ProRealTime ITF files and other attachments : How to import ITF files into ProRealTime platform?

PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials

  1. zilliq • 02/10/2017 #

     Hi Nicolas,  
    Thanks for your indicator 
    Why donc you not use the r2 function of PRT who will be simplier and faster ? 
    Have a nice day 
    Zilliq 

    • Nicolas • 02/10/2017 #

      It would has been easier, but this adaptive function is not mine, it’s a translation from MT4 code, like the other one of adaptive EMA, I gave the link in the post. 

  2. zilliq • 02/10/2017 #

    Ok Nicolas,  il didn’t know it was a translation of a mt4 code (May be indicate it in your text) 
    Something who could be more interesting if to you use the same idea but with the Hurst exponent (correlate more with the trend than the r2 who correlate with LR).  It exists on mt4 not on prt if I remember. 
    http://www.greattradingsystems.com/indicators/hurst-exponent-indicator-for-mt4/
    Have a nice sunday and thanks
    Zilliq 

    • Nicolas • 02/10/2017 #

      It’s not the case in this one you’re right.

  3. leo1962 • 02/10/2017 #

    Ciao Nicolas,
    nel codice c’è un errore di sintassi, allego screenshot. Non sono pratico di codice e non riesco a risolverlo.
    Ti ringrazio per aver pubblicato l’indicatore e per la correzione che cortesemente vorrai effettuare.
    Un saluto
    Leonardo

    • Nicolas • 02/10/2017 #

      Este indicador sólo funcionará para Prorealtime v10.3 y superior.

  4. leo1962 • 02/10/2017 #

    gracias 😉

  5. verdi55 • 02/10/2017 #

    What is the use of this indicator ? When I use in my supertrend systems, with comparable parameters für period and mult, it starts wildly bouncing around the price. I get enormous and very fast fluctuations that destroy any trend following capabilities. On the other hand, when the parameter mult is increased enough to stop these fluctuations for most of the time, I see no advantage to the normal supertrend. Usually, it is not a good idea to change the period length within a supertrend while it is being calculated. The reason is that the size of ATR, with which the supertrend is calculated, varies with the period length. So, when you compare a supertrend, say with period 8 and with period 10 and the same mutiplier mult, in one case the supertrend may be above the price and in the other case below the price. When the periods are constantly changed, you will get a supertrend that bounces around the price instead of showing clear uninterrupted trends.

    • Nicolas • 02/10/2017 #

      That’s why there is no color on this version of the supertrend instead of the normal one. Even if price is jumping above or below the supertrend, it doesn’t mean that the trend is actually changing, percentile floating levels “could act as filter to detect / prevent false trend reverse.” . This indicator is a concept: use correlation with a r-squared line to adapt the period of the indicator, it results in a supertrend more versatile, but also change the way we are using it usually, I totally agree. Thanks for your feedback!

  6. verdi55 • 02/10/2017 #

    There is no colour ? May be not for Englishmen on this normal version. Thanks for your feedback from Avesnes-les-Aubert ! It’s only 76 kilometers away from Lille. Still, from time to time, I learn valuable things from your website. Thank you !

    • Nicolas • 02/10/2017 #

      Sorry? What do you mean?

    • verdi55 • 02/10/2017 #

      Have you ever made any Franc with trading ? I guess, not. Maybe I should change business and tell people what they like to hear. Sorry ? Regards to Prorealtime. 

    • Nicolas • 02/10/2017 #

      Everything here is free, I do not sell anything and “tell people what they like to hear”, I’m sorry you are thinking that. There are many more other websites where you could make this kind of remark but I don’t think it is really adapted here, because I spent all days answering any kind of questions on forums and code for free any queries to help people without asking nothing.  I encourage no one to use my code or whatever others made by people who are willing to share their work with the community. If you can’t stand what you read here, please move on to another place. I still don’t have understood your comment about the place where I live and work.. Anyway, I have no time for trolls but I’m pleased you “still learn  valuable things from your website”. 

    • verdi55 • 02/10/2017 #

      Is there such a thing as a free lunch ?

  7. maceng • 02/10/2017 #

    Thanks Nicolas for this great work! I would like to understand the math behind it in order to convert it to Python code.

    • Nicolas • 02/10/2017 #

      Sorry I have no time to provide assistance for python programmers. Have a good day.

avatar
Register or

Likes

avatar avatar
Related users ' posts
Iván Ciao Certo, posso analizzare il codice per tradurlo, ma devi lanciare la richiesta da qui: ...
Stenozar Ciao Ivan, ho provato ma non mi lascia caricare il post, non so per quale strano motivo...
Iván Allora crei un nuovo post. Lo aspetterò.
kats Bonsoir, Pensez vous pouvoir répondre à ma question posée ci dessus? Ce serait vraiment tr...
Iván Bonjour L'ensemble de l'indicateur est alimenté à partir de la ligne 9 avec la définition d...
kats BONSOIR c bon merci j ai trouve ce weekend merci de votre reponse cdlt
Gaspare Ciao Ivan si puo' inserire una strategia su questo indicatore per ottimizzare le variabil...
Iván
1 month ago
Iván Si lo descargas e importas en tu PRT verás que se han creado las variables para luego config...
WhyAskOZ Hi, Ivan As always you are doing great coding. The code works on my PRT, however the issu...
Iván You can delete in the last line (return) the configuration for color. Delete coloured(xx,xx,...
P. Marlowe Quite an impressive work, Iván. Extremely useful and accurate. Congratulations. Keep it up¡
lkiklkik i love it !!! thanks.
Stenozar Hi Ivan, can you translate from tradingviwe the EMA TREND METER INDICATOR? It couid be inte...
Iván Hi Yes I can. Please, create a new topic for that I will translate it.
Stenozar Hi Ivan, I've created a new topic about the indicator: https://www.prorealcode.com/topic/ema...
Doddge Hola Iván, ¿sería posible crear un screener que indique cuándo las velas coloreadas del indi...
RTR Ivan thank you for the pro-screener. I a trying to understand how to write the signals from ...
Iván Hi, Lines 62 and 63. These lines define buy and sell conditions.
Iván
2 months ago
Iván I personally like it in daily timeframe
oliTR Many thanks Ivan, I copy/paste your code to try it but could only get a constant stable unif...
Iván Hi, I've copied the code above and it works... what asset are you trying? $indices array ...
Iván Hi You should delete from the indicator code all drawing functions and all variables not us...
Iván I've created a screener to show [longcondition or shortcondition]
Chrisinobi Hallo Ivan, Danke das ist Perfekt !! Kannst du bitte in der Screener-Bibliothek die itf. hoc...
MaoRai54 Thanks, now it's OK. in your first code at line 15-16 it's missing.
Madrosat Hello Ivan Did you try a strategy with this indicator
Iván Hi. No I didn't. This is a code translation requested by an user a few days ago.
Iván
3 months ago
cjr30 Simplemente modifica las lineas 19 y 21 por las siguientes: drawtext("▲",barindex,low-0.1*a...
groelandes Gracias!!
WhyAskOZ i copied the code into strategy and it gives error on line 21 and 23. it says " Line 1: ...
Iván
3 months ago
Madrosat Hello Ivan You have interesting topics on indicators , smart supertrend, optimised trend t...
Iván Hi! thanks. All of these codes are translations requested in the forum. I've on mind to back...
Raspete01 Buenos días Iván, estoy intentando llevar el código eliminando los colores y pasando un Back...
Iván
3 months ago
ARLEQUIN49 Hello Ivan, Would it be possible to convert the code of this QQE MOD indicator which accomp...
ARLEQUIN49 here is the code: //@version=4 //By Glaz, Modified // study("QQE MOD") RSI_Period = i...
Iván Hi, Yes I can translate it but please, create a new topic for it.
Fgats quelques explications en Français ici : Some explanations in French here : https://www.p...
Nicolas Merci pour cette contribution, j'apprécie ! :)
Fgats Merci Nicolas pour ces encouragements et merci aussi pour le commentaire en Anglais accompa...
sfl Removing the short side will help, I would like to know from the author where are the condit...
WE ARE SOCIETY DEFPARAM cumulateOrders = False rem CAC40 (france40) en 10 secondes rem à la ligne ci-dess...
David Daget Bonjour. A noter que cette stratégie fonctionne aussi sur le ftse. Ce qui n'est pas surprena...
Alai-n I really like it when you develop ideas around price movement! I am much less a fan of all t...
elcortijoverde Muy buen trabajo.Intuitivo y claro.Gracias por tu dedicación y aportación.
FXtonio Nicolas.... MERCI 1 millions de fois, cet indicateur gagne dans 75% des cas en scalping m1 ...
davy42 bonjour, à quel moment apparait le fleche, à l'ouverture ou la fermeture de la bougie? merci
Freezer Bonjour, est-il possible d'ajouter une alarme sonore sur PRT à l'apparition des flèches ? Br...
Nicolas
9 months ago
B-Xtrender
B-Xtrender
8
Indicators
616248 Bonjour Nicolas, Peux tu nous expliquer le principe de fonctionnement ? Ou nous mettre un...
Nicolas Le lien vers l'article IFTA de l'auteur est dans le post déjà :)
P. Marlowe Very poweful indeed. It deserves close attention. I really appreciate very much IFTA backgro...

Top