Skip to content

Commit 191155c

Browse files
temp
1 parent 86ded59 commit 191155c

File tree

1 file changed

+11
-16
lines changed

1 file changed

+11
-16
lines changed

Diff for: test.pinescript

+11-16
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,15 @@
44
//@version=4
55
study(title='[RS]Bar Pattern Statistics Tool', shorttitle='bst', overlay=false)
66

7-
// bar type placeholder names:
87
string op_type_01 = 'inside bar'
98
string op_type_02 = 'outside bar'
109
string op_type_03 = 'up bar'
1110
string op_type_04 = 'down bar'
1211
string op_type_05 = 'up pin bar'
1312
string op_type_06 = 'down pin bar'
1413
string op_type_07 = 'any type of bar'
15-
// bar type enumeration functions:
1614
f_enum_type(_str)=>(_str==op_type_01?1:(_str==op_type_02?2:(_str==op_type_03?3:(_str==op_type_04?4:(_str==op_type_05?5:(_str==op_type_06?6:(_str==op_type_07?7:na)))))))
1715
f_enum_type_by_idx(_i)=>(_i==1?op_type_01:(_i==2?op_type_02:(_i==3?op_type_03:(_i==4?op_type_04:(_i==5?op_type_05:(_i==6?op_type_06:(_i==7?op_type_07:op_type_07)))))))
18-
//
19-
// current bar information:
2016
float body_range = abs(close - open)
2117
float hl_range = high - low
2218
float upperwick = high - max(close, open)
@@ -25,8 +21,7 @@ bool risinghigh = high > high[1]
2521
bool fallinghigh = high < high[1]
2622
bool risinglow = low > low[1]
2723
bool fallinglow = low < low[1]
28-
//
29-
// bar type information at position:
24+
3025
f_isHighUp(_pos) => risinghigh[_pos]
3126
f_isHighDown(_pos) => fallinghigh[_pos]
3227
f_isLowUp(_pos) => risinglow[_pos]
@@ -58,16 +53,16 @@ string bar09_type = input(defval=op_type_01, title='#9 in pattern:', type=input.
5853
string bar10_type = input(defval=op_type_01, title='#10 in pattern:', type=input.string, options=[op_type_01, op_type_02, op_type_03, op_type_04, op_type_05, op_type_06, op_type_07])
5954

6055
if automatic_last_n_bars
61-
bar01_type := f_enum_type_by_idx(f_ident_bar(max(0, n_bars_in_pattern-0)))
62-
bar02_type := f_enum_type_by_idx(f_ident_bar(max(0, n_bars_in_pattern-1)))
63-
bar03_type := f_enum_type_by_idx(f_ident_bar(max(0, n_bars_in_pattern-2)))
64-
bar04_type := f_enum_type_by_idx(f_ident_bar(max(0, n_bars_in_pattern-3)))
65-
bar05_type := f_enum_type_by_idx(f_ident_bar(max(0, n_bars_in_pattern-4)))
66-
bar06_type := f_enum_type_by_idx(f_ident_bar(max(0, n_bars_in_pattern-5)))
67-
bar07_type := f_enum_type_by_idx(f_ident_bar(max(0, n_bars_in_pattern-6)))
68-
bar08_type := f_enum_type_by_idx(f_ident_bar(max(0, n_bars_in_pattern-7)))
69-
bar09_type := f_enum_type_by_idx(f_ident_bar(max(0, n_bars_in_pattern-8)))
70-
bar10_type := f_enum_type_by_idx(f_ident_bar(max(0, n_bars_in_pattern-9)))
56+
bar01_type := f_enum_type_by_idx(f_ident_bar(max(0, n_bars_in_pattern-1)))
57+
bar02_type := f_enum_type_by_idx(f_ident_bar(max(0, n_bars_in_pattern-2)))
58+
bar03_type := f_enum_type_by_idx(f_ident_bar(max(0, n_bars_in_pattern-3)))
59+
bar04_type := f_enum_type_by_idx(f_ident_bar(max(0, n_bars_in_pattern-4)))
60+
bar05_type := f_enum_type_by_idx(f_ident_bar(max(0, n_bars_in_pattern-5)))
61+
bar06_type := f_enum_type_by_idx(f_ident_bar(max(0, n_bars_in_pattern-6)))
62+
bar07_type := f_enum_type_by_idx(f_ident_bar(max(0, n_bars_in_pattern-7)))
63+
bar08_type := f_enum_type_by_idx(f_ident_bar(max(0, n_bars_in_pattern-8)))
64+
bar09_type := f_enum_type_by_idx(f_ident_bar(max(0, n_bars_in_pattern-9)))
65+
bar10_type := f_enum_type_by_idx(f_ident_bar(max(0, n_bars_in_pattern-10)))
7166

7267
f_get_nbar_type(_i)=>(_i==1?bar01_type:(_i==2?bar02_type:(_i==3?bar03_type:(_i==4?bar04_type:(_i==5?bar05_type:(_i==6?bar06_type:(_i==7?bar07_type:(_i==8?bar08_type:(_i==9?bar09_type:(_i==10?bar10_type:na))))))))))
7368
f_check_nbar(_i, _pos)=>f_enum_BarPattern(f_enum_type(f_get_nbar_type(_i)), _pos)

0 commit comments

Comments
 (0)