Trend Risk Bands indicator

Category: Indicators By: Nicolas Created: May 29, 2017, 1:57 PM
May 29, 2017, 1:57 PM
Indicators
4 Comments

The TrendRisk bands indicator is a simple channel indicator made of 2 custom averages of candlesticks ranges calculated within the variable “BandsBars” period.

Upper and lower channel bands width can be adjusted with the “Deviation” variable, which act as a simple factor to enlarge the spread between them.

  • When Close crosses over the upper band, it is a bullish signal and candlesticks are painted in green
  • When Close crosses under the lower band, it’s a bearish signal and candlesticks are painted in red

Indicator converted from MT4 version by a request on the french forum.

//PRC_Trend Risk indicator | indicator
//29.05.2017
//Nicolas @ www.prorealcode.com
//Sharing ProRealTime knowledge
//translated from MT4 code

// --- settings
//BandsBars=28
//Deviation=3.5
// --- end of settings

once SmoothPrice=close
once SmoothRange=range

if barindex>1 then
 SmoothPrice=(SmoothPrice[1]*(BandsBars-1)+Close)/BandsBars
 SmoothRange=(SmoothRange[1]*(BandsBars-1)+High-Low)/BandsBars

 Top=SmoothPrice+SmoothRange*Deviation
 Bottom=SmoothPrice-SmoothRange*Deviation
endif

T=1
D=1
N=1

if (Close< Top) then
 T=0
endif
if (Close> Bottom ) then
 D=0
endif
if ( Close <  Bottom or Close> Top ) then
 N=0
endif

if (T= 1) then
 r=0
 g=255
 b=0
endif
if (D= 1) then
 r=255
 g=0
 b=0
endif
if (N= 1) then
 r=150
 g=150
 b=150
endif
DRAWCANDLE(open,high,low,close)coloured(r,g,b)

RETURN Top as "Top channel", Bottom as "Bottom channel"

 

Download
Filename: trend-risk-indicator-prorealtime-1.png
Downloads: 74
Download
Filename: PRC_Trend-Risk-Indicator.itf
Downloads: 267
Nicolas Master
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

Logo Logo
Loading...