TreL – Linear Regression Trend

v10.3
TreL – Linear Regression Trend

This indicator based on linear regression trend.
Blue line is a positive trend or buy/bullish trend. Red line trend is a negative trend or sell/bearish trend.

Upper and lower channel lines (in grey color) can be used as trailing stop or possible rebound of the price (revert to the mean).

Very simple and effective way to use linear regression in a different approach.

Converted from pinescript version as requested in this topic: https://www.prorealcode.com/topic/conversion-of-a-linear-regression-trend-indicator/

(all credits go to original author).

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. Paolo.B • 04/18/2021 #

    Hi Nicolas thanks … I’m new to programming I would like to use it with blue +1 and red -1 graph to try to code it for a strategy.
    Thank you
    I deleted this part.
    band = average [length] (AverageTrueRange [1] (close)) * 2
    endif
    Unfortunately I am unable to attach an image

    • Nicolas • 04/18/2021 #

      change the last line with: return v coloured(r,g,b) style(line,2), v+band coloured(168,168,168), v-band coloured(168,168,168), r
      and test if “r” is superior to 0, if it is the case, then the line is red and therefore the trend bearish.

  2. Paolo.B • 04/18/2021 #

    Thanks … works as i wanted.

  3. Kanamax • 279 days ago #

    Bonjour Nicolas, comme Paolo.B je souhaiterais utiliser cette indicateur au sein d’un code. Après avoir copier/coller le code ci dessus j’ai rajouté ceci:

    // Conditions pour ouvrir une position acheteuse
    if not onmarket and b=255 then
    BUY 1 CONTRACTS AT MARKET
    endif

    // Conditions pour fermer une position acheteuse
    if longonmarket and b=0 then
    SELL AT MARKET
    ENDIF

    Malheureusement les positions acheteuses sont beaucoup peu nombreuses et ne suivent pas du tout le fait d’acheter à chaque fois que la courbe est bleue.

    Un conseil pour finir le code correctement?
    Merci d’avance.

    Hi Paolo.B, I have some difficulties to do as you. It seems that works for you, could you share your code to compare coding?

    Thank you in advance.

avatar
Register or

Likes

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

+3 more likes

Related users ' posts
mikechan883 Thanks so much for your great help! May I ask you for further favor? Can you show me how to...
adconsulting SCUSA . ECCO IL CODICE defparam cumulateorders = true // false is working well once ord...
wally Hola soy nuevo en el mudo robots. Alguien seria tan amable de poner el archivo itf.file ya q...
Darren Nash I found this works well on the DOW
Sever
3 months ago
KAMJKAZE thanks, really interesting!
2c95 thanks, why do U prefer average than lowest ? to close under average does'nt mean another...
Stenozar Hi Sever, how can I visualize the coloured areas?
Sever Hi Stenozar, You need to add the color zones yourself , just go to Add Color Zone To set ...
atlante hi nicolas this indicator have 2 wrong borderline and islalastbarupdate. thank you can you h...
Nicolas That'"s because you are not using PRT v11? Just remove lines 59 to 62
Kanamax Hi Roberto, sorry for my confusing previous posts (forget them). My request is very simple,...
robertogozzi Please start a new topic in ProOrder support.
robertogozzi If MagicTrend <> MagicTrend[1] then it's Green or Red
raffa58 Buonasera Roberto, ho provato ad usare questo indicatore inserendo l'istruzione di cui sopr...
Leo_da_Pisa A really nice indicator. Can easily be used as a strategy. I've tried a few trend indicators...
kats Bonjour, j'ai essayé de faire afficher cet indic en temps 5 mn sur le 1 mn et c'est Hiroshim...
Nicolas Il suffit d'ajouter l'instruction TIMEFRAME(5 minutes,updateonclose) en tête du code
diegofe_2000 cordial saludo Nicolas, una pregunta senciLla : Como coloco un STOPS en un maximo o un mini...
Boris Hi IVMcm, thanks for your amazing work. I have tested all of your indicators and use some of...
IV Mcm With pleasure and thanks!
ashiash how to use this indicator can i use tradingview platform
zilliq Thanks @Nicolas. I tried to use it as Trend in a proorder system, but don't know why, it doe...
Suzu Yuk He is right. MT and mavgMT are not defined and causing errors.....
Maxime Baudin Super travail !
Yanic c'est top j'adore
Maxime Baudin Merci l'ami, passe une bonne semaine
IV Mcm Merci de même ;)
Emperor.it "style(line,2)" C'è una guida ai parametri che si possono modificare ? Tipo stile della lin...
IV Mcm https://www.prorealcode.com/programming-with-prorealtime/
Daniele Maddaluno Écrivez-moi où vous préférez you can easily find me on LinkedIn
AK27 C'est payant visiblement sur linkdin je peux pas vous envoyer, discord vous avez ?
Nicolas C'est dans ce sujet: https://www.prorealcode.com/topic/trendline-une-approche-du-trading/ M...
Pensera Bonjour Nicolas, comment est-il possible de backtester cet indicateur? cela fait une erreu...
Nicolas Oui bien sûr, il doit y avoir pas mal de sujets dans le forum à ce propos.

Top