bennycode / trading-signals

Technical indicators to run technical analysis with JavaScript & TypeScript. πŸ“ˆ
https://bennycode.com/trading-signals
MIT License
621 stars 90 forks source link

fix replace feature in TR #666

Closed ozum closed 6 months ago

ozum commented 6 months ago

The replace feature in the update of the TR indicator was not working correctly, because it does not handle previousCandle when replacing the result.

I added a new attribute to store two previous candles that replace the previous candle when replace is true. I also included a test to ensure that replace feature is working as expected.

codecov-commenter commented 6 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 100.00%. Comparing base (ebb6c01) to head (15c64e7). Report is 43 commits behind head on main.

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #666 +/- ## ========================================== Coverage 100.00% 100.00% ========================================== Files 36 36 Lines 2290 2404 +114 Branches 248 292 +44 ========================================== + Hits 2290 2404 +114 ``` | [Flag](https://app.codecov.io/gh/bennycode/trading-signals/pull/666/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Benny+Neugebauer) | Coverage Ξ” | | |---|---|---| | [unittests](https://app.codecov.io/gh/bennycode/trading-signals/pull/666/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Benny+Neugebauer) | `100.00% <100.00%> (ΓΈ)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Benny+Neugebauer#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

bennycode commented 6 months ago

Thank you @ozum for making this important contribution! πŸ‘ I released your fix with trading-signals v5.0.1 β˜€οΈ