Trend Impulse with Range Filter

Category: Indicators By: Ichimoku Reading Created: October 30, 2020, 8:37 AM
October 30, 2020, 8:37 AM
Indicators
5 Comments

Following the creation of the Range Filter indicator coded by Nicolas, I wished to re-adapt the code to make it available on PRT 10.3

I find this indicator particularly interesting, I wanted to add a filter to the Range Filter ‘-‘.

As an external variable, you will find the values corresponding to the color code to modify it as you wish via a site with a color code.

IV

//
//=/===============/=//=/===============/=//=/ Indicator Range Trend
//

// RxUP = 0
// GxUP = 153
// BxUP = 255

// RxDOWN = 102
// GxDOWN = 102
// BxDOWN = 102

// RxRange = 199
// RxRange = 29
// RxRange = 29

//
//=/===============/=//=/===============/=//=/ Range
//

//=/ Range Settings
once rngfilt=close

if barindex>max(14,27) then
rngscale=max(1,min(rngscale,7))

scale = 2.618*average[14,1](abs(close-close[1]))

endif

r=average[27,1](scale)

hh=close
ll=close
if 1<>1 then
hh=high
ll=low
endif
if 1=1 then
if hh>rngfilt[1] then
if (hh-r)<rngfilt[1] then
rngfilt=rngfilt[1]
else
rngfilt=hh-r
endif
elsif (ll+r)>rngfilt[1] then
rngfilt=rngfilt[1]
else
rngfilt=ll+r
endif
else
if hh>=rngfilt[1]+r then
rngfilt=(rngfilt[1]) + (abs(hh - (rngfilt[1]))/r)*r
elsif ll<=rngfilt[1]-r then
rngfilt=(rngfilt[1]) - (abs(ll - (rngfilt[1]))/r)*r
else
rngfilt=rngfilt[1]
endif
endif

hiband    = rngfilt + r
loband    = rngfilt - r

if rngfilt>rngfilt[1] then
upward=1
downward=0
endif
if rngfilt<rngfilt[1] then
upward=0
downward=1
endif

TrendFast = rngfilt
TrendMedium = Average[2](rngfilt)
TrendLong = Average[4](rngfilt)

//
//=/===============/=//=/===============/=//=/ Trend Color
//

//=/ Trend Fast Color Settings
if upward and TrendFast > TrendFast[1] then
cr = RxUP
cg = GxUP
cb = BxUP
ct = 250

elsif downward and TrendFast < TrendFast[1] then
cr = RxDOWN
cg = GxDOWN
cb = BxDOWN
ct = 250

elsif TrendFast = TrendFast[1] then
cr = RxRange
cg = GxRange
cb = BxRange
ct = 250

endif

//
//=/===============/=//=/===============/=//=/ Candle
//

//=/ Bullish Conditions 1
U1 = upward > 0
U2 = close > TrendFast
U3 = close > TrendLong
U4 = close > TrendMedium
U5 = TrendFast > TrendFast[1]
U6 = TrendLong > TrendLong[1]
U7 = TrendMedium > TrendMedium[1]
BullishConditions1 = U1 and U2 and U3 and U4 and U5 and U6 and U7

//=/ Bullish Conditions 2
UX1 = upward > 0
UX2 = close > TrendFast
UX3 = close > TrendLong
UX4 = close > TrendMedium
UX5 = TrendFast = TrendFast[1]
UX6 = TrendLong > TrendLong[1]
UX7 = TrendMedium > TrendMedium[1]
BullishConditions2 = UX1 and UX2 and UX3 and UX4 and UX5 and UX6 and UX7

//=/ Bullish Conditions 3
UXX1 = upward > 0
UXX2 = close > TrendFast
UXX3 = close > TrendLong
UXX4 = close > TrendMedium
UXX5 = TrendFast = TrendFast[1]
UXX6 = TrendLong > TrendLong[1]
UXX7 = TrendMedium = TrendMedium[1]
BullishConditions3 = UXX1 and UXX2 and UXX3 and UXX4 and UXX5 and UXX6 and UXX7

//=//=//

//=/ Bearish Conditions 1
E1 = downward > 0
E2 = close < TrendFast
E3 = close < TrendLong
E4 = close < TrendMedium
E5 = TrendFast < TrendFast[1]
E6 = TrendLong < TrendLong[1]
E7 = TrendMedium < TrendMedium[1]
BearishConditions1 = E1 and E2 and E3 and E4 and E5 and E6 and E7

//=/ Bearish Conditions 2
EX1 = downward > 0
EX2 = close < TrendFast
EX3 = close < TrendLong
EX4 = close < TrendMedium
EX5 = TrendFast = TrendFast[1]
EX6 = TrendLong < TrendLong[1]
EX7 = TrendMedium < TrendMedium[1]
BearishConditions2 = EX1 and EX2 and EX3 and EX4 and EX5 and EX6 and EX7

//=/ Bearish Conditions 3
EXX1 = downward > 0
EXX2 = close < TrendFast
EXX3 = close < TrendLong
EXX4 = close < TrendMedium
EXX5 = TrendFast = TrendFast[1]
EXX6 = TrendLong < TrendLong[1]
EXX7 = TrendMedium = TrendMedium[1]
BearishConditions3 = EXX1 and EXX2 and EXX3 and EXX4 and EXX5 and EXX6 and EXX7

//=/ Candle Color Settings
if BullishConditions1 then
br = RxUP
bg = GxUP
bb = BxUP
tz = 250

elsif BullishConditions2 then
br = RxUP
bg = GxUP
bb = BxUP
tz = 200

elsif BullishConditions3 then
br = RxUP
bg = GxUP
bb = BxUP
tz = 150

//=//=//

elsif BearishConditions1 then
br = RxDOWN
bg = GxDOWN
bb = BxDOWN
tz = 250

elsif BearishConditions2 then
br = RxDOWN
bg = GxDOWN
bb = BxDOWN
tz = 200

elsif BearishConditions3 then
br = RxDOWN
bg = GxDOWN
bb = BxDOWN
tz = 150

//=//=//

else
br = 204
bg = 204
bb = 204
tz = 150
endif

drawcandle(open,high,low,close) coloured(br,bg,bb,tz)

//
//=/===============/=//=/===============/=//=/ Visual
//

//=/ Visual Settings
MIDX1 = (hiband-rngfilt)/3
MID1 = (rngfilt+MIDX1)
MID2 = (MID1+MIDX1)

MIDX2 = (rngfilt-loband)/3
MID3 = (rngfilt-MIDX2)
MID4 = (MID3-MIDX2)

//
//=/===============/=//=/===============/=//=/ End
//

return TrendFast coloured (cr,cg,cb,ct) style(line,2) as "Trend Fast"     ,     MID1 coloured (RxDOWN,GxDOWN,BxDOWN,30) style(line,1) as "MID1"     ,     MID2 coloured (RxUP,GxUP,BxUP,30) style(line,1) as "MID2"     ,     MID3 coloured (RxDOWN,GxDOWN,BxDOWN,30) style(line,1) as "MID3"     ,     MID4 coloured (RxUP,GxUP,BxUP,30) style(line,1) as "MID4"     ,     hiband coloured (RxUP,GxUP,BxUP,30) style(line,1) as "Hiband"     ,     loband coloured (RxUP,GxUP,BxUP,30) style(line,1) as "Loband"

Download
Filename: Trend-Impulse.itf
Downloads: 466
Ichimoku Reading Master
------------------------------------Participating Encoder-----------------------------------
Author’s Profile

Comments

Logo Logo
Loading...