This is my interpretation of Bloomberg's Trender.
The script is derived from this document:
I have no idea what settings are best. I like the ones I have used because I see some harmony with the
20ema but that could be said for a variety of settings. The chief variable for adjustment is "sensitivity" which is really just the number of standard deviations away from the midpoint calculation. The Trender is plotted as crosses.
Also the moving average will be green if its own 8 period moving average is below the
moving average or red if it is above. In other words a Green moving average suggests an uptrend and a red moving average a down trend as far as moving averages are concerned. In formatting you can have an or at the click of a button. also at the bottom you will have an option to display moving averages as emas in intraday and smas if the period is daily or higher. In this option you will also see the 50 moving average ( if intraday and if daily or more.) Most people will opt for consistency and simply use either an or . In this case leave the
"Show EMAs intraday and smas interday" unchecked.
//The Trender and moving average for trend analysis // This is my interpretation of Bloombergs Trender. // The script is derived from a few limnes in this this document: // //http://www.forexfactory.com/attachment.php?attachmentid=704677&d=1306114269 // I have no idea what settings are best. // The the moving average will be green if its own 8 period moving average is below the // moving average or red if it is above. Green suggests an uptrend and red a down trend // as far as moving averages are concerned. // As well there is a moving average either 20 ema or 20 sma. // The averaging period is adjustable. study("Trender & mov avg Jayy", overlay=true) showTrndr= input(true, title= " Show The Trender?") EMP = input (8, title = "Length of midpoint (hl2) ema for Trender ") EATR = input (9, title = "Length of EMA ATR for Trender") EATRsd = input (8, title = "Length of Std Deviation for Trender") multsd = input(3,minval=.2, title="multiple of std deviation for Trender" ) smas20=input(true, title="Show 20 period moving average") smas8=input(false, title=" Show signal line (8 period) of 20 period moving average") THEMA=input(true, title=" check for EMA with ema signal line uncheck for sma?") //THESMA=input(false, type=bool, title="Show SMA with sma signal line?") lenei = input (20, title="period for ema") lenei_ema = input (8, title="period for signal line of the ema") lensd = input (20, title=" period for sma ") lensd_sma = input (8, title="period for signal line of the sma") lene50 = input (50, title="intraday period longest ema - intraday ema") lens50 = input (50, title=" interday period longest sma - interday sma") LWMA=input(false, type=bool, title=" Show EMAs intraday and smas interday") smas50=input(true, type=bool, title=" Show 50 period moving average if box above checked") TRperiod = tr(false) ADMl= ema(hl2,EMP) + ema(TRperiod,EATR)/2 ADMs=ema(hl2,EMP)- ema(TRperiod,EATR)/2 //Avgtr=stdev(ema(TRs,EATR),EATRsd) hibndfr = ADMl + stdev(ema(TRperiod,EATR),EATRsd)* multsd lobndfr= ADMs - stdev(ema(TRperiod,EATR),EATRsd)* multsd lobnd=close>nz(lobnd)? max(lobndfr,nz(lobnd)) :lobndfr hibnd=close<nz(hibnd)? min(hibndfr,nz(hibnd)) : hibndfr trendtr = close> nz(hibnd) ? 1: close< lobnd? -1: nz(trendtr,1) Trender = trendtr==1? lobnd: hibnd crosscolortr = trendtr==1? green:red plot(showTrndr?Trender:na, color= crosscolortr , style=cross, linewidth=2,title="Trender for current period") dcresevol= volume< nz(volume) and volume < nz(volume)? true:false weakbar= dcresevol and close> nz(close)?true:false strongbar= dcresevol and close< nz(close)?true:false // plotchar( weakbar? high:na, title= "weakbar", char= '❄', location= location.abovebar, color= red) //close>supttr and // plotchar( strongbar? low:na, title= "strengthbar", char= '❄', location= location.belowbar, color= green) // close>supttr and emaintra= ema(close, lenei) sma_emaintra= sma(emaintra, lenei_ema) emainter= sma(close, lensd) sma_emainter= sma(emainter, lensd_sma) emaintrai= ema(close, lene50) emainterl= sma(close, lens50) plot ((LWMA and isintraday) ?emaintra:LWMA or THEMA==false?emainter:THEMA?emaintra:na, color= smas20 and emaintra>sma_emaintra?green:smas20 and emaintra<=sma_emaintra?red: smas20 and emainter>sma_emainter?green:smas20 and emainter<=sma_emainter?red:na, title="moving avg of closes",linewidth=2) plot ((LWMA and isintraday) ?sma_emaintra: LWMA or THEMA==false?sma_emainter:THEMA?sma_emaintra:na, color=smas8?fuchsia:na, title="s moving avg of longer moving avg ") plot ((LWMA and isintraday)?emaintrai:LWMA?emainterl:na, color= smas50? blue:na, title="longeest moving avg ")