Using: Calculate.OnBarClose
I have 10 consecutive down bars (i could label them 1-10 using Draw.Text and a counter value).
I add the CurrentBar value to a List object, so my list will have 10 entries of CurrentBar.
On the 10th bar close, id like to say something like:
Look back over the 10 bars and count each instance where we closed lower than the prior low.
I would like to restrospectively add Draw.Text to those historical bars, where that condition is true.
Here is an example of the logic I am using to try and achieve this:
If we had 10 down bars { for ( int i = 0; i < ListSetupBuy.Count; i ++ ) { if(Close[9-i] < Low[(9-i)+2]) // condition X { counter++; someSeries[8-i] = counter; Draw.Text(....) Draw.Dot(this, "C1" + CurrentBar, true, 0, Low[8-i], Brushes.Orange); } } }
I am using a draw.dot just as an easy example to illustrate a point.
Id actually want to use draw.text to number the bars where condition X is true with the counter value.
This seems to make sense (to me), but is not yeilding the desired results.
I only see the draw.dot output on the last bar (10th), which is the current bar.
Is it possible to add annotations to a bunch of bars historically once a condition is triggered on the current bar?
I thought a for loop > condition > draw method could acheive this, but with no luck thus far.
Thanks in advance
AK
Comment