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.

avatar
Register or

Likes

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

+34 more likes

Related users ' posts
Nicolas le code est déjà sur cette page, inutile de fournir un autre format ?! Les fichiers itf sont...
Novice-Surfer Hello IV Mcm, You are my leader ! Your work is incredibly precise, thank you very much f...
Mikolajek Merci pour votre excellent travail !
mickey992 salut merci pour ton partage et ton travaille
patapouf Hi Vivien René I just discovered your “Ordered trend-following stocks Screener”. Great work...
afanitro424 its not plotting on chart but instead as it's own histogram directly below chart? How to fix...
Nicolas by adding the indicator on the chart :)
Nicolas Oui c'est possible. Merci de ne pas poster des demandes qui sont hors sujets. Pour les deman...
Igor Merci pour cet itf. Question : comment faire pour instruire un screener ?
Nicolas tester le croisement du Close avec la première valeur de l'indicateur : "TrailingStop", faci...
Dunstan I would like to get guidance_ How do I access and attach this indicator to my MT5 platform...
Nicolas You can't, use prorealtime, it's way better
jc84 Thank you very much for this indicator , not provided by PRT I was actually working at thi...
Nicolas Oui le code est correct et il fonctionne, j'ai de bons résultats sur la liste NASDAQ par exe...
pincherman Bonjour :-) J'ai coller le script dans prorealtime pour jouer avec le supertrend et j'ai un...
Nicolas Vous l'avez sans doute collé au mauvais endroit, dans l'éditeur de code pour les stratégies,...
IV Mcm Bonjour, Je ne reconnais pas cette ligne dans le code, essayer de télécharger directement le...
Manu L. Bonjour, Possible de créer un screnner multiframe Mois dans Ichimoku semaine dans Ichimok...
Guillaume Mcm I gave the above message fix ;)
Tradingrob Is it possible to put the itf-file in the right way here in Prorealcode? so the right 'trend...
Guillaume Mcm Update link ;) https://www.prorealcode.com/topic/trend-histogramme-cci-mise-a-jour-suite-...
Screw27 Hi man, I installed the indicator and i don't know why but my graph it is so big
HelixKing sounds interesting I'll take a look
Godo Bonjour Souhait Sam, Après de nombreux essais pour le mettre en format afin d'utiliser ce c...
Nicolas Il faut supprimer celles qui existent dans la fenêtre d'optimisation et les créer en dur dan...
crusoe76 hi there, anyone can help making this strategy work, i have a message saying replace variabl...
Screw27 Salut nicolas j'aimerais savoir tes résulats grace a cettte methode
eva.g.forsgren It dose not work, I get a strap instead of candels???????????????????????????????????????????
Nicolas That indicator is the one below the chart. The indicator to put on the price chart is this o...
pyhrus P.S : IG , que j'ai contacté ,m'indique que la version V11 , ne sera pas disponible avant un...
Hasardeur Dear Nicolas, is there someting at the arry to modify in order to run the trend at the actu...
MALIMALO Dear Nicolas, just try touse your indicator with backtest but it's not working. is anybody...
ribes65 Bonjour Nicolas, Merci pour votre travail. Est-il envisageable de créer un screener pour ...
Nicolas Bien sûr, merci de formuler une demande dans le forum des screeners pour prorealtime. En res...
ipbvba Est il possible de le transformer en indicateur (pour ne plus avoir les lignes mais uniqueme...
supertiti Bonjour Nicolas, Je ne comprend pas bien , le trend change de couleur quand les prix sont a...
Nicolas Oui ce serait possible, cependant l'indicateur est bien prévu pour conserver la couleur de l...
supertiti Quand tu pourras si tu peux nous coder la troisième couleur cela améliorerait les trades cou...
Nicolas How to import file page: in the help section of the website explains howto
kenssa import through the indicator page/window in the Proreal time
chicoteca Buenas, no consigo que se me muestre en el chart de DAX. ¿Cómo procedo? Gracias.-
Nicolas remplacer les valeurs de coloured(0,255,0) par coloured(r,g,b) et ajouter ces noms de variab...
mohamed merci Nicolas!
sacram14 Merci Nicolas pour ce set-up que je ne connaissais pas ! J'ai tenté de reprendre le code pou...
frenqle Hi There.. It seems the TSL stop loss is not working.. it does not respond is that correct?
Ciccarelli Franco Per lasciare che la strategia venga eseguita (dopo aver importato il file): Basta eliminare...
JADINVEST Hello Jan, hello everyone, Thanks Jan for this strategy! Since 2020, have any of you found a...
Stockastiss Can this code be simply transferred into Backtestingcode so one doesnt need to use call ? (i...
Vonasi Sorry for the late reply. Add the code to your strategy and remove line 5 and line 39. Chang...
viktorthunss Hi! How many averages are there? Can I see the somewhere?

Top