Alert counting and grouping: the ac and acg parameters
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.
It works on the Chrome extension and on the cloud webhook, with one difference in where the order goes. Both keep a counter per acg name and apply the same step rule, described below. On the extension, the rest of the ac line itself runs on the final step. On the webhook, the ac line never sends an order. It only takes the step, and the order has to sit on a later line, or after a pipe. Lines before the ac line are sent as normal. The webhook keeps its counter per account, so every hook on your account that uses the same acg name steps the same counter. The alert counting on the webhook guide walks through a webhook setup end to end.
Here is the shape of it on the Chrome extension, with the order on the same line:
ac=3/3 acg=breakout e=oanda s=EUR_USD b=long q=2%
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. Sent to the webhook, that same line places nothing, even on a clean final step, because the webhook never sends the ac line itself. The webhook form puts the order on the next line:
ac=3/3 acg=breakout
e=oanda s=EUR_USD b=long q=2%
On the webhook, the second line goes out only when step 3 completes the sequence in order. On any earlier step, or after a reset, the second line is dropped.
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/3is 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=3with no slash, it does not mean step three. With no slash the value collapses to1/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
nis 1, the counter starts fresh at 1. - If
nis exactly one more than the step the counter last accepted, the counter advances ton. - If
nis 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
nis greater than or equal tod. 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. That walk-through is the extension. To run the same sequence through the webhook, move e=oanda s=EUR_USD b=long q=2% onto its own line under each ac line, as in the webhook form above.
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
acgname. - 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
nequalsd. - A bare value runs immediately.
ac=1/1, or anyacwith 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. - On the webhook, the order goes after the
acline. The step rule is the same as on the extension, but the webhook never sends theacline itself. A non-final step or a reset drops theacline and every line after it. Lines before it still go. - If the webhook cannot reach the counter, it holds the order. The
acline and every line after it are dropped, earlier lines still go, and the Event Log shows analert_count_errorentry with status 503. The sender still gets a normal 200 reply, so check the Event Log rather than the alert source. acgdoes nothing by itself. The counter name is only ever consulted as part of handlingac. Settingacgon a command that has noachas no effect at all.
What is certain, and what is not
Certain from the code: on the Chrome extension, ac takes an n/d fraction and acg takes a plain name; the counter named by acg advances to n only when n is 1 or exactly one more than the last accepted step, and resets to 0 otherwise; and the rest of the command runs only when the counter is non-zero and n is greater than or equal to d.
Also certain from the code: the cloud webhook applies the same step rule, once per webhook, on a counter kept per account and acg name. The ac line is never sent as an order. On a reset or a non-final step, the ac line and every later line are dropped. On the final step, the later lines go through. When the counter cannot be reached, the ac line and every later line are dropped, earlier lines still go, the Event Log records an alert_count_error with status 503, and the HTTP reply to the sender stays 200. The stand-alone runner has the gating logic in its source but disabled, throwing an error rather than running it, so nothing is gated there.
Unknown from the code alone: exactly how long a stored counter persists on the extension, and how it behaves across a browser restart or a very long gap between steps. If a sequence needs to survive that reliably, test it against your own alerts rather than assuming.
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.