Perfect Trend Line 2

v10.3
Perfect Trend Line 2

This is a variation of a well known perfect trend line indicator (the initial version can be found here: Perfect Trend Line

This version is adding a sort of signals filtering which helps in cleaning up some false signals that are there in the original version.

Usage :

  • You can use the arrows (dots) as early signals
  • You can use the appearance of the color candle as signal for entry or re-entry

 

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. w • 11/05/2020 #

    HI NICOLAS, HOW CAN I CONNECT WOTH YOU, BECAUSE I NEED HELP WITH A NEW SIGNAL TO PROGRAMATE FOR A PRO REAL TIME TKS

    • Nicolas • 11/05/2020 #

      For private paid assistance you can contact me on this page: https://www.prorealcode.com/trading-programming-services/
      For any other coding query, you can use our free public forums.

  2. Yantra • 11/05/2020 #

    I have v10.3 via IG and usually, all your indicators display correctly but this one is just very squashed in a narrow horizontal line, dots, candlesticks, and all. Adjusting the optimised scale button and Zoom in/out buttons does little to affect it. Any suggestions to cure that? Thank you.

    • Nicolas • 11/05/2020 #

      in the price settings window, check the box for “Vertical autoscaling: use price only”. Or remove , trend as “trend” in the last line of the code.

  3. Yantra • 11/05/2020 #

    That did it! Nicolas, what a modest genius you are! Thank you for your work and all you offer on this site.

  4. Manu L • 11/05/2020 #

    Bonjour Nicolas,
    est ce que ton indicateur est utilisable sur toutes les UT ? Et sur la dernière version de PRT ?

    Merci

    • Nicolas • 11/05/2020 #

      Oui, il peut être appliqué sur toutes les unités de temps et fonctionne sur prorealtime v11.

  5. Manu L • 11/05/2020 #

    merci pour ce retour et je tiens a vous remercier sur la qualité de vos indicateurs.
    Cependant, pourquoi quand je le combine avec votre indicateur “Top Bottom indicator” j’observe un décalage et je ne suis pas sur les même tops entre les 2 indicateurs ?

  6. Canis Majoris • 11/05/2020 #

    bonjour nicolas,

    cet indicaeur marche une seule fois lors du chargement la premiere fois dans le graphes , si par exemple il es chargé en 15 min , si je passe à l’UT 5 min , il devient plat , et n’est plus visible

    • Nicolas • 11/05/2020 #

      Ajoutez: “if barindex>slowlength” à la ligne 17, sans les guillemets
      et “endif” à la ligne 80.

    • oxy75 • 11/05/2020 #

      idem, même problème, bizarre ^^

  7. Canis Majoris • 11/05/2020 #

    j’ai ajouté la condition , j’ai toujours le meme probléme , j’ai pourtant ,prt v11 !
    maintenant il ne s’affiche plus du tout dans n’importer quelle UT

    • Nicolas • 11/05/2020 #

      Aucun problème de mon côté, quel instrument en particulier? Combien de données affichées sur le graphique? (unités / barres / chandeliers).

  8. Canis Majoris • 11/05/2020 #

    micro gold future/micro s&p/micro DJ sur UT 1h-15′-5′ ,j’utilise un affichage 200 unité – avec des bougies style (Hollow candle)

    • Nicolas • 11/05/2020 #

      Aucun problème pour ma part avec les settings par défaut.

  9. Canis Majoris • 11/05/2020 #

    étrange ! en tout cas merci , rien qu’en l’employant seul il donne de bons résultats. surtout avec la nouvelle fonction de filtre

  10. Nick FX Junkie • 11/05/2020 #

    Hi Nicolas, firstly… amazing indicator THANK YOU! Question, is there anyway to change the red and blue dots to larger arrows? Would you be able to post the code to change this? Thanks in advance. Nick.

    • Nicolas • 11/05/2020 #

      bigger dots, replace 10 by a value like 25, at line 68.

    • Nick FX Junkie • 11/05/2020 #

      Legend! Much appreciated Thank You…

  11. superprof • 11/05/2020 #

    Bonjour Nicolas
    je suis débutant en trading
    1) les bougies grises, c’est quoi la signification ?stp
    2) pour fermer ma position , je dois toujours travailler avec support et résistance ( comment tu f pour savoir a quelle moment tu coupe ton Trade: stop loss??)
    Merci

  12. oxy75 • 11/05/2020 #

    Un grand Merci pour ce travail !

  13. karimprof • 11/05/2020 #

    bonjour
    que représente les bougies grises

    • Nicolas • 11/05/2020 #

      ce sont les bougies situées dessous/dessus la ligne rouge, selon le sens de la tendance (pullback).

  14. Lolo Obernai • 11/05/2020 #

    Merci Nicolas pour cet indicateur, j’ai rencontré le même souci de graph qui s’aplatissait après le changement d’UT, j’ai résolu le souci en rendant invisible la ‘trend’ dans l’indicateur, je vais maintenant pouvoir tester tout ca, encore un grand merci Amicalement Laurent

  15. Manu L • 11/05/2020 #

    Nicolas, existe-t-il un screnner pour detecter automatiquement les signaux d’achat ou possible de travailler sur cet indicateur pour le transformer ?
    merci

    • Nicolas • 11/05/2020 #

      Faire un CALL et utiliser la dernière variable “trend” comme signal, la condition serait du type: condition=trendtrend[1]

  16. Manu L • 11/05/2020 #

    Et ca donne quoi concretement ? 🙂

  17. marouaneayad • 11/05/2020 #

    Merci Nicolas pour le code, je l’ai retravaillé et j’ai optimisé le code pour le même résultat y’a toute une partie ou tu calcules les plus haut et les plus bas qui est redondée, c’est fait automatiquement par PRT dans ton init des variables :

    // ===================TrendLine Indicateur====================
    // Variables du Trend
    SlowLength = 7 // Slow length
    FastLength = 3 // Fast length

    // Calcul des plus Haut et des plus bas sur les 2 périodes
    fasthigh = Highest[FastLength](high)
    fastlow = Lowest[FastLength](low)
    slowhigh = Highest[SlowLength](high)
    slowlow = Lowest[SlowLength](low)

    if close > fastln[1] then
    fastln=fastlow
    else
    fastln=fasthigh
    endif
    if close > slowln[1] then
    slowln=slowlow
    else
    slowln=slowhigh
    endif

    once trend=-1
    if close < fastln and close fastln and close > slowln then
    trend=0
    endif

    if trendtrend[1] then
    if trend=0 then
    r=30
    g=144
    b=255
    else
    r=200
    g=20
    b=60
    endif
    drawtext(“●”,barindex,slowln,Dialog,Bold,10) coloured(r,g,b)
    endif

    drawcandle(open,high,low,close) coloured(168,168,168)
    if trend=0 then
    if close>fastln then
    drawcandle(open,high,low,close) coloured(30,144,255)
    endif
    elsif trend=1 then
    if close<fastln then
    drawcandle(open,high,low,close) coloured(200,20,60)
    endif
    endif

    return fastln coloured(200,20,60) as "fast line", slowln coloured(30,144,255) as "slow line", trend as "trend"

  18. MauroPro • 11/05/2020 #

    Hi, someone could explain how the program knows what is the term: “slowln” (in line 39), because the term is not defined (in line 18, for example, the expression “slowhigh” instead is clear because refer to: Highest[FastLength](high) .
    Thanks

  19. MauroPro • 11/05/2020 #

    To be more precise, what I don’t understand is how it is possible that the variables: “slowln” and “fastln” have never been assigned. Thanks

    • Nicolas • 11/05/2020 #

      these variables are assigned between lines 39 to 48

  20. MauroPro • 11/05/2020 #

    Hi Nicolas, could you recommend me some mid-high level programming manuals for Prt or similar language ? (english-french-italian-german) Thanks

  21. GPTrader64 • 11/05/2020 #

    Bonjour Nicolas,
    Un grand merci pour cet Indicateur, et de partager tout ce travail.
    J’ai pu affiner mes entrées et sorties de positions avec une meilleure précision.
    Bravo

  22. groen200 • 11/05/2020 #

    Have you please a backtest for this indicator “perfecttrenline-2”

  23. Manu L. • 11/05/2020 #

    Bonjour Nicolas,
    si je souhaite avoir un screener me signalant que les actions ayant un point bleu, quel pourrait etre celui-ci ?

    • Nicolas • 11/05/2020 #

      Détecter un croisement entre les lignes bleu et rouge, soit les 2 variables retournées par l’indicateur. Facile avec la création assistée.

  24. Manu L. • 11/05/2020 #

    J’ai creer un screnner avec la easy programmation avec FL = SL le tout avec periode en cours mais le screenner me sort que des anciens !?

  25. Manu L. • 11/05/2020 #

    J’ai bien tente de creer le screnner

    indicator1, ignored, ignored, ignored = CALL “PRC_PerfectTrendLine 2″[7, 3]
    ignored, indicator2, ignored, ignored = CALL “PRC_PerfectTrendLine 2″[7, 3]
    c1 = (indicator1 CROSSES UNDER indicator2)

    SCREENER[c1] ((close/DClose(1)-1)*100 AS “% Veille”)

    mais j’ai un message d’erreur “retoune 3 valeurs mais le code en a besoon de4 ”
    Un coup de main 🙂

  26. Hans63 • 11/05/2020 #

    This is one of the best indicator ever made
    Congrats!

  27. Manu L. • 11/05/2020 #

    Bonjour Nicolas,
    je m’intéresse de plus en plus à ton indicateur car les signaux d’entrée tiennent la route et j’ai réussi en le passer en screnner 🙂
    Le pb est que je l’utilise sur les périodes journalier et hebdo mais impossible de l’uliser en mensuel car PRT ne propose pas cet UT.

    Quel serait la solution car l’idée serait de screnner sur ces trois périodes et d’ensuite compiler sur excel et trouver toutes les actions qui ont le point bleu en mensuel, hebdo, journalier.

    Merci pou ton aide précieuse

    • Nicolas • 11/05/2020 #

      multiplier les périodes ? Il y a 4 semaines dans 1 mois, donc dans le TF hebdo, screener avec la période * 4.

  28. Manu L. • 11/05/2020 #

    Le pb est que je screen en journalier et hebdo directement dans la sélection mais pour screener en mensuel, à quel endroit faut-il que j’ajoute le *4 ? Voici mon prog

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

    // — 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
    else
    line1 = thigh1
    endif
    if Close>line2[1] then
    line2 = tlow2
    else
    line2 = thigh2
    endif
    endif

    if (Close[0]<line1[0] and Close[0]line1[0] and Close[0]>line2[0]) then
    trend = -1
    endif
    if (line1[0]>line2[0] or trend[0] = 1) then
    trena = 1
    endif
    if (line1[0]5000]

    • Nicolas • 11/05/2020 #

      il s’agit des périodes de calcul SlowLength et FastLength (7*4 et 3*4)

  29. Manu L. • 11/05/2020 #

    merci Nicolas
    En revanche je ne comprends pas : en période hebdo et en appliquant le *4 avec Actions France, il me sort les actions AF, AC, VK, CDA, GECP mais en naviguant sur d’autres actions je tombe sur ALHYG et FP avec point bleu alors que mon screener ne les a pas détecter !?

    // — settings
    SlowLength = 7*4 // Slow length
    SlowPipDisplace = 0 // Slow pip displace
    FastLength = 3*4 // Fast length
    FastPipDisplace = 0 // Fast pip displace
    c1 = volume

    // — 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
    else
    line1 = thigh1
    endif
    if Close>line2[1] then
    line2 = tlow2
    else
    line2 = thigh2
    endif
    endif

    if (Close[0]<line1[0] and Close[0]line1[0] and Close[0]>line2[0]) then
    trend = -1
    endif
    if (line1[0]>line2[0] or trend[0] = 1) then
    trena = 1
    endif
    if (line1[0]5000]

    • Nicolas • 11/05/2020 #

      c’est plus une méthode de contournement que l’utilisation réelle du timeframe monthly.

  30. Manu L. • 11/05/2020 #

    Mais est-il possible de programmer en TF monthly alors que PRT propose max weekly ?

    • Nicolas • 11/05/2020 #

      c’est très complexe dans ProScreener et différent pour chaque code, peut être dans sa prochaine version quand il intégrera les variables en tableaux.

  31. maxlys • 11/05/2020 #

    Bonjour Manu L, merci pur le code de ton screener. pour ma part j’ai 2 erreurs qui ressortent
    1ere erreur sur la ligne:
    if (Close[0]line2[0]) then
    il manque un paramètre entre Close[0]line1[0]

    2eme erreur :
    dernier ligne
    if (line1[0]5000], ici il manque pas du code pour la fin du screener ? peux tu m’indiquer quelles sont les erreurs a corriger ou bien reposter on code complet, ça serait otp . merci toi.

    • Manu L. • 11/05/2020 #

      // — settings
      SlowLength = 7*4 // Slow length
      SlowPipDisplace = 0 // Slow pip displace
      FastLength = 3*4 // Fast length
      FastPipDisplace = 0 // Fast pip displace
      c1 = volume

      // — 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
      else
      line1 = thigh1
      endif
      if Close>line2[1] then
      line2 = tlow2
      else
      line2 = thigh2
      endif
      endif

      if (Close[0]<line1[0] and Close[0]<line2[0]) then
      trend = 1
      endif
      if (Close[0]>line1[0] and Close[0]>line2[0]) then
      trend = -1
      endif
      if (line1[0]>line2[0] or trend[0] = 1) then
      trena = 1
      endif
      if (line1[0]<line2[0] or trend[0] = -1) then
      trena = -1
      endif

      screener[trena=-1 and trena[1]=1 and c1>5000]

  32. wtf_trading • 11/05/2020 #

    Hi Nicolas,
    I am new here, what language is the above code in, I want to try implementation in python?
    Thanks

  33. Manu L. • 11/05/2020 #

    Bonjour Nicolas,
    je te contacte car j’avais un indicateur PRC_FractalsTrendLine.itf mais celui beug et impossible de retrouver le lien du post pour récupérer la source.

    J’ai bien les diagonales qui s’affichent mais plus les paliers de S/R. serais-tu me retrouver celui-ci.

    En te remerciant

    • Nicolas • 11/05/2020 #

      C’est dans ce sujet: https://www.prorealcode.com/topic/trendline-une-approche-du-trading/
      Merci de poser la question dans celui-ci.

  34. Manu L. • 11/05/2020 #

    defparam drawonlastbaronly = true

    //fractals
    cp = lookback
    if high[cp] >= highest[(cp)*2+1](high) then
    LLH = 1
    else
    LLH = 0
    endif

    if low[cp] <= lowest[(cp)*2+1](low) then
    LLL = -1
    else
    LLL = 0
    endif

    if LLH = 1 then
    oldLTOPy = LTOPy[1]
    oldLTOPx = LTOPx[1]
    LTOPy = high[cp]
    LTOPx = barindex[cp]
    endif

    if LLL = -1 then
    oldLBOTy = LBOTy[1]
    oldLBOTx = LBOTx[1]
    LBOTy = low[cp]
    LBOTx = barindex[cp]
    endif

    //trend line
    DRAWLINE(oldLTOPx,oldLTOPy,LTOPx,LTOPy)coloured(112,169,161)
    DRAWLINE(oldLBOTx,oldLBOTy,LBOTx,LBOTy)coloured(211,78,36)

    //support/resistance
    if showSR then
    DRAWHLINE(LTOPy) COLOURED(207,215,199,100)
    DRAWHLINE(LBOTy) COLOURED(207,215,199,100)
    endif

    RETURN

  35. Manu L. • 11/05/2020 #

    C’est cette partie qui ne s’affiche plus

    //support/resistance
    if showSR then
    DRAWHLINE(LTOPy) COLOURED(207,215,199,100)
    DRAWHLINE(LBOTy) COLOURED(207,215,199,100)
    endif

  36. Pensera • 11/05/2020 #

    Bonjour Nicolas,
    comment est-il possible de backtester cet indicateur?
    cela fait une erreur “retourne 3 valeurs mais votre code en a besoin de 4” désolé cela fait plus de 5 ans que je n’ai pas programmé sur PRT…je vais profiter des vacances pour m’y remettre
    D’avance merci pour votre réponse
    Et merci et bravo pour la qualité des indicateurs que vous postez !

    • Nicolas • 11/05/2020 #

      Oui bien sûr, il doit y avoir pas mal de sujets dans le forum à ce propos.

  37. simmerseb • 258 days ago #

    Bonjour, merci beaucoup pour cet indicateur je le trouve très clair et pertinent.

avatar
Register or

Likes

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

+36 more likes

Related users ' posts
Nicolas Your PRT version is inferior to 10.3? So the code in its default state is not compatible. A ...
Mbulelo Hi Nicolas Hope all is well your side, do you have a specific strategy for the MFT Swing ...
Nicolas No I don't, try to make it on your own, or ask in forums (follow the posting rules please).
juanj And the point of violation is the close of the candle that violates the line by generating a...
juanj For the latest version of the strategy or to follow updates and developments see the thread ...
phanz i backtested it with 10K units of EURUSD 1 hour i get an equity curve that is going one way ...
Wing Not yet but I plan to.
Leo Have a look in this Forum, I got something interesting for you... https://www.prorealcode.co...
Dávid Gyalus Dear Wing, As I am a daytrader, and one of my best friend is a programmer we think your a...
Mr_Balagan Bonjour, j'ai quelques questions concernant cette combinaison d'indicateurs qui à l'air inté...
larouedegann STE : Fonction statistique "erreur standard" de séries temporelles de N périodes pour le pri...
Mr_Balagan Merci pour ces informations précieuses larouedegann. J'y vois plus clair. Encore joli boulot
JR1976 Dear Mike , your screener seem interest and simple... Do you try to envelope an automat...
Player Hi Mike, What is the name of the indicator just under the MMA ? Thanks Regards Marc
Igor Hi Mike, What is the name of the indicator just under the MMA ? Thanks Regards
EchnatonX Hallo Im Demomodus bei IG habe ich das Problem, dass oft keine Orders ausgeführt werden kön...
Jan EchnatonX, nice late answer of me: Make the stop loss a percentage of the close, like 100/...
guleny Hello I made some optimization to make it better. But there are 5 transacttion which incr...
Bougnat bonjour, ton screener semble intéressant .... merci pour le partage
guytrc Hi Nicolas - many thanks for your screener. One question if I may - how does condition 5 wor...
Nicolas In the last 20 periods, the SMA 10 periods was above the SMA 20 periods.
stratobast Good afternoon everyone. Thanks Doctrading for your work. I have an issue while using this ...
stratobast My bad guys. I understood what was the problem. The indicator uses highs and lows for the Re...
samwarduk Has anyone tried this on Bitcoin GBP1? The results look amazing but every time mine trie...
Kris75 Hi Bolsatrilera, I love this indicator! Thanks; => did you develop a strategy around...
Doctrading AH ok, I think the ca3 is the same : ca3 = pB[1] < 0.2 and pB < 0.2 Best regards,
chromosome21 Hello everybody, First, thank you so much for all your advices, I'm a begginer in trading a...
bertrandpinoy bonjour j ai un probleme avec ce code modifié, apparement PRT ne veut pas...avez vous une so...
rispardin no entiendo como funciana este indicador, por favor alguien podria explicar como utilizarlo???
AVT No se trata de un solo indicador, pero cada linea muestra otra información, de abajo hacia ...
IV Mcm Your indicator is interesting, I evaluated its relevance with the squeeze to detect the phas...
Kris75 Hi Gabri I launched a very simple strategy based on the 3 bars trailing stop that you cre...
TimDeCat Hi. Has anyone coded a version that you could alter it to say 5 bar trailing stop? ie make ...
Nicolas Please open a new topic in forums so we can code it there, thanks.
finplus bonjour, il y a un problème à la fin du code avec elsif (close 0 then ... ne manque t il pas...
kj1988 Hello Nicolas, thank you for this useful indicator. Could you tell me how I can remove the...
Nicolas remove lines 101 to 103
GraHal Yes sorry, I set up a link to a screen shot on my google drive and then I got locked into th...
gabri Here's the thread https://www.prorealcode.com/topic/multiframe-rsi-of-rsi/
Bernard13 Bonjour Nicolas, Pourriez-vous m'indiquer si cet indicateur fonctionne avec la V11 ? Le di...
jens_kittner This strategy was posted 2 years ago. I tested it today and it works perfect with the new da...
giustim Hallo I am not able to use it on daily TF What have I to change? Thanks a lot
pac.ros Ciao Francesco, ti scrivo per un aiuto a proposito della strategia di Hofmann che anch'io ho...
HeikinAshi Do you have an update of this indicator since you've created them, or is this still the actu...
mcha Thank you for this work. Do you try to transform/put this indicator on candlesticks and is ...
David Balance thanks for sharing this excellent indicator.  Here are some thoughts.  please ad...
reb Hello Marc your strat seems very intersting, will take a look Reb
897148 What exactly is meant by Total price? Is r1 =28 in your example the no of days for "Total P...
otty82  THX looks good!
century nice one , thank you
arvindrao01 Hey! Does anyone have a pinescript (tradingview) code for this?
imokdesign Hi Everybody, when I look at the strategy I felt the need to implement a Moneymanagement-Sy...
Inertia newlevel then multiplier=multiplier+1 oldlevel=newlevel newlevel=strategyprofit+startequi...
Inertia Hi Bjoern, I was playing around with your code this morning (EUR/USD 5'). Thank you to the...

Top