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 • 259 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
Yannick Thanks for sharing. This strategy is flat for 11 years and winning afterwards. Don't you thi...
Doctrading Hello, As I usually say, strategies are exposed to be improved :) So yes, I think there mu...
Lior Green Doesn't work for me. Set values “compra” and “venta” to be shown as HISTOGRAM
Fabio Anthony Terrenzio this strategy works only in a well defined trend
brosly Good afternoon I am trying to get the complete code of lex strategy made by adolfo since I s...
dreif123 hi Adolfo, is Alex Auto Trading Botindex working on DAX as well ? if so , can you post the...
Doctrading I forgot to write at the beginning :  a = 50 b = 50 These are intermediate levels Sorry
DerPat Thank you. This one could be an aid in my current research on stochastics.
Pelayo it is possible that in line 12 we should put seuilinf=-b, thaks for all
Doctrading Hello, Someone asked me something (his results seemed to be different) on my email, but it ...
Glen Marquis Not your best..So what is your best strategy? :)
denmar Hi Could somebody please enlighten me how this code operates. I wish to use the code (is...
denmar Testing email notification to Denmar
David Black #gm74 Did you ever get this figured out? gm74
TradSuz C'est étrange, je note donc à nouveau les deux horaires achat et vente =9H/17H, le iRSI de l...
TradSuz Merci à Doctrading pour cette trame de code super et qui marche sur d'autres supports aussi....
Bibi83 Bonsoir à tous Juste pour vous informer que j'ai enlever les conditions short et que cela ...
GraHal Hi Nicolas I like this and would like to understand it fully so please forgive the (maybe) d...
Nicolas Hi GraHal, the Factor parameter is only a multiplier of the ATR that is added or subtracted ...
GraHal Nicolas, thank you for your useful and informative response. Yes I optimise using ProBackte...
Denis Hello, Congratulations and thank you for this work. I do not understand one thing, however...
Nicolas
9 years ago
GraHal Hi Nicolas Britains .itf file didn't work for me ... I had to change h to hh at line 13 and...
Nicolas Thank you GraHal for pointing this error, i have corrected the code in the file. The code in...
sr021 Hi I tried to copy and paste the code, but recieve the message  : Syntax error:The followi...
Nicolas Hello, of course. You have 3 options : 1/ you download the file and import it into your plat...
Nicolas
9 years ago
Nicolas
9 years ago
U Trend Sensor
U Trend Sensor
4
Indicators
Nicolas Hi Stef, thanks again for contributing to my near perfect english :)
Salocin Hi Nicolas, seems to be a pretty cool one as an indicator. can you define "plotsingal". Syst...
Nicolas Download the itf file attached to the post, there's everything needed in it. Just import thi...
Nicolas
9 years ago
cosmicsurfer I actually live up the road from Daryl Guppy. On the first day of my training i walked aroun...
Pleidian Hi, I'm trying to add the guppy indicator to my charts but i keep getting a box that's says ...
Nicolas Wrong copy/paste? Always a better idea to download the ITF file and import it into the platf...
Yantra "i believe this indicator could help any trend followers in trading decision. " I'm wonderin...
Nicolas
10 years ago
Tradesun Salve, ho provato ad inserire l'indicatore nella piattaforma ma mi chiede di definire la var...
maximus78 Tradesun, se scarichi il file ITF allegato e lo importi nella piattaforma ci sono già le var...

Top