Rules: when something is true, do something
The when rule and its timing modifiers.
A rule is when <condition> [modifiers]: followed by what to do. Name a rule with as to read its counters later, such as long_entry.triggers.
when long_setup.passed as long_entry every 4th:buy risk: risk, stop: atr(14) * 1.5, target: 3Rwhen starts(long_setup.passed) skip first 3 max 2 per day cooldown 30m:triggers += 1if triggers % 4 == 0:buy risk: 0.5%, stop: atr(14) * 1.5, target: 3RModifiers say when a rule may fire, on the rule itself, so there are no counters to build by hand:
| Modifier | What it does |
|---|---|
every <ordinal> | every bar | Act on every Nth trigger, or count every bar the condition holds. |
skip first <n> | Ignore the first N triggers, then act on every trigger. |
max <n> per <period> | Cap actions per day, session, hour or week. |
cooldown <duration | n bars> | Ignore triggers for a while after acting. |
once per bar | In tick mode, act at most once per bar. |
within sessions <name>, ... | Only trigger inside the named sessions. |
from <time> to <time> [zone] | Only trigger inside a daily time window. |