Nicolas

Perfect Trend Line 2

Category: Indicators By: Nicolas Created: November 5, 2020, 2:37 PM
November 5, 2020, 2:37 PM
Indicators
58 Comments
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
//PRC_PerfectTrendLine 2 | indicator
//05.11.2020
//Nicolas @ www.prorealcode.com
//Sharing ProRealTime knowledge
//converted from MT5 version (original author mladen)
//enhanced version by Nicolas

// --- settings
SlowLength         = 7 // Slow length
FastLength         = 3 // Fast length
// --- end of settings

fasthigh = Highest[SlowLength](high)//[1]
fastlow  = Lowest[SlowLength](low)//[1]
slowhigh = Highest[FastLength](high)//[1]
slowlow  = Lowest[FastLength](low)//[1]

if high<slowhigh then
 thighs=slowhigh 
else 
 thighs=high
endif
if low>slowlow then 
 tlows=slowlow
else
 tlows=low
endif 
if high<fasthigh then 
 thighf=fasthigh
else
 thighf=high
endif 
if low>fastlow then 
 tlowf=fastlow
else
 tlowf=low
endif

if close>slowln[1] then 
 slowln=tlows
else
 slowln=thighs
endif
if close>fastln[1] then 
 fastln=tlowf
else
 fastln=thighf
endif

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

if trend<>trend[1] then
 if trend=0 then
  r=30
  g=144
  b=255
 else
  r=200
  g=20
  b=60
 endif
 drawtext("●",barindex,fastln,Dialog,Bold,10) coloured(r,g,b)
endif
drawcandle(open,high,low,close) coloured(168,168,168)
if trend=0 then 
 if close>slowln then
  drawcandle(open,high,low,close) coloured(30,144,255)
 endif
elsif trend=1 then 
  if close<slowln then 
   drawcandle(open,high,low,close) coloured(200,20,60)
  endif
endif


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

 

Download
Filename: PRC_PerfectTrendLine-2.itf
Downloads: 1312
Nicolas
Nicolas Legend
I created ProRealCode because I believe in the power of shared knowledge. I spend my time coding new tools and helping members solve complex problems. If you are stuck on a code or need a fresh perspective on a strategy, I am always willing to help. Welcome to the community!
Author’s Profile

Comments

simmerseb
2 years ago
#

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

Pensera
5 years ago
#

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
5 years ago
#

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

Manu L.
5 years ago
#

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

Manu L.
5 years ago
#

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

Manu L.
5 years ago
#

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
5 years ago
#

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

wtf_trading
5 years ago
#

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

maxlys
5 years ago
#

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.
5 years ago
#

// --- 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]

Manu L.
6 years ago
#

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

Nicolas
6 years ago
#

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.

Manu L.
6 years ago
#

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
6 years ago
#

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

Manu L.
6 years ago
#

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
6 years ago
#

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

Manu L.
6 years ago
#

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
6 years ago
#

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

Hans63
6 years ago
#

This is one of the best indicator ever made Congrats!

Manu L.
6 years ago
#

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 :-)

Manu L.
6 years ago
#

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 !?

Manu L.
6 years ago
#

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

Nicolas
6 years ago
#

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.

groen200
6 years ago
#

Have you please a backtest for this indicator "perfecttrenline-2"

GPTrader64
6 years ago
#

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

MauroPro
6 years ago
#

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

MauroPro
6 years ago
#

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
6 years ago
#

these variables are assigned between lines 39 to 48

MauroPro
6 years ago
#

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

marouaneayad
6 years ago
#

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"

ProRealCode ProRealCode
Loading...