stfl / backtestd-expert

8 stars 4 forks source link

Optimize Signal calculation #10

Open stfl opened 3 years ago

stfl commented 3 years ago

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

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.

https://github.com/stfl/backtestd-expert/blob/ab0f635f16a0cbd602cbf59372795614d76389ed/Include/backtestd/SignalClass/AggSignal.mqh#L105-L125