I highlighted the area where the count changed. It’s the same chart but instead of the the 3 count went to a invalid upswing and to a valid downswing, erasing the upswing (1,2,3) and instead started the downswing (1,2). The downswing 1(red) is now on the same bar but before it was the upswing 3 (blue).
So the crux is in there somewhere. 🙂
I think it should be possible that if a swing has not finished his 1-9 count is shown on the chart and if invalid can be erased if reloading the chart. Otherwise I do not understand how the chart I added works.
Value = 0
FOR i = 20 DOWNTO 0 DO //We are looping from 20 to 0
IF (Close[i] < Open[i]) THEN
Value = Value + 1
ELSE
BREAK
ENDIF
NEXT
RETURN Value
So we have something like this as a lead, right ?
It is also good to know that apparently the graphs you showed are taken from PRT fully, thus including the blue and red numbers. OK.
When a bar is drawn, you would be looking at the bar preceding it in order to see if it’s (again) going going up or not. If Up and the previous one also was Up, you would have a 1,2 in blue. When a third would be Down, you’d reset to -1 and draw that -1 in Red.
What you could try (is not so simple) :
Maintain the positions where you wrote the previous numbers in an array. Thus, bar position and price position. From there you would be looping back to the first bar you would like to change, and a. erase its old number (write a space of sufficient width) and b. position the new number (which also involves the new vertical position, I think, but alas – you will see automatically).
Again, this will not be very simple and at least will involve more than I have time for. So I hope this gets you started ?
Maybe Roberto has some base code in his library he can provide (for you to work out further) ?
For your idea, in the attachment I do a kind of similar to help you better understand. The vertical bar you see there, has an offset from the righthand side of the chart. It is always at the same position, like 30 bars (each bar in this case is 5 minutes). Well, although this is a line, it could just as well be a number like the yellow numbers at the yellow arrows you see in there. And … those numbers change just the same. See second attachment for a few minutes and one or two bars later.
So it looks feasible …
PS: Open the attachments in a new tab/window in order to enlarge them sufficiently !