Perfect Trend Line

Perfect Trend Line

The Perfect Trend Line indicator act as a trend following indicator. It is simply made of 2 lines from highest high and lowest low of 2 different periods, one short and a longer one.

If the price breaches the longest line, it is a sign a of potential trend reversal, while if price is in the cloud made of these 2 lines, it is only a retracement and a potential price rebound in the same direction as the main trend.

Confirmation of trend reversal are highlighted with blue and red dots.

The cloud can be expanded with the SlowPipDisplace and the FastPipDisplace settings which must be set in points/pips values.


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?

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

  1. Genotik • 10/16/2017 #

    Merci !

  2. Laurent7533 • 10/16/2017 #


    Cet indicateur ne semble fonctionner qu’avec le forex. Est-ce qu’il serait possible d’avoir la même chose pour les actions ?

    • Nicolas • 10/16/2017 #

      L’indicateur est bien compatible avec tous les instruments. Merci de préciser ce qui ne semble pas fonctionner ?

  3. Laurent7533 • 10/16/2017 #

    Voici ce que me retourne le logiciel :

    Erreur de syntaxe :
    Veuillez définir la variable suivante : slowlenght
    Veuillez définir la variable suivante : slowpipdisplace
    Veuillez définir la variable suivante : fastlenght
    Veuillez définir la variable suivante : fastpipdisplace

    • Nicolas • 10/16/2017 #

      je vois tu as copié/collé le code plutôt que l’avoir téléchargé, veuillez soit le télécharger et le réimporter dans la plateforme, soit décommenter les lignes 9 à 12 (enlever les //).

  4. Laurent7533 • 10/16/2017 #

    Merci Nicolas. Effectivement, c’était bien le problème. Est-ce que ces variables lignes 9 à 12 sont optimisées pour du journalier Actions Euronext ? Sinon, quelles valeurs sont idéales ?

    • Nicolas • 10/16/2017 #

      Il n’y a pas de valeurs optimales, il s’agit de derniers plus haut et derniers plus bas sur les X dernières bougies.

    • Laurent7533 • 10/16/2017 #

      OK merci !

  5. Abz • 10/16/2017 #

    Hello Nicolas

    to use this in a automated strategy let say on a daily chart how can we perform that i tried this for Buy but dosent work

  6. Abz • 10/16/2017 #

    a1 = myPRCPerfectTrendLineptl2 > Dclose(1)
    a2 = myPRCPerfectTrendLineptl2 myPRCPerfectTrendLineptl

  7. luxrun • 10/16/2017 #

    Nicolas, ho realizzato uno screener dall’indicatore perfect trend-line. Lo screener mi restituisce tutte le azioni di un paniere, mentre io vorrei solo trovare quelle in situazione di “●” cambio trend da long a short o viceversa. Mi puoi aiutare? Grazie

    //PRC_PerfectTrendLine ptl | screener
    //Nicolas @
    //Sharing ProRealTime knowledge
    //converted from MT4 version (original author mladen)
    //enhanced version by Nicolas

    // — settings
    SlowLength = 7 // Slow length
    SlowPipDisplace = 0 // Slow pip displace
    FastLength = 3 // Fast length
    FastPipDisplace = 0 // Fast pip displace
    // — end of settings

    thigh1 = Highest[SlowLength](high)+ SlowPipDisplace*pointsize
    tlow1 = Lowest[SlowLength](low)- SlowPipDisplace*pointsize
    thigh2 = Highest[FastLength](high)+ FastPipDisplace*pointsize
    tlow2 = Lowest[FastLength](low)- FastPipDisplace*pointsize

    if barindex>2 then
    if Close>line1[1] then
    line1 = tlow1
    line1 = thigh1
    if Close>line2[1] then
    line2 = tlow2
    line2 = thigh2

    if (Close[0]<line1[0] and Close[0]line1[0] and Close[0]>line2[0]) then
    trend = -1
    if (line1[0]>line2[0] or trend[0] = 1) then
    trena = 1
    if (line1[0]<line2[0] or trend[0] = -1) then
    trena = -1
    if trenatrena[1] then
    if trena=1 then
    x = max(line1,line2)

    x = min(line1,line2)



    SCREENER (x)

  8. M. Pettersson • 10/16/2017 #

    Can you please use English?

  9. luxrun • 10/16/2017 #

    Nicolas, I realized a screener with the perfect trend-line indicator. The screener returns all the shares into a basket, while I just want to find those in a “●” trend setting from long to short or vice versa. Can you help me? Thank you

  10. Eduardo Siverio • 10/16/2017 #

    Hello Nicolas, first of all thank you for your amazing work, I downloaded the perfect trend indicator. I work only with the Dax full future in 1 minute. I’m looking for 10 points daily and I have tested your indicator for a week. I have a problem that I could’t resolve yet, when the blue/red dot gets on and I put an order based in that and then it gets off and doesn’t makes the reversal move. So, when can I be “sure” of the reversal, and the other question is if this indicator is the best to work with the Dax in 1 minute. Thank you.

    • Nicolas • 10/16/2017 #

      Like any other indicators, you must wait for a close to validate a signal (blue and red dots). This one is not better than any other, like I said already, it only generates signals depending of breakout of recent highest high and lowest low, sometimes it works well, sometimes not 🙂

  11. Eduardo Siverio • 10/16/2017 #

    Thank you Nicolas

  12. Eduardo Siverio • 10/16/2017 #

    Hi Nicolas, it´s me again. I´m obsessed with your Perfect Trend Indicator. I realized that I´m not faster than an automatic trader. So, my question is if you can program this indicator to operate automatically with some paramethers of buying and saling and with a daily task. If you can do it please let me know how we can do that.

    • Nicolas • 10/16/2017 #

      Sure it’s possible, please ask your query in the automatic trading forum (ProOrder) in order to get replies from members. I’m still on leave, so please be patient if no one answer your query in the mean time.

  13. Leo • 10/16/2017 #

    Hi Nicolas,
    in your opinion, why is it the “perfect” trend indicator?
    Thanks in advance

    • Nicolas • 10/16/2017 #

      It’s the name of the original code, not my opinion.

  14. hamid1736 • 10/16/2017 #

    Hi Nicolas,
    when the red or blue dot is formed, is it based on the close of the current candlestick(the same bar index) or it will be formed after close of the next candlestick ?


    • Nicolas • 10/16/2017 #

      It’s based on the current Close. In real time you can wait or not for the candlestick to close or not to validate the trading signal, depends on your trading style 🙂

  15. AlexF • 10/16/2017 #

    Hi, even if I almost understood the indicator’s theory, I am unable to translate it in ProRealCode to try open long or short positions. Would you please help me about it?

    • Nicolas • 10/16/2017 #

      Examples of how to use the indicator in an automated trading system here :

  16. hamid1736 • 10/16/2017 #

    Hi Nicolas,
    As per my previous message above, I mentioned that the red or blue dot is formed based on the current close or next close of candle stick? I have tested with 1 minute interval, it is based on current candle stick but when I change time interval to weekly, it looks like it is based on next candle stick or bar index. For example, I was pretty sure that IBEX ( Spain 35 cash index) at weekend when market was close, there wasn’t any blue dot under a bar closed on 27 October . But this week when market opened and price move higher it shows blue dot under previous candle stick which is inconsistent with other time interval. Is here problem or issues under weekly interval?

    • Nicolas • 10/16/2017 #

      Yes I know there some issues with the weekly chart, already encountered on another indicator. It has already been reported to PRT, but you can make a report with this specific indicator behavior within the platform debug console (CTRL+M).

  17. Nicolas • 10/16/2017 #

    Perfect Trend Line screener code:

  18. Lior Green • 10/16/2017 #

    Perfect Indicator. Thanks a lot. Hope i will get reach by using it 🙂

  19. primo1 • 10/16/2017 #

    Bonjour Nicolas,

    peut on transformer cet indicateur en strategie

    super travail

    • Nicolas • 10/16/2017 #

      Quelque chose a déjà été travaillé ici:
      Tu peux partir de cette base et la modifier / améliorer à volonté, on attend des retours de ta part 🙂

  20. Sjoerd • 10/16/2017 #

    Hello Nicolas,

    thank you for the code of the ‘perfect trend line’ indicator. As a daytrader on the 10, 15 and 30 min charts it confirms the reversals very nice.
    One question. I trade several stocks and some indices. Is there a possibility that i can get a alert when a blue or red dot appears?

    thank you in advance

    kind regards,

    • Nicolas • 10/16/2017 #

      You can use the screener posted here: Perfect Trend Line screener code:

  21. Sjoerd • 10/16/2017 #

    Thank you nicolas

  22. primo1 • 10/16/2017 #

    Bonjour Nicolas,

    sur quelle échelle de temps minimum tu utilises l indicateur

    je pense 4H ou 1H

  23. primo1 • 10/16/2017 #

    Bonjour Nicolas

    Pour créer la strategie comment peux tu traduire l”apparition des points.

    Acheter ou vendre lors de l’apparition des points


    • Nicolas • 10/16/2017 #

      Exemple dans ce sujet du forum ProOrder :

Register or


avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar

+20 more likes

Related users ' posts
jebus89 The more loss in a row you have, the more big winners u need in the future. With a belo 50% ...
PastaPesto Thank you for the feedback jebus. I totally agree on every point.
Paul Thanks for posting. I took my SDO strategy, removed the main criteria and inserted your code...
Nicolas Bene, perché no, trovi che sia affidabile a lungo termine?
Billy Ray Valentine Non saprei, che ne dici di provare?
Steffen Schmauch hello Nicolas, can I change the indicator that I only get the time of 8-9 clock displayed? a...
rama This is one of best indicator to trade any time frame
Madrosat Is this indicator as it is , useful in strategy automatic
osupero Buenisimo Sr Nicolas, seria posible que sólo marcara por encima o por debajo de una media mo...
1 month ago
JvdG Hi Nicolas, ld48 = 0.66 * ((ld16 - ld96) / (ld104 - ld96) - 0.5) + 0.67 * ld56 ld48 = Mi...
JvdG I meant of course: since ld56 is one of the constituents of ld48;
Nicolas You are right about ld56. Since this is a translation from another programming language, I d...
Paul Thanks GraHal for the suggestion. I will open a topic for the strategy. Dany, there are sti...
Paul updates are posted in topic below
eugenio buongiorno paolo , volevo farti i complimenti x il lavoro fatto , funziona molto bene sul 3 ...
Gianluca WOW! i was looking for something like this! Thank you!
FULVIO09 I try to answer even if, not being a statistic, it is not easy for me to do it, and even mor...
cfta Hi Fulvio, many thanks for sharing this clever indicator, much appreciated. As Pepsmile ment...
cfta Sorry adding the PRT to code didn't work in the above comment so I guess we will have to set...
4 months ago
Maxime Baudin Interesting, Thank you! :)
franck-david Bonjour Nicolas , actuellement je me forme grace a vos videos tres tres bien expliques mer...
Nicolas Merci. ça n'est pas le lieu pour poser ce genre de question :) Merci d'utiliser le forum Pro...
Vonasi Discussion on this indicator/filter can be found here:
Vonasi Forum discussion on these indicators can be found here:
jennr29 Hi. Is it possible to convert this code to an mq4 file?
Nicolas Sorry but our website is dedicated to prorealtime programming. However, you can ask for priv...
pableitor Hola Domenec, un indicador muy original y util que ciertamente añade mucha informacion a la ...
Domenec Hola Pableitor porque aqui lo que pretendo es programar un nuevo codigao mas ajustado para q...
Juanjo Hola Domenec. He visto en los videos que hablas continuamente de mercado de futuros con grá...
TAC Bolsa Wyckoff method,
paulnux Thank TAC Bolsa, Excellent indicator, very good. But I do not understand when to change AR...
TAC Bolsa There is no indicator. Wyckoff Events
Leo Does it opens pending orders?... maybe they were not trigger.
Mattzi Dont know, all i can see is that it opened an order yesterday in backtest but not live. Th...
Jean-Christophe Hello Leo, when running the strategy from 29/12/2015 to 31/08/2018 on ProRealTime Premium, I...