Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit ff03088

Browse files
author
Nikolay Dikanskiy
committedDec 12, 2024
NOVA-678: scanner_data: fix epsilon calculation in the pine
1 parent 699d09e commit ff03088

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed
 

‎links/24h_volume.pine.link

+2-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ plot(close24hChangeAbs, title = "24h_close_change_abs", style = plot.style_colum
7676

7777
// 24h close change
7878
float close24hChange = na
79-
if na(close24hChangeAbs) or close24hPrev * 100000000 == 0 or (close24hPrev < 0 and close > 0)
79+
float close24hPrevToCompare = close24hPrev * 1e+36 // for comparing very small numbers since pine has limited precision (1e-10)
80+
if na(close24hChangeAbs) or close24hPrevToCompare != 0 or (close24hPrevToCompare < 0 and close > 0)
8081
na
8182
else
8283
close24hChange := (close24hChangeAbs / math.abs(close24hPrev)) * 100

0 commit comments

Comments
 (0)
Please sign in to comment.