Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions links/high_and_low.pine.link
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,18 @@ custom_highest_and_date(len, maxbarsback) =>
if high[i] > high[index]
index := i
[high[index], time[index] / 1000]
// Searches nearest bar offset by timestamp
fastSearchTimeIndex(x, maxbarsback) =>
// max_bars_back(time, maxbarsback)
mid = 0 * time[maxbarsback]
right = math.min(bar_index, maxbarsback)
left = 0
if time < x
if x/1000 <= first_bar_time
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Объявление first_bar_time надо перетащить с конца файла наверх, а то компилятор будет ругаться на переменную

bar_index
else if time < x
0
else
for i = 0 to 9 by 1
for i = 0 to 10
mid := math.ceil((left + right) / 2)
if left == right
break
Expand Down Expand Up @@ -157,4 +160,4 @@ plot(ta.tr(true) * 100 / math.abs(low), title='Volatility.D')

// first bar's timestamp in pine history
var first_bar_time = time / 1000
plot(first_bar_time, title='first_bar_time')
plot(first_bar_time, title='first_bar_time')