Commit graph

15 commits

Author SHA1 Message Date
f6c1ae39be refactor(sub-indi-base): rename idxRecalcFrom to recalcStartIdx 2026-05-15 17:49:35 -07:00
51c8d0f60c refactor: replace assignToAllBuffers with clearBuffersAt 2026-05-15 15:31:05 -07:00
892db772ac refactor: remove redundant condition in prepareBeforeCalculating
The condition `idxRecalcFrom < drawBegin` inside the `case 0:` and `case 1:` branches of `CSubIndiBase::prepareBeforeCalculating` is mathematically unreachable because all sub-indicators are guaranteed to be instantiated during `OnInit()`.

Proof:
1. `prev_calculated` on a new tick is either 0 or the value returned by `OnCalculate` on the previous tick (which is `rates_total`).
2. `CIndicatorBase::onCalculate` returns `rates_total` only if `CSubIndiRegistry::checkRatesTotal` succeeds.
3. `checkRatesTotal` ensures that `rates_total >= CSubIndiRegistry::barsRequired`.
4. Therefore, any non-zero `prev_calculated` is strictly `>= CSubIndiRegistry::barsRequired`.
5. Since all sub-indicators are created in `OnInit`, the global registry's `barsRequired` is the maximum of all instances' `barsRequired`. Thus, `CSubIndiRegistry::barsRequired >= instance.barsRequired`.
6. Inside `prepareBeforeCalculating`, branches `case 0` and `case 1` are only reached when `rates_total - prev_calculated` is 0 or 1. Given `rates_total >= 3` (minimum allowed bars), `prev_calculated` cannot be 0 (otherwise the difference would be >= 3, falling into the `default` branch).
7. Since `prev_calculated > 0`, we establish that `prev_calculated >= instance.barsRequired`.
8. The code calculates: `idxRecalcFrom = prev_calculated - 1`.
9. By substitution: `idxRecalcFrom >= instance.barsRequired - 1`.
10. Since `drawBegin` is strictly initialized to `barsRequired - 1` in the constructor, we conclude that `idxRecalcFrom >= drawBegin` is always true.

Consequently, `idxRecalcFrom < drawBegin` will always evaluate to false, rendering the check dead code.
2026-05-11 15:57:48 -07:00
f78f16cfd0 style: add missing final newlines 2026-04-29 14:47:54 -07:00
3f882a413e refactor: simplify CSubIndiBase constructor initialization 2026-03-22 16:25:20 -07:00
ce24e7926a chore: update copyright notices for 2026 2026-03-22 15:54:16 -07:00
89cb956c26 style: add const to CSubIndiRegistry::checkRatesTotal parameters
rates_total and prev_calculated are typically declared as const throughout the
codebase, so add const here as well to keep the signature consistent with the
usual convention.
2026-03-22 10:18:30 -07:00
e6fed909dc refactor: remove redundant final from CIndiParams
Although CIndiParams is not intended to be used as a base class, keeping the
explicit final specifier here adds verbosity without a practical benefit.
2026-03-22 08:24:26 -07:00
7e7352b804 style: remove trailing whitespace 2026-03-22 07:53:02 -07:00
6402eae234 refactor: simplify project layout 2026-03-16 23:50:18 -07:00
ab30373d3a style: rename CAppliedPrice::calculate param a_mode to mode 2026-03-01 11:01:55 -08:00
af8ce1f479 refactor(indicator): rename internalOnCalculate to onCalculateImpl 2026-02-26 16:06:56 -08:00
94f6a601d1 chore: add .gitattributes 2026-02-25 17:50:36 -08:00
boyvlad-bash
2e6cac9ebd fix: make CArrayHelper::expandEx commit size only on success 2026-01-28 22:43:38 -08:00
boyvlad-bash
26b202909c chore(release): v1.0 v1.0 2025-11-28 18:35:12 -08:00