For ease of explanation let's consider a one min. chart (any symbol) with one week of data. For indicators place a SMA34 (fast) and SMA50 (slow) on the chart. The occurrence counter needs to report how many times the SMA34 crossed above the SMA50 one bar ago. A running total would be placed on the chart at each occurrence.
I have a solution partially working using Strategy Builder however I'm missing one piece of the puzzle. A numeral appears where it should, however it is not an accurate count. I don't think the existing total number of occurrences is being sustained bar by bar until the next occurrence, then added to.
The strategy uses a Custom Series array labelled "Counter" (int). Using a variable does not work since we cannot attribute a bar offset in the action settings. I've attached the zip file in case anyone would like to test it out.
Counter[0] = (Counter[1] + 1); This should add 1 to the existing total. It does but only sometimes. If you try the test strategy and scroll through the chart you will see what I mean.
Draw.Text(this, @"Text_1 " +Convert.ToString(CurrentBars[0]), Convert.ToString(Counter[0]), 1, (Low[0] - 1) ); This text drawing does place the numeral in the correct location.
Thanks for the help.

Comment