Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
C++/WASM support for EA31337 code #792
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: v4.000-dev
Are you sure you want to change the base?
Uh oh!
There was an error while loading. Please reload this page.
C++/WASM support for EA31337 code #792
Changes from all commits
acccb7ad8fc44655b4e99File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue (complexity): Consider letting the tick indicator store and update the current tick time directly instead of delegating through GetTick() and PlatformTime, simplifying ownership and data flow.
You can simplify this without changing behavior by making the tick indicator itself the clear owner of the “current tick time” and removing the delegation chain through
GetTick().Right now:
IndicatorData::GetTimeCurrent()→GetTick()->GetTimeCurrent()IndicatorData::UpdateLastTickTimeMs()→GetTick()->UpdateLastTickTimeMs(...)EmitEntry()→GetTick()->UpdateLastTickTimeMs(_entry.timestamp * 1000)Combined with
PlatformTimecalling back into the indicator, this creates the circular indirection the other reviewer highlighted.1. Store the tick time directly in
IndicatorDataGive
IndicatorData(specifically the tick indicator instance) a simple field to own the last tick time and implement the two methods directly, instead of delegating toGetTick():This removes the back-and-forth between different indicators for a value that is conceptually owned by the tick indicator.
2. Update
EmitEntryto use the local setterWhen emitting a tick entry, you can update the time via the local API, not via
GetTick():If you still need a top-level “tick indicator in the hierarchy” abstraction,
GetTick()can remain, but it no longer needs to be involved in the time plumbing.3. Simplify
PlatformTimeusage (unidirectional flow)With the above,
PlatformTimecan work with a primitive and avoid knowing about the indicator hierarchy:PlatformTimedirectly:PlatformTimeno longer needs to call back into the indicator to fetch/settick_time_ms; it just stores the primitive. That allows you to:PlatformTimeto know aboutIndicatorDatainternalsPlatformTime.inline.hat the end ofIndicatorDatato resolve circular dependenciesIf you still need inline definitions, you can keep
PlatformTimeAPIs purely in terms of primitive types:This keeps all functionality (tick indicators still drive both indicator hierarchy and
PlatformTime), but the flow is now unidirectional and the coupling/indirection are significantly reduced.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (performance): Per-tick Print in IndicatorTick::UpdateLastTickTimeMs will severely impact performance and spam logs.
Because
UpdateLastTickTimeMsis called for every tick, this log line will generate extremely large log volumes and noticeably slow both live and backtest runs.Please either guard this behind a compile-time debug flag / debug-only build, or remove it once the feature is validated. If you still need detailed tracing, consider a rate-limited logger instead of unconditional per-tick printing.
Suggested implementation:
DEBUG_INDICATOR_TICK_LOGonly in debug builds or when you explicitly need detailed per-tick tracing. For example, in a central config/header used only for debugging, or via your build system’s preprocessor definitions.Printentirely if you no longer need per-tick tracing.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (testing): Add tests for the new WASM/EMSCRIPTEN bindings and time-handling changes (PlatformTime/Indicator time plumbing).
These changes alter how time is sourced and propagated for the WASM build (e.g., PlatformTime depending on the current tick indicator, new GetTimeCurrent/UpdateLastTickTimeMs behavior, INDI_EMITTED_ENTRY_TYPE_TICK in EmitEntry), but there are no new tests validating this, particularly in the C++/WASM path.
Please add a dedicated C++/WASM test (e.g.,
Indicator/tests/PlatformTime.test.cpp) that:TimeCurrent(),PlatformTime::TimeCurrent(), andIndicatorBase::GetTimeCurrent()all return the tick time from the Tick indicator.This will ensure the new WASM time plumbing matches MQL runtime expectations and catches regressions early.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.