On each bar it creates a channel by highest/lowest point of a MA. highest point is upper line and lowest point is lower line of the MA channel,
It gets highest and lowest point of last 300 bars, (say Price Channel )
If the width of MA channel is greater than certain rate of price channel then it decides there is trend
After it decided there is trend, it calculates the rate between channel and MA. Bigger result means stronger trend.
According to rate of MA channel and the price channel , MA Line becomes lighter/darker. so when you look at the MA Line’s color you can see the trend strength.
You can choose each of the available default MA type of the platform as source.
“Period to Check Trend” is the period to create MA channel. Bigger period cause more sensitivity.
“Trend Channel Rate %” is rate of price channel . Price channel created by using highest/lowest of last 300 bars. I did this to make the script works on all time frames correctly.
“Use Linear Regression” is used to get rid of noise. it may cause 1-2 bars latency.
(description from the original author LonesomeTheBlue, all credits go to him). Indicator converted from pinescript with some adaptation to make it works with ProRealTime.
This indicator only works on PRTv11 onwards.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
//PRC_TrendFollowingMvingAverage | indicator //20.04.2020 //Nicolas @ www.prorealcode.com //Sharing ProRealTime knowledge //converted from Pinescript version // --- settings prd = 20 //Period to Check Trend rateinp = 1 //Trend Channel Rate % minval = 0.1, step = 0.1 ulinreg = 1 // 1=true, Use Linear Regression linprd = 10 //Linear Regression Period, minval = 2 matype = 1 //ma type 0=sma, 1-ema, etc. // --- end of settings rate = rateinp / 100 pricerange = highest[300](close) - lowest[300](close) chan = pricerange * rate p = 5 while p<=100 do //trend masrc = average[p,matype](close) if ulinreg then ma = LinearRegression[linprd](masrc) else ma = masrc endif hh = highest[prd](ma) ll = lowest[prd](ma) diff = abs(hh-ll) if diff>chan then if ma>ll+chan then trend=1 elsif ma<hh-chan then trend=-1 else trend=0 endif else trend=0 endif ret = trend*diff/chan alpha = min(255,(80+abs(ret*10))) if ret<0 then r=255 g=0 else r=0 g=255 endif iprev=$prev[p] drawsegment(barindex,ma,max(0,barindex-1),iprev) coloured(r,g,0,alpha) $prev[p] = ma p=p+5 wend return |
Share this
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 :PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials
Hi Nicolas,
Every time I download and import an indicator into my chart, I get the indicator at the bottom of my chart instead of on my price chart. Am I doing something wrong?
I use V11.1
Just add it on the price.
Good afternoon Nicolas,
Could you hint me how I become version 11 of PRT ? (I believe I missed that one . . )
And when will it be available in production ?
Thanks in advance.
v11 is out since months, for free: https://www.prorealtime.com
or with a trading account with IB, see the options available here: https://trading.prorealtime.com/en/InteractiveBrokers
Jag får felkod på rad 56?
This indicator only works on PRTv11 onwards.
If you start PRT via your trading account at IG.com, the PRT version 11 is not available yet, but their IT department is working on it to make it available,
Hello Nicolas, is it possible to make a backtest with this moving average? For example “if trend = red then sellshort”.
Yes why not?
I´m wondering which parameter decides the color of the average? Is the color decided by the “trend” input?
And also, the boolean “ulinreg” messes up the backtest, how do I define it?
Hello Nicolas, it’s possible to make screener with this indicator ? Thanks a lot
Yes that’s possible.
I would like a screener that highlights the color change of the indicator (from red to green and vice versa).
Can you help me?
Thanks again Nicolas
Sure, please open a new topic in the indicator forum to ask your specific query, describe it as precisely as possible. Respect the posting rules too please.
Ok Nicolas apro il topic su “Supporto ProScreener” in italiano
Just done Nicolas https://www.prorealcode.com/topic/screener_trend-following-moving-averages/
Pourriez-vous nous proposer une version adaptée pour PRT V13.0 , ou nous préciser les instructions à remplacer ou modifier ou supprimer , dans le cas où cela est possible , pour effectuer cette adaptation ?
Merci .
Erratum : je veux parler de la version V10.3 , bien sur …
P.S : IG , que j’ai contacté ,m’indique que la version V11 , ne sera pas disponible avant un certain temps ..
Dear Nicolas,
is there someting at the arry to modify in order to run the trend at the actual PRT version?
Bset regards
Hasardeur
Dear Nicolas,
just try touse your indicator with backtest but it’s not working.
is anybody reach to use it?
regards