Commit graph

29 commits

Author SHA1 Message Date
4abf7c110c refactor: introduce CSmoothingBase for smoothing sub-indicators
Introduce CSmoothingBase as an intermediate abstract base class between
CSubIndiBase and concrete smoothing sub-indicators (such as CSma).

Extract common traits shared across all smoothing algorithms:
- Declare pure virtual onCalculate() to standardize the calculation interface.
- Pull up the output indicator buffer (buffer[]) and its clearBuffersAt() hook.
- Generalize correctPeriod() with a configurable minPeriod parameter.
- Hardcode emptyValue to EMPTY_VALUE in the base class constructor.

Update CSma to inherit from CSmoothingBase and remove redundant members.
2026-08-23 13:46:23 -07:00
dfac980ebd refactor: add prepareCalculation overload with isFullCalculation flag
Add an overload for CSubIndiBase::prepareCalculation() that outputs whether
drawBegin is included in the calculation range via the isFullCalculation flag.

Adopt this overload in CSma::onCalculate(), allowing the redundant prepareRecurrenceSeed()
helper to be inlined and removed since the if (isFullCalculation) check makes seed
initialization transparent and self-documenting.
2026-08-18 18:45:45 -07:00
4ec4cc98ca refactor: rename prepareBeforeCalculating to prepareCalculation
Rename prepareBeforeCalculating() to prepareCalculation() and update
associated local variables from recalcStartIdx to calcStartIdx.
2026-08-18 18:44:50 -07:00
b589d8d09a fix: ensure recurrence seed is calculated when recalculation touches drawBegin
Using "rates_total - prev_calculated > 1" was insufficient for detecting
when the seed value at drawBegin needed to be computed by summation.

When calculating with minimal history (prev_calculated == barsRequired),
recalcStartIdx equals drawBegin. Because the difference is <= 1, summation
was skipped and the recurrence loop ran at index drawBegin, causing a fatal
'Array out of range' error when accessing source[drawBegin - period] (index -1).

Introduce prepareRecurrenceSeed() to calculate the seed via summation
whenever recalcStartIdx <= drawBegin, and start the recurrence from drawBegin + 1.

https://www.mql5.com/en/forum/510519#comment_60245675
2026-08-17 18:57:29 -07:00
9f98246116 docs: add code comments to all source files 2026-08-10 22:26:48 -07:00
30d91e1e9e docs: update README.md with Part 2 WIP notice 2026-08-08 17:57:51 -07:00
106f7d2a03 docs: update README.md article-part1 2026-06-11 16:41:04 -07:00
acfbfa108f refactor: pull up prepareBeforeCalculating to base class 2026-05-19 20:07:14 -07:00
246b12b750 refactor: introduce clearBuffersAt hook for subclasses 2026-05-18 22:34:24 -07:00
9814531a45 feat: implement CSma::onCalculate 2026-05-16 17:50:43 -07:00
73413fcd5f refactor: replace 0 with drawBegin in CAppliedPrice 2026-05-16 14:32:27 -07:00
1507c1be8d refactor: rename barIdxToRecalcFrom to recalcStartIdx 2026-05-15 20:05:22 -07:00
654e54bb27 feat: reconfigure plots and buffers 2026-05-12 18:24:14 -07:00
db294e800a feat: integrate CSma into CIndicator 2026-05-12 18:21:10 -07:00
26132b07e5 feat: outline CSma sub-indicator 2026-05-12 18:20:10 -07:00
7e121a6606 feat: add SMA period input parameter 2026-05-08 17:57:14 -07:00
c37f8382a6 refactor: rename applied price parameter to 'Apply to' 2026-05-08 17:56:08 -07:00
97982404ff refactor: extract infrastructure logic into CIndicatorBase 2026-04-29 16:43:25 -07:00
96627473d2 refactor: centralize rates_total checks in CSubIndiRegistry 2026-04-27 06:45:21 -07:00
a8fa958ee4 refactor: introduce CSubIndiBase for sub-indicators 2026-04-20 09:38:49 -07:00
b72c7e7a8c refactor: extract rates_total checks into checkRatesTotal 2026-03-22 11:11:56 -07:00
6a95a6c6a9 refactor: replace CIndicator ctor args with params object 2026-03-17 05:33:09 -07:00
a73c54201e refactor: introduce CIndicator as root object 2026-03-10 23:25:00 -07:00
256ad48fef refactor: extract applied price into CAppliedPrice 2026-03-02 14:07:59 -08:00
6d89635868 fix: add sanity checks for rates_total and prev_calculated 2026-02-22 16:50:05 -08:00
1cac034cfe fix: enable tester_everytick_calculate 2026-02-22 14:50:35 -08:00
db1e57732e refactor: collapse switch cases in OnCalculate 2026-02-21 13:15:16 -08:00
bdf3183c28 refactor: unify buffer recalculation loop in OnCalculate 2026-02-21 13:08:09 -08:00
6a73b7ac79 Initial commit 2026-02-20 15:09:43 -08:00