Libraryless. Click here for Pure Java version (10693L/59K).
1 | // need at least 2 recent candles |
2 | static double trueRange(L<TradingCandle> lastCandles) { |
3 | if (l(lastCandles) < 2) ret Double.NaN; |
4 | var c1 = nextToLast(lastCandles); |
5 | var c2 = last(lastCandles); |
6 | ret max(c2.high(), c1.close())-min(c2.low(), c1.close()); |
7 | } |
download show line numbers debug dex old transpilations
Travelled to 2 computer(s): mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1036468 |
Snippet name: | trueRange - trading indicator |
Eternal ID of this version: | #1036468/1 |
Text MD5: | 330b5835060f4b51a1751d22f55d5b26 |
Transpilation MD5: | 1691d5ce9e53fc9a1302af9b662d84da |
Author: | stefan |
Category: | javax / trading |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-12-16 13:49:18 |
Source code size: | 265 bytes / 7 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 176 / 237 |
Referenced in: | [show references] |