Here is the code to color the background according to the trend.
I made it slightly transparent with alpha set at 100 (range is 0-255) at line 101.
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
//PRC_RevertSignal Three Line Break | indicator
//22.06.2017
//Nicolas @ www.prorealcode.com
//Sharing ProRealTime knowledge
//translated from Nanotrader
if barindex = 1 then //barindex
if (close >= open ) then
xtrend = 1
trend = xtrend
xu = close
xu1 = open
xu2 = open
xu3 = open
CL = xu
OP = xu1
LL = OP
HH = CL
else
xtrend = - 1
trend = xtrend
xu = close
xu1 = open
xu2 = open
xu3 = open
CL = xu
OP = xu1
LL = CL
HH = OP
endif
else //barindex continue
if (xtrend = 1 ) then
if (close > xu) then
trend = xtrend
xu3 = xu2
xu2 = xu1
xu1 = xu
xu = close
CL = xu
OP = xu1
LL = OP
HH = CL
elsif (close < xu3) then
xtrend = - 1
trend = xtrend
xu = close
xu2 = xu1
xu3 = xu1
CL = xu
OP = xu1
LL = CL
HH = OP
else
trend = xtrend
CL = CL[ 1 ]
OP = OP[ 1 ]
LL = LL[ 1 ]
HH = HH[ 1 ]
endif
else //xtrend <>1
if (close > xu3) then
xtrend = 1
trend = xtrend
xu = close
xu2 = xu1
xu3 = xu1
CL = xu
OP = xu1
LL = OP
HH = CL
elsif (close < xu) then
trend = xtrend
xu3 = xu2
xu2 = xu1
xu1 = xu
xu = close
CL = xu
OP = xu1
LL = CL
HH = OP
else
trend = xtrend
CL = CL[ 1 ]
OP = OP[ 1 ]
LL = LL[ 1 ]
HH = HH[ 1 ]
endif
endif
endif
if trend> 0 then
r= 0
g= 200
b= 0
else
r= 200
g= 0
b= 0
endif
BACKGROUNDCOLOR (r,g,b,50 )
RETURN CL coloured (r,g,b), xu3 coloured (r,g,b)
1 user thanked author for this post.