Skip to content
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

Optimize Signal calculation #10

Open
stfl opened this issue Oct 14, 2020 · 0 comments
Open

Optimize Signal calculation #10

stfl opened this issue Oct 14, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@stfl
Copy link
Owner

stfl commented Oct 14, 2020

Currently the signal is calculated multiple times.
For a simple two lines cross this is simply checking if the lines crossed.
This happens multiple times.

before the state machine is processed Update() is already called on all of the indicators.
For further checking within the state machine it could simply read an already cached value

  • m_signal_direction
  • m_signal_side
  • m_exit_direction

It might be enough to change the methods on AggSignal where the indicator states are read.
The following could read a cached value insead of calling for examle m_confirm.LongSignal() again.

bool ConfirmSignalLong() { return m_confirm && m_confirm.LongSignal(); }
bool ConfirmSideLong() { return !m_confirm || m_confirm.LongSide(); }
bool Confirm2SideLong() { return !m_confirm2 || m_confirm2.LongSide(); }
bool ContSignalLong() { return m_continue && m_continue.LongSignal(); }
bool ExitSignalLong() { return m_exit && m_exit.LongSignal(); }
bool ExitSideLong() { return m_exit && m_exit.LongSide(); }
bool BaselineSignalLong() { return m_baseline && m_baseline.LongSignal(); }
bool BaselineSideLong() { return !m_baseline || m_baseline.LongSide(); }
bool BaselineATRChannelLong();
bool ContinueSignalLong() { return m_continue && m_continue.LongSignal(); }
bool ConfirmSignalShort() { return m_confirm && m_confirm.ShortSignal(); }
bool ConfirmSideShort() { return !m_confirm || m_confirm.ShortSide(); }
bool Confirm2SideShort() { return !m_confirm2 || m_confirm2.ShortSide(); }
bool ContSignalShort() { return m_continue && m_continue.ShortSignal(); }
bool ExitSignalShort() { return m_exit && m_exit.ShortSignal(); }
bool ExitSideShort() { return m_exit && m_exit.ShortSide(); }
bool BaselineSignalShort() { return m_baseline && m_baseline.ShortSignal(); }
bool BaselineSideShort() { return !m_baseline || m_baseline.ShortSide(); }
bool BaselineATRChannelShort();
bool ContinueSignalShort() { return m_continue && m_continue.ShortSignal(); }

@stfl stfl changed the title Improve Signal calculation Optimize Signal calculation Oct 14, 2020
@stfl stfl added the enhancement New feature or request label Oct 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant