-
Notifications
You must be signed in to change notification settings - Fork 14
/
Cloud.pine
348 lines (297 loc) · 22.1 KB
/
Cloud.pine
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © FxCloudTrader
//@version=5
indicator('Ichimoku Cloud', 'Cloud', overlay=true)
//-------------------- parameters --------------------
atr = ta.atr(14)
offset_atr_arrow = 0.2
//---------------- functions ----------------
GetCorrectTickValue(value) =>
pipSizeCalc = (syminfo.type == "forex" ? syminfo.mintick * 10 : 1)
value / pipSizeCalc
getMidPoint(__len, __offset) =>
MidPointOffset = math.avg(ta.lowest(__len)[__offset], ta.highest(__len)[__offset])
getKijun(__symbol, __len, __timeframe, __offset=0)=>
__k_request = getMidPoint(__len, __offset)
k = request.security(__symbol, __timeframe, __k_request)
getTankan(__symbol, __len, __timeframe, __offset=0)=>
__k_request = getMidPoint(__len, __offset)
k = request.security(__symbol, __timeframe, __k_request)
getSenkou_spanA(__symbol, __timeframe, __conversionLine, __baseLine)=>
__k_request = math.avg(__conversionLine, __baseLine)
k = request.security(__symbol, __timeframe, __k_request)
getSenkou_spanB(__symbol, __timeframe, __senkou2Periods)=>
__k_request = getMidPoint(__senkou2Periods, 0)
k = request.security(__symbol, __timeframe, __k_request)
getCloudDirectionMultiTF(__symbol, __timeframe, __offset=0)=>
__c_request = getMidPoint(26, __offset)
c = request.security(__symbol, __timeframe, __c_request)
setLocationByATR(con_dn, con_up, offset) =>
float con_dn_loc1 = na
if con_dn
con_dn_loc1 := high + offset * atr
float con_up_loc1 = na
if con_up
con_up_loc1 := low - offset * atr
[con_dn_loc1, con_up_loc1]
//---------------- functions ----------------
var grp1 = "Ichimoku Cloud"
bool display_ichimoku = input.bool(true, 'Enable Ichimoku Cloud', group = grp1)
bool display_chikou_span = input.bool(true, 'Enable Chikou Span', group = grp1)// Default is off, as it can be messy if otherwise
bool display_chikou_span_filter_by_kijun = input.bool(false, 'Enable Chikou Span when Kijun-sen changes direction', group = grp1)
bool display_kijun_arrow = input.bool(false, 'Enable Kijun Arrow', group = grp1)
bool display_tk_cross = input.bool(true, 'Enable Tenkan-sen and Kijun-sen crosses', group = grp1)
conversionPeriods = input.int(9, minval=1, title='Tenkan-Sen (Conversion Line) Periods')
basePeriodsK = input.int(26, minval=1, title='Kijun-Sen (Base Line) Periods')
Kijun = getMidPoint(basePeriodsK, 0)
//MODIFIED FROM OFFICIAL ICHIMOKU PINE SCRIPT
senkou2Periods = input.int(52, minval=1, title='Senkou Span 2 Periods', group = grp1)
_displacement = input.int(26, minval=1, title='Displacement', group = grp1)
conversionLine = getTankan(syminfo.tickerid, conversionPeriods, timeframe.period) //conversionLine = getMidPoint(conversionPeriods, 0)
baseLine = getKijun(syminfo.tickerid, basePeriodsK, timeframe.period)// baseLine = getMidPoint(basePeriodsK, 0)
leadLine1 = getSenkou_spanA(syminfo.tickerid, timeframe.period, conversionLine, baseLine) // math.avg(conversionLine, baseLine)
leadLine2 = getSenkou_spanB(syminfo.tickerid, timeframe.period, senkou2Periods) //getMidPoint(senkou2Periods, 0)
plot(display_ichimoku?conversionLine:na, color=color.new(color.fuchsia, 50), linewidth=4, title='Tenkan-Sen (Conversion Line)', style = plot.style_stepline)
plot(display_ichimoku?baseLine:na, color=color.new(color.blue, 20), linewidth=4, title='Kijun-Sen (Base Line)', style = plot.style_stepline)
plot(display_ichimoku?close:na, offset=-_displacement, color=color.new(color.white, 0), title='Chikou Span (Lagging Line)', style=plot.style_circles, linewidth=2, display = display_chikou_span? display.all: display.none)
p1 = plot(display_ichimoku?leadLine1:na, offset=_displacement, color=color.new(color.green, 50), title='Senkou Span (Lead 1)')
p2 = plot(display_ichimoku?leadLine2:na, offset=_displacement, color=color.new(color.red, 50), title='Senkou Span (Lead 2)')
fill(p1, p2, color=leadLine1 > leadLine2 ? color.new(color.green, 80) : color.new(color.red, 80))
//END OF OFFICIAL ICHIMOKU PINE SCRIPT
//Alert for Tenkan-sen and Kijun-sen crosses
alert_tk_cross_up = ta.crossover(conversionLine, baseLine)
alert_tk_cross_dn = ta.crossunder(conversionLine, baseLine)
alertcondition(condition=alert_tk_cross_up or alert_tk_cross_dn, title = "TKx Alert",
message="TK cross: {{ticker}} {{interval}} {{time}}")
alertcondition(condition=alert_tk_cross_up, title = "TKx Up Alert",
message="TK cross up: {{ticker}} {{interval}} {{time}}")
alertcondition(condition= alert_tk_cross_dn, title = "TKx Down Alert",
message="TK cross down: {{ticker}} {{interval}} {{time}}")
// if alert_tk_cross_up
// alert("TK cross up: {{ticker}} {{interval}} {{time}}", alert.freq_once_per_bar_close)
// else if alert_tk_cross_dn
// alert("TK cross down: {{ticker}} {{interval}} {{time}}", alert.freq_once_per_bar_close)
//End of alert for Tenkan-sen and Kijun-sen crosses
// Tenkan-sen and Kijun-sen crosses
bool con_up_tk = ta.crossover(conversionLine, baseLine)
bool con_dn_tk = ta.crossunder(conversionLine, baseLine)
// [con_dn_tk_arrow_loc, con_up_tk_arrow_loc] = setLocationByATR(con_dn_tk, con_up_tk, offset_atr_arrow)
// plotchar(con_up_tk_arrow_loc, title='TKx up', char = "⬆", location = location.absolute, color =color.new(color.black, 0), size = size.auto, display = display_ichimoku and display_tk_cross?display.all:display.none)
// plotchar(con_dn_tk_arrow_loc, title='TKx dn', char = "⬇", location = location.absolute, color =color.new(color.black, 0), size = size.auto, display = display_ichimoku and display_tk_cross?display.all:display.none)
plotshape(con_up_tk, title= "TKx up", style = shape.arrowup, location = location.belowbar, color = color.green, size = size.auto, display = display_ichimoku and display_tk_cross?display.all:display.none)
plotshape(con_dn_tk, title= "TKx dn", style = shape.arrowdown, location = location.abovebar, color = color.red, size = size.auto, display = display_ichimoku and display_tk_cross?display.all:display.none)
//Get the current direction of the TKx, 1 is bullish crosses, -1 is bearish crosses
var con_tk_current = 0
var con_tf_previous = 0
if con_up_tk
con_tk_current := 1
else if con_dn_tk
con_tk_current := -1
// else
// 0
var tk_signal_count = 0
if con_tk_current == con_tf_previous and con_tk_current == 1
tk_signal_count += 1
else if con_tk_current == con_tf_previous and con_tk_current == -1
tk_signal_count += -1
else
tk_signal_count := 0
con_tf_previous := con_tk_current
// End of Tenkan-sen and Kijun-sen crosses
//Kijun-sen arrows
int _curArrowDirection = if Kijun[0] - Kijun[1] > 0
1
else if Kijun[0] - Kijun[1] < 0
-1
var _existingArrowDirection = 0
int _newDirection = 0
if _curArrowDirection != _existingArrowDirection and _curArrowDirection != 0
_newDirection := _curArrowDirection
_existingArrowDirection := _curArrowDirection
bool _bChikouSpanLn = close[0] > close[_displacement]
bool _bChikouSpanSt = close[0] < close[_displacement]
cond_dn_arrow = _newDirection==-1
cond_up_arrow = _newDirection==1
[con_dn_arrow_loc, con_up_arrow_loc] = setLocationByATR(cond_dn_arrow, cond_up_arrow, offset_atr_arrow)
// I'm using plotchar instead to place arrows above or below Kijunsen, which saves space for other signals
// plotarrow(_newDirection, title='Kijun Arrow', colorup=color.new(color.black, 50), colordown=color.new(color.black, 50), minheight=15, maxheight=15)
plotchar(con_up_arrow_loc, title='Kijun Arrow', char = "⬆", location = location.absolute, color =color.new(color.black, 0), size = size.auto, display = display_ichimoku and display_kijun_arrow?display.all:display.none)
plotchar(con_dn_arrow_loc, title='Kijun Arrow', char = "⬇", location = location.absolute, color =color.new(color.black, 0), size = size.auto, display = display_ichimoku and display_kijun_arrow?display.all:display.none)
plot(_bChikouSpanLn and _newDirection== 1 and display_ichimoku ?close:na, offset=-_displacement, color=color.new(color.green, 0), title='Chikou Span Above', style=plot.style_linebr, linewidth=8, display = display_chikou_span_filter_by_kijun?display.all:display.none)
plot(_bChikouSpanSt and _newDirection== -1 and display_ichimoku ?close:na, offset=-_displacement, color=color.new(color.red, 0), title='Chikou Span Below', style=plot.style_linebr, linewidth=8, display = display_chikou_span_filter_by_kijun?display.all:display.none)
//End of Kijun-sen arrows
// // --------------- functions for future ---------------
// getCloudDirection(__tickerID, __tf, __conversionPeriods, __basePeriodsK, __senkou2Periods, __offset) =>
// __conversionLine = getTankan(__tickerID, __conversionPeriods, __tf) //conversionLine = getMidPoint(conversionPeriods, 0)
// __baseLine = getKijun(__tickerID, __basePeriodsK, __tf)// baseLine = getMidPoint(basePeriodsK, 0)
// __leadLine1 = getSenkou_spanA(__tickerID, __tf, __conversionLine, __baseLine) // math.avg(conversionLine, baseLine)
// __leadLine2 = getSenkou_spanB(__tickerID, __tf, __senkou2Periods) //getMidPoint(senkou2Periods, 0)
// if close > math.max(__leadLine1[__offset], __leadLine2[__offset])
// 1
// else if close < math.min(__leadLine1[__offset], __leadLine2[__offset])
// -1
// else
// 0
// getTableCloudColours(cloudSignal, colourUp, colourDn, colourNu) =>
// if cloudSignal == 1
// colourUp
// else if cloudSignal == -1
// colourDn
// else
// colourNu
// //--------------------------------- Multi-timeframe (MTF) Kijun ---------------------------------
var grp2 = "Multi-timeframe (MTF)"
bool display_mtk = input.bool(false, 'Enable Multi Timeframe Kijun-sen', group = grp2)
bool_tf1 = input.bool(true, "Enable", inline = "tf_1")
bool_tf2 = input.bool(true, "Enable", inline = "tf_2")
bool_tf3 = input.bool(true, "Enable", inline = "tf_3")
bool_tf4 = input.bool(true, "Enable", inline = "tf_4")
float chartTFInMinutes = timeframe.in_seconds() / 60
display_limit_1440 = display_mtk and timeframe.isintraday and chartTFInMinutes < 1440 and bool_tf1
display_limit_240 = display_mtk and timeframe.isintraday and chartTFInMinutes < 240 and bool_tf2
display_limit_60 = display_mtk and timeframe.isintraday and chartTFInMinutes < 60 and bool_tf3
display_limit_15 = display_mtk and timeframe.isintraday and chartTFInMinutes < 15 and bool_tf4
tf_1 = input.timeframe(title="Timeframe 1", defval="1D", options=['15', '60', '240', '1D', '1W', '1M'], inline = "tf_1")
k_1 = getKijun(syminfo.tickerid, basePeriodsK, tf_1)
plot(display_limit_1440 ? k_1 : na, color=color.purple, display = display_mtk? display.all:display.none)
tf_2 = input.timeframe(title="Timeframe 2", defval="240", options=['15', '60', '240', '1D', '1W', '1M'], inline = "tf_2")
k_2 = getKijun(syminfo.tickerid, basePeriodsK, tf_2)
plot(display_limit_240 ? k_2 : na, color=color.purple, display = display_mtk? display.all:display.none)
tf_3 = input.timeframe(title="Timeframe 3", defval="60", options=['15', '60', '240', '1D', '1W', '1M'], inline = "tf_3")
k_3 = getKijun(syminfo.tickerid, basePeriodsK, tf_3)
plot(display_limit_60 ? k_3 : na, color=color.purple, display = display_mtk? display.all:display.none)
tf_4 = input.timeframe(title="Timeframe 4", defval="15", options=['15', '60', '240', '1D', '1W', '1M'], inline = "tf_4")
k_4 = getKijun(syminfo.tickerid, basePeriodsK, tf_4)
plot(display_limit_15 ? k_4 : na, color=color.purple, display = display_mtk? display.all:display.none)
if display_mtk
var l_k_1 = label.new(x = bar_index + 1, y = k_1, style = label.style_label_left, color = color.rgb(0, 0, 0, 100), textcolor = color.purple, text = "K-1D")
label.set_xy(display_limit_1440 ? l_k_1 : na, x = bar_index + 1, y = k_1)
var l_k_2 = label.new(x = bar_index + 1, y = k_2, style = label.style_label_left, color = color.rgb(0, 0, 0, 100), textcolor = color.purple, text = "K-4h")
// label.set_text(l_k_2, str.tostring(_existingArrowDirection) + " K-4h")
label.set_xy(display_limit_240 ? l_k_2 : na, x = bar_index + 1, y = k_2)
var l_k_3 = label.new(x = bar_index + 1, y = k_3, style = label.style_label_left, color = color.rgb(0, 0, 0, 100), textcolor = color.purple, text = "K-1h")
label.set_xy(display_limit_60 ? l_k_3 : na, x = bar_index + 1, y = k_3)
var l_k_4 = label.new(x = bar_index + 1, y = k_4, style = label.style_label_left, color = color.rgb(0, 0, 0, 100), textcolor = color.purple, text = "K-15m")
label.set_xy(display_limit_15 ? l_k_4 : na, x = bar_index + 1, y = k_4)
// ------------------ table --------------------------
// Calculate ATR in pips
trValueCur = math.round_to_mintick(GetCorrectTickValue(ta.tr(true)))
trValueDaily = request.security(syminfo.tickerid, "1D", trValueCur)
atrValueCur = math.round_to_mintick(GetCorrectTickValue(atr))
atrValueDaily = request.security(syminfo.tickerid, "1D", atrValueCur)
var string grp_atr = "ATR Panel"
string tableYposInput = input.string("top", "ATR Panel position", inline = "11", options = ["top", "middle", "bottom"], group = grp_atr)
string tableXposInput = input.string("right", "", inline = "11", options = ["left", "center", "right"], group = grp_atr)
color bullColorInput = input.color(color.new(color.green, 30), "Above", inline = "12", group = grp_atr)
color bearColorInput = input.color(color.new(color.red, 30), "Under", inline = "12", group = grp_atr)
color neutColorInput = input.color(color.new(color.gray, 80), "Neutral", inline = "12", group = grp_atr)
color textColour_atrPanel = input.color(color.new(color.white, 20), "Text Colour", inline = "12", group = grp_atr)
// int cloudSignal_1m = getCloudDirection(syminfo.tickerid, "1", conversionPeriods, basePeriodsK, senkou2Periods, _displacement)
// int cloudSignal_5m = getCloudDirection(syminfo.tickerid, "5", conversionPeriods, basePeriodsK, senkou2Periods, _displacement)
// int cloudSignal_15m = getCloudDirection(syminfo.tickerid, "15", conversionPeriods, basePeriodsK, senkou2Periods, _displacement)
// int cloudSignal_1h = getCloudDirection(syminfo.tickerid, "60", conversionPeriods, basePeriodsK, senkou2Periods, _displacement)
// int cloudSignal_4h = getCloudDirection(syminfo.tickerid, "240", conversionPeriods, basePeriodsK, senkou2Periods, _displacement)
// int cloudSignal_1D = getCloudDirection(syminfo.tickerid, "D", conversionPeriods, basePeriodsK, senkou2Periods, _displacement)
// var string grp_cloud = "Cloud Panel"
// string tableCloudYposInput = input.string("top", "Cloud Panel position", inline = "11", options = ["top", "middle", "bottom"], group = grp_cloud)
// string tableCloudXposInput = input.string("center", "", inline = "11", options = ["left", "center", "right"], group = grp_cloud)
// color bullColorCloudInput = input.color(color.new(color.green, 30), "Above Cloud", inline = "12", group = grp_cloud)
// color bearColorCloudInput = input.color(color.new(color.red, 30), "Below Cloud", inline = "12", group = grp_cloud)
// color neutColorCloudInput = input.color(color.new(color.gray, 80), "Inside Cloud", inline = "12", group = grp_cloud)
// KijunD = getMidPoint(basePeriodsK, 0)
// request.security(syminfo.tickerid, "D", pipSizeCalc[1], lookahead=barmerge.lookahead_on)
var table panelATR = table.new(tableYposInput + "_" + tableXposInput, 4, 6)
// var table panelCloud = table.new(tableCloudYposInput + "_" + tableCloudXposInput, 12, 2)
// ----------- count candles when are above, below or inside the cloud -----------
// getCandleCountsAgainstCloud(__tf) =>
// // Determine if the candle is above, below, or inside the cloud
// __conversionLine = getTankan(syminfo.tickerid, conversionPeriods, __tf) //conversionLine = getMidPoint(conversionPeriods, 0)
// __baseLine = getKijun(syminfo.tickerid, basePeriodsK, __tf)// baseLine = getMidPoint(basePeriodsK, 0)
// __leadLine1 = getSenkou_spanA(syminfo.tickerid, __tf, __conversionLine, __baseLine) // math.avg(conversionLine, baseLine)
// __leadLine2 = getSenkou_spanB(syminfo.tickerid, __tf, senkou2Periods) //getMidPoint(senkou2Periods, 0)
// __cloud__span_a = request.security(syminfo.tickerid, __tf, __leadLine1[_displacement])
// __cloud__span_b = request.security(syminfo.tickerid, __tf, __leadLine2[_displacement])
// aboveCloud = close > __cloud__span_a and close > __cloud__span_b
// belowCloud = close < __cloud__span_a and close < __cloud__span_b
// insideCloud = not aboveCloud and not belowCloud
// // Initialize count variables
// var int aboveCount = 0
// var int belowCount = 0
// var int insideCount = 0
// // Count candles based on cloud position
// if aboveCloud
// belowCount := 0
// insideCount := 0
// aboveCount := aboveCount + 1
// else if belowCloud
// aboveCount := 0
// insideCount := 0
// belowCount := belowCount + 1
// else
// aboveCloud := 0
// belowCount := 0
// insideCount := insideCount + 1
// cloudSignalCandleCount_1m = "" //request.security(syminfo.tickerid, "1", (getCandleCountsAgainstCloud("1")))
// cloudSignalCandleCount_5m = "" //request.security(syminfo.tickerid, "5", (getCandleCountsAgainstCloud("5")))
// cloudSignalCandleCount_15m = "" //request.security(syminfo.tickerid, "15", (getCandleCountsAgainstCloud("15")))
// cloudSignalCandleCount_1h = "" //request.security(syminfo.tickerid, "60", (getCandleCountsAgainstCloud("60")))
// cloudSignalCandleCount_4h = "" //request.security(syminfo.tickerid, "240", (getCandleCountsAgainstCloud("240")))
// cloudSignalCandleCount_1D = "" //request.security(syminfo.tickerid, "D", (getCandleCountsAgainstCloud("D")))
// //----------------------------------
// __conversionLine4h = getTankan(syminfo.tickerid, conversionPeriods, "240") //conversionLine = getMidPoint(conversionPeriods, 0)
// __baseLine4h = getKijun(syminfo.tickerid, basePeriodsK, "240")// baseLine = getMidPoint(basePeriodsK, 0)
// __leadLine1_4h = getSenkou_spanA(syminfo.tickerid, "240", __conversionLine4h, __baseLine4h)
// __leadLine2_4h = getSenkou_spanB(syminfo.tickerid, "240", senkou2Periods) //getMidPoint(senkou2Periods, 0)
// __cloud__span_a_4h = __leadLine1_4h[1]
// __cloud__span_b_4h = request.security(syminfo.tickerid, "240", __leadLine2_4h[_displacement])
// __conversionLine1d = getTankan(syminfo.tickerid, conversionPeriods, "D") //conversionLine = getMidPoint(conversionPeriods, 0)
// __baseLine1d = getKijun(syminfo.tickerid, basePeriodsK, "D")// baseLine = getMidPoint(basePeriodsK, 0)
// __leadLine1_1d = getSenkou_spanA(syminfo.tickerid, "D", __conversionLine1d, __baseLine1d)
// __leadLine2_1d = getSenkou_spanB(syminfo.tickerid, "D", senkou2Periods) //getMidPoint(senkou2Periods, 0)
// __cloud__span_a_1d = __leadLine1_1d[1]
// __cloud__span_b_1d = request.security(syminfo.tickerid, "D", __leadLine2_4h[_displacement])
if barstate.islast
bgColorCur = trValueCur > atrValueCur ? bearColorInput : bullColorInput
bgColorDaily = trValueDaily > atrValueDaily ? bearColorInput : bullColorInput
bgColorTKx = if con_tk_current > 0
bullColorInput
else if con_tk_current < 0
bearColorInput
else
color.new(color.gray, 50)
// table.cell(panelCloud, 0, 0, "1m", bgcolor = neutColorInput)
// table.cell(panelCloud, 1, 0, "5m", bgcolor = neutColorInput)
// table.cell(panelCloud, 2, 0, "15m", bgcolor = neutColorInput)
// table.cell(panelCloud, 3, 0, "1h", bgcolor = neutColorInput)
// table.cell(panelCloud, 4, 0, "4h", bgcolor = neutColorInput)
// table.cell(panelCloud, 5, 0, "D", bgcolor = neutColorInput)
// table.cell(panelCloud, 0, 1, str.tostring(cloudSignalCandleCount_1m), bgcolor = getTableCloudColours(cloudSignal_1m, color.green, color.red, color.gray))
// table.cell(panelCloud, 1, 1, str.tostring(cloudSignalCandleCount_5m), bgcolor = getTableCloudColours(cloudSignal_5m, color.green, color.red, color.gray))
// table.cell(panelCloud, 2, 1, str.tostring(cloudSignalCandleCount_15m), bgcolor = getTableCloudColours(cloudSignal_15m, color.green, color.red, color.gray))
// table.cell(panelCloud, 3, 1, str.tostring(cloudSignalCandleCount_1h), bgcolor = getTableCloudColours(cloudSignal_1h, color.green, color.red, color.gray))
// table.cell(panelCloud, 4, 1, str.tostring(cloudSignalCandleCount_4h), bgcolor = getTableCloudColours(cloudSignal_4h, color.green, color.red, color.gray))
// table.cell(panelCloud, 5, 1, str.tostring(cloudSignalCandleCount_1D), bgcolor = getTableCloudColours(cloudSignal_1D, color.green, color.red, color.gray))
// table.cell(panelATR, 0, 0, "Period", bgcolor = neutColorInput)
table.cell(panelATR, 1, 0, "Range(D)", bgcolor = neutColorInput, text_color = textColour_atrPanel)
table.cell(panelATR, 2, 0, "ATR(D)", bgcolor = neutColorInput, text_color = textColour_atrPanel)
table.cell(panelATR, 3, 0, "TKx("+ timeframe.period+")", bgcolor = neutColorInput, text_color = textColour_atrPanel)
// table.cell(panelATR, 0, 1, timeframe.period, bgcolor = neutColorInput)
// table.cell(panelATR, 1, 1, str.tostring(trValueCur), bgcolor = bgColorCur)
// table.cell(panelATR, 2, 1, str.tostring(atrValueCur), bgcolor = neutColorInput)
// table.cell(panelATR, 0, 2, "D", bgcolor = neutColorInput)
table.cell(panelATR, 1, 2, str.tostring(trValueDaily), bgcolor = bgColorDaily, text_color = textColour_atrPanel)
table.cell(panelATR, 2, 2, str.tostring(atrValueDaily), bgcolor = neutColorInput, text_color = textColour_atrPanel)
table.cell(panelATR, 3, 2, str.tostring(tk_signal_count), bgcolor = bgColorTKx, text_color = textColour_atrPanel)
// table.cell(panelATR, 0, 3, str.tostring(__cloud__span_a_4h), bgcolor = neutColorInput)
// table.cell(panelATR, 1, 3, str.tostring(__cloud__span_a_1d), bgcolor = neutColorInput)
// table.cell(panelATR, 2, 3, str.tostring(cloudSignal_1D), bgcolor = neutColorInput)
// table.cell(panelATR, 0, 0, str.tostring(_existingArrowDirection))
// -------------------------------- Parabolic SAR --------------------------------
var grp_parsar = "Parabolic SAR"
bool display_parsar = input.bool(false, 'Enable Parabolic SAR', group = grp_parsar)
start = input(0.02)
increment = input(0.02)
maximum = input(0.2, "Max Value")
out = ta.sar(start, increment, maximum)
plot(out, "ParabolicSAR", style=plot.style_cross, color=color.new(color.yellow, 30), linewidth = 2, display = display_parsar ? display.all: display.none)
// -------------------------------- Parabolic SAR --------------------------------