As a preface I have a custom indicator with a custom data series for signals. The indicator is added to the strategy in the State.Configure within OnStateChange. When a signal is generated in the indicator it is added to the custom data series. The strategy then looks for signals from the indicator data series property and takes trades based off of this.
Couple of notes:
1) This is NT8
2) Both indicator and strategy have Calculate.OnPriceChange
a) I understand this will not work as expected for backtesting but changing to OnBarClose makes no difference. With the OnPriceChange in both indicator and strategy I have basic logic for actions that should only be taken when the bar actually closes. Something as simple as
private long lastBar = -1; protected override void OnBarUpdate() { ...// do OnPriceChange stuff here if(lastBar == CurrentBar) return; lastBar = CurrentBar; ...// do OnBarUpdate stuff here
The strategy then looks for an actual signal object in the indicators data series, similar to this:
Signal signal = someCustomIndicator.Signals[0];
Thoughts...thanks!
It's almost as if the strategy is running its code before the indicator can...
Comment