Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

7
LINES

< > BotCompany Repo | #1036468 // trueRange - trading indicator

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (10693L/59K).

// need at least 2 recent candles
static double trueRange(L<TradingCandle> lastCandles) {
  if (l(lastCandles) < 2) ret Double.NaN;
  var c1 = nextToLast(lastCandles);
  var c2 = last(lastCandles);
  ret max(c2.high(), c1.close())-min(c2.low(), c1.close());
}

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: 70 / 95
Referenced in: [show references]