Alert counting and grouping: the ac and acg parameters

Autoview · Alert syntax

ac and acg are a pair. Together they let a command stay quiet until a run of alerts arrives in the right order, and only then act. ac is the step number, written as a fraction like 2/3. acg is the name of the counter that step belongs to. You send a series of alerts that walk through the steps, and the command on the last step is the one that actually trades.

Here is the shape of it:

ac=3/3 acg=breakout e=oanda s=EUR_USD b=long q=2%

On its own that line says: this is step 3 of 3 in a counter named breakout, and if the counter has already seen steps 1 and 2 in order, place the order. If it has not, do nothing and reset.

The rule: ac=n/d and acg=name

ac takes a fraction, n/d. The n is which step this alert is, the d is how many steps the sequence has. acg takes a plain name. That name is the counter the steps are tracked against, so two unrelated sequences using different names never interfere with each other.

Three things about the fraction:

  • It is written with a slash. ac=2/3 is step two of a three-step run. The numerator is the position, the denominator is the length.
  • A bare number is not a step count. If you write ac=3 with no slash, it does not mean step three. With no slash the value collapses to 1/1, a single-step sequence. To count steps you must write the fraction out.
  • Both parts are at least 1. A zero or a missing part is treated as 1.

What it actually counts

Each counter, named by acg, remembers the last step it accepted. When an alert with an ac arrives, Autoview checks whether its n is the next step in line:

  • If n is 1, the counter starts fresh at 1.
  • If n is exactly one more than the step the counter last accepted, the counter advances to n.
  • If n is anything else, the sequence is broken. The counter resets to 0 and this command stops without trading.

So the counter is not a "fire every Nth alert" tally. It is an ordered-sequence tracker. It only moves forward when the steps arrive in order, 1 then 2 then 3, each as its own alert pointing at the same acg name.

When the command actually runs

Reaching a step is not the same as acting on it. The command on a given step runs the rest of its line only when both of these are true:

  • The counter accepted the step, so the result is not 0 (the sequence is still intact), and
  • the step is the final one, meaning n is greater than or equal to d. That is what the code calls an improper fraction.

On every earlier step, the counter advances and logs its progress, but the command stops before trading. Only the last step, where n reaches d, lets the rest of the command through. And if any step arrives out of order, the counter resets to 0 and that command stops too.

A worked example

Three alerts, each its own TradingView alert, all pointed at a counter named confirm:

// alert 1 fires
ac=1/3 acg=confirm e=oanda s=EUR_USD b=long q=2%
// alert 2 fires
ac=2/3 acg=confirm e=oanda s=EUR_USD b=long q=2%
// alert 3 fires
ac=3/3 acg=confirm e=oanda s=EUR_USD b=long q=2%

Walk it through. Alert 1 sets the confirm counter to step 1 and stops, no order. Alert 2 advances it to step 2 and stops, no order. Alert 3 is step 3 of 3, the final step, so once it advances the counter the rest of the line runs and the long is placed. You needed all three confirmations, in order, before a single trade went out.

If alert 2 never arrives and alert 3 comes next, step 3 is not one more than step 1, so the counter resets to 0 and alert 3 does nothing. The sequence has to be clean.

What the log shows

Each time an ac command runs, Autoview logs the counter by name and the step it reached, like Alert Count (confirm): 2 / 3. When a step arrives out of order and the counter resets, the log reads Alert Count (confirm): reset instead. That line is how you see, after the fact, how far a sequence got and whether it completed or broke.

Why the group name matters

The acg name is what keeps independent sequences apart. Two strategies can both use a three-step confirmation at the same time, and as long as they use different acg names their counters never touch. Reuse the same name across unrelated alerts, though, and their steps will collide in one shared counter, so an out-of-order arrival from one breaks the other. Pick a name per sequence and keep it unique to that sequence.

Things worth knowing

  • One alert is one step. The counter advances per alert received, not within a single multi-line alert. The sequence is built across separate alerts that share an acg name.
  • Order is strict. Steps must arrive 1, 2, 3 with no gaps and no repeats. A skipped or duplicated step resets the counter to 0.
  • Only the last step trades. Earlier steps advance the counter and stop. Put the action you want gated on the final step, where n equals d.
  • A bare value runs immediately. ac=1/1, or any ac with no slash, is a complete one-step sequence, so it accepts step 1 and runs at once. That is rarely what you want from a counter.

For everything the order lines themselves can do, side, sizing, stops, order type and the rest, see the command reference, or the full alert syntax page.

Read the command reference