I have developed a straight forward indicator that works well on the chart. It paints/draws a green/red arrow if certain conditions occur. It does the calculation on the First Tick of Bar and draws the appropriate arrow on the previous bar if the criteria are met.
I would like to use this indicator in a strategy, so I don't have reprogram the logic into the strategy.
In the indicator, I have tried a dozen approaches.
I have tried using the Value series but I get errors. I think that makes sense since there's plot happening every tick/price change/first tick of bar.
So, I added a public Signal property that returns 1 for long/green arrow, -1 for short/red arrow and 0 for no signal. This property should retain its value for the duration of the bar after the criteria is met. That is, the bar of the First Tick of Bar when the code is run to determine whether Signal is set to 1, -1, or 0.
This section of the code is run properly when debugging but I think it is from an instance of the indicator on the chart (not done in the strategy).
But, for some reason, the strategy is always getting 0 for the Signal, never 1 or -1. I even added a public method to the strategy to ensure the OnBarUpdate is being called on the indicator.
public void Calc() {
this.OnBarUpdate();
}
In the strategy, I'm calling Calc in OnBarUpdate. Still just getting 0's.
Thanks,
Matt
Comment