How do I number each high point?

In document we know the AFL is an array processing language.

so if we code the A = iif( v > ma(v, 3), 1, 0 ) ;

we can get a searial of A

how to count and set searial number

By set serial number means what?
You want to count and number each bar where A == 1

If so, loop through all the bars and use GFX.

There is no single loop required to count and plot.

A = V > MA(V, 3);
countA = Cum(A);
Plot( countA, "Count A", colorGreen, styleHistogram );
Plot( countA + A, "", colorRed, styleHistogram | styleNoLabel);
Title = StrFormat("{{DATE}}, %s A: %g %s, {{VALUES}}", EncodeColor(colorRed), A, EncodeColor(-1));

BTW, @junjun, use code tags for inserting code next time. You are here very long enough already.

@junjun, in addition to plots, I suggest to use also explorations to learn more about the results of many functions:

A = V > MA(V, 3);
countA = Cum(A);
countATrue = IIf(A, CountA, Null); 
Filter = 1;
AddColumn(A, "A", 1);
AddColumn(CountA, "Cumulative Count A", 1);
AddColumn(CountATrue, "Count A where A is True", 1);
if (Status("action") == actionExplore)

Apply it to the (*Current) instrument.

1 Like