TrendNoTrend Indicator

TrendNoTrend Indicator

The “Linear regression slope” indicates the direction and intensity of the current trend.
In the abstract hypothesis of total absence of trend the slope of the linear regression is equal to zero: the linear regression is a line parallel to the abscissa axis.
A statistical way of establishing that there is no trend, and so we are in a laterality phase of the market, consists in establishing that the slope of our linear regression is statistically equal to zero in the observation period.
To do this in statistics we use the “t-test”.
For all those who love statistical problems I attach the pdf files with the related explanations.
The statistical formula is translated into the following code.
In a normal distribution, 95% of the data is included in a confidence interval of “Average + – 1.96”.
A “t-distribution” with infinitely many degrees of freedom is a normal distribution.
With an approximation we can state that if    t <= 1.96  then our LinearRegressionSlope is equal to zero = there is no trend.

 

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. Pepsmile • 09/16/2018 #

    Hi FULVI,
    Interesting. But seems to take into account only bull trend.

  2. Jan Wind • 09/16/2018 #

    Dear Fulvio09,

    The concept of calculating trend or no trend attracts me much.

    First question: the linear regression slope indicator itself gives already the strength of the trend in itself, what does your calculation add to this ?

    If I compare the graph of the standard linear regression slope indicator with your indicator, and plotting your defined t-values as indicator, (instead of making them 0 or 1), the t-values seems just a multiplication of the linear regression slope values.
    Therefore my second question: could you explain your formula shortly per item, why it is used , and with a consistent number example ? (For example one of the items STD[AA](Barindex) why is this used ?)
    Maybe the standard indicator R2 can be used ?

    Thanks in advance, Jan

    • FULVIO09 • 09/16/2018 #

      I try to answer even if, not being a statistic, it is not easy for me to do it, and even more in these few lines.
      The “t-test” is used in statistics to compare two groups of data.
      Basically it compares the difference between the mean of two groups, considering the desperation of the data (expressed as standard deviation).
      The result “t” of the “t-test” is compared to a table of the values of the “t-test” (see: ” https://www.itl.nist.gov/div898/handbook/eda/section3/eda3672.htm ” ).
      In the table for each degree of freedom (first column of the table) you will find next to, the values corresponding to the probability you want to check.
      If you compare, for example, two groups with 10 data each, the degrees of freedom are 10 + 10 – 2 = 18.
      If you compare a large number of data (degrees of freedom> 100 to infinity) (last row of the table) you find that for a value of t <1.96 there is a 95% probability that the two groups of data are equal.

      The "t-test" formula applied to the specific case of "slope of a regression line" can be found at the end of the attached "t-test" pdf file.
      In essence it compares the difference between the slope of two linear regressions considering the dispersion of data (expressed as "standard error of the slope coefficient").
      I suggest you to watch: " https://www.youtube.com/watch?v=j5oPzAJvnVI " you will need to understand why the standard error is also influenced by "STD [AA] (Barindex)".

  3. cfta • 09/16/2018 #

    Hi Fulvio, many thanks for sharing this clever indicator, much appreciated. As Pepsmile mentioned it seems that it only accounts for bull trend and ignores bear trend, I modified it in order to include the bear trend. 1 = bull trend, 0 = no trend and -1= bear trend. Enjoy!

  4. cfta • 09/16/2018 #

    Sorry adding the PRT to code didn’t work in the above comment so I guess we will have to settle for regular text format…

    // period da ottimizzare
    AA = period
    t=(LinearRegressionSlope[AA](close)-0)*SQRT(AA-2)/(STE[AA](close)/STD[AA](Barindex))
    if t>1.96 then
    beta=1
    endif

    if t<-1.96 then
    beta=-1
    endif

    if t-1.96 then
    beta=0
    endif

    return beta

  5. juanj • 09/16/2018 #

    Something appears to be wrong with this formula as graphing t shows t to almost never be within the -2 to + 2 range. The only reason I believe the author sees extended periods of beta = 0 is due to the fact that he is including bearish linear regression < -1.96 as beta = 0

avatar
Register or

Likes

avatar avatar avatar avatar avatar avatar avatar avatar avatar
Related users ' posts
Nicolas
7 years ago
Maxime Baudin Interesting, Thank you! :)
franck-david Bonjour Nicolas , actuellement je me forme grace a vos videos tres tres bien expliques mer...
Nicolas Merci. ça n'est pas le lieu pour poser ce genre de question :) Merci d'utiliser le forum Pro...
Nicolas S11 variable is not a loop but a ratio calculation. In real time the codes is processed on e...
Stephan_V Nicolas, This regression delivers damn good results, especially for trends ! I'm wonde...
Nicolas Least square method is used here in order to get the perfect y = ax2 + bx + c
gabri Brined :) look on this indicator how on the 6th and on the 9th you have very high positive s...
Pepsmile Hi everybody, An application could be found by applying this indicator on the strategy prof...
zilliq Thanks for your indicator Gabri but are you sure for your code because on EUR/USD for exampl...
Canale di Fill By Filippo si si... farò un video a breve
AngelPujalt ok. Gracias.
Stenozar Hi Filippo, any news about your video to explain how to use this indicator? thanks
Vonasi Discussion on this indicator/filter can be found here: https://www.prorealcode.com/topic/121...
Domenec Claro Juanjo de todas maneras en deinversoratrader.com tienes estsos osciladores evolucionad...
Dron Hola Domenec, en la descripción hablas del indicador velas de colores, no lo encuentro en la...
Domenec Hola Dron mira en el blog deinversoratrader.com en formacion indicadores ahi hay varios grat...
Marcot18 Buonasera Maurinho, interessante l'indicatore che ha i proposto ma ancora di più interessant...
maurinho ciao marcot18 l'indicatore pubblico /proffessional lo puoi scaricare si chiama progo di will...
james effiong This strategy looks good
Geronima Ortiz I watched the video three times, but I can not put the npips parameter as a variable. I do...
Geronima Ortiz I think the video is for an old version of prorealtime, the images do not correspond at all ...
Nicolas indicator1 = CALL “PRC_StopReversal”[npips, 1] and define npips in the optimization window ...
Rafa And the PriceMAPeriod? aren´t the same?
Nicolas The PriceMAPeriod is the period to make the average of all the last X medianprice found.
Rafa Thanks a lot Nicolás. Have a nice day
Caribeengeek Bonjour j’avais vu que vous proposiez d’écrire des codes pour ceux qui s’y connaisse pas Mai...
Caribeengeek Les devises unité
Nicolas Merci d'utiliser le forum pour les demandes de programmation personnalisée
ullle73 nicolas, can you somehome make this to be in the background of the price chart?
jonpt88 none did that yet right?
Nicolas You can ask for a code modification on forums, please open a new topic with your request.
Toto le Heros Thanks Nicolas. I read somewhere that in the calculation, we should round the value of the A...
Nicolas aADX = round(adx[10])
bolsatrilera
7 years ago
Rainbow Oscillator
Rainbow Oscillator
1
Indicators
Maxime Baudin Interesting, thanks! Combine this indicator with the bollinger bands there is enough to make...
supertiti Bonsoir à tous For those who like me want to calibrate this indicator on a scale of 0 to ...
verdi55 You can find me at www.FXautomate.com Ahh. So i got it ? 4 different supertrends without th...
juanj What? This has nothing to do with the website. The site is simply a service to help people ...
Nicolas Advertising is allowed,as long as people are helping others and if provided services are abo...
styrke Hello Nicolas, Nice screener, I appreciate the way you always try to condense at maximum th...
Nicolas There's no particular reason. RSI is widely use with its default period and results seems re...
Vonasi I noticed a couple of typo errors in the code. The list of variables lines 4 to 11 should be...
Genotik Thank you for your important contribution this week which is much appreciated! Happy New Yea...
Vonasi No problem. I hope they are useful to someone. Happy and hopefully prosperous New Year to y...

Top