Libraryless. Click here for Pure Java version (10640L/59K).
// Note: First one will not be exact static L<TradingCandle> convertToHeikinAshi(L<TradingCandle> candles) { L<TradingCandle> heikinAshi = emptyList(candles); TradingCandle prevHA = null; for i over candles: { var c = candles.get(i); TradingCandle ha = c.clone(); ha.close((c.low()+c.high()+c.open()+c.close())/4); if (prevHA != null) ha.open((prevHA.open()+prevHA.close())/2); ha.low(min(ha.low(), ha.open())); ha.high(max(ha.high(), ha.open())); heikinAshi.add(ha); prevHA = ha; } ret heikinAshi; }
download show line numbers debug dex old transpilations
Travelled to 2 computer(s): mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1036496 |
Snippet name: | convertToHeikinAshi |
Eternal ID of this version: | #1036496/4 |
Text MD5: | f52fb186d75dfa09db8478e218ab67af |
Transpilation MD5: | e39691df4b9824ae126fba24eca7e68f |
Author: | stefan |
Category: | javax / trading |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-12-27 20:49:43 |
Source code size: | 564 bytes / 17 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 189 / 275 |
Version history: | 3 change(s) |
Referenced in: | [show references] |