@battlegrid/mcp-server 32.0.86 → 32.0.89
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/SKILL.md +4 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/skills/EXPORT.json +13 -13
- package/skills/battlegrid-arena-play/SKILL.md +27 -6
- package/skills/battlegrid-officers/SKILL.md +1 -1
- package/skills/battlegrid-radar-deployment/SKILL.md +9 -4
- package/skills/battlegrid-radar-deployment/references/radar-stage-examples.md +4 -3
- package/skills/battlegrid-strategy-authoring/SKILL.md +93 -29
- package/skills/battlegrid-strategy-authoring/references/strategy-stage-examples.md +26 -3
- package/skills/battlegrid-strategy-doctor/SKILL.md +6 -3
- package/skills/battlegrid-strategy-examples/SKILL.md +371 -95
- package/skills/battlegrid-strategy-examples/references/playbooks.md +2 -2
- package/skills/battlegrid-strategy-examples/references/recipes.md +106 -0
- package/skills/battlegrid-strategy-examples/references/tradingview-ports.md +76 -22
- package/skills/battlegrid-trade-analysis/SKILL.md +13 -4
|
@@ -36,6 +36,7 @@ Before committing a CREATE, every "no" here is a decision to state, not an omiss
|
|
|
36
36
|
| `trajectory` w4 | `<code>_t3…_t1`, `_now`, `_trend` (rising/falling/flat) | `RSI14_now`, `RSI14_trend` |
|
|
37
37
|
| `distance` | `dist_<code>` (signed % from price) | `dist_SMA50` |
|
|
38
38
|
| `spread` | `<base>_<operand>_spread` | `mark_oracle_spread` |
|
|
39
|
+
| `spread` against an average `{ metric, transformId, window }` | `<base>_<operand code>_spread` | `close_close_ema100_spread`, `close_ema34_close_ema89_spread` |
|
|
39
40
|
| `aggregate` wN | `<code>_mean<N>` | `rate_mean24` |
|
|
40
41
|
| `rank` | `<code>_rank_<hi\|lo\|far\|near>` — ordinal, `lte N` = top-N | `bbWidthPct_rank_lo` |
|
|
41
42
|
| `efficiency` wN | `<code>_er` (1 straight, ~0 chop) — N changes, reading N + 1 bars | `close_ltf_er` |
|
|
@@ -46,7 +47,7 @@ Before committing a CREATE, every "no" here is a decision to state, not an omiss
|
|
|
46
47
|
| `pctl` wN | `<code>_pctl<N>` (0–100 against the N prior bars) | `RSI14_pctl20` |
|
|
47
48
|
| `rollingMin` / `rollingMax` wN | `<code>_min<N>` / `<code>_max<N>`; at `offset` K > 0 `<code>_o<K>_min<N>` | `low_min20`, `high_max20`, `high_o1_max55` |
|
|
48
49
|
| `classifyZone` / `classifyState` | `<code>_zone` / `<code>_state` | `RSI14_zone`, `ADX14_state` |
|
|
49
|
-
| `levelInteraction` | `<code>_lvl`, `<code>_lvl_b<N>` at a buffer of N bps | `bbUpper20_lvl`, `bbUpper20_lvl_b25` |
|
|
50
|
+
| `levelInteraction` | `<code>_lvl`, `<code>_lvl_b<N>` at a buffer of N bps, `<code>_lvl_a<m>` at `touchAtr` m | `bbUpper20_lvl`, `bbUpper20_lvl_b25`, `EMA20_lvl_a0.5` |
|
|
50
51
|
| any, stored `"bars": "all"` | `<code>_dev`, then the transform's suffix | `RSI14_dev_t1` |
|
|
51
52
|
| `value` at `offset` N > 0 | `<code>_o<N>` | `RSI14_1d_o1` |
|
|
52
53
|
|
|
@@ -109,9 +110,14 @@ absolute reference is REFUSED at save, including `1d`,
|
|
|
109
110
|
because there is no rung for one to select. They are catalogued price levels, so `dist_PDH gte 0`
|
|
110
111
|
composes directly. (`distance` still rejects an `offset`, and a clause still compares a column
|
|
111
112
|
with a literal or with its own previous completed bar, never with another column; neither of those
|
|
112
|
-
shapes is what a previous-UTC-day level needed.)
|
|
113
|
-
|
|
114
|
-
|
|
113
|
+
shapes is what a previous-UTC-day level needed.) Every bar reads the level as it stood when that bar
|
|
114
|
+
OPENED, kept for the newest 24 strategy bars: on a `1d` strategy, day D's bar reads `PDH` = the high of
|
|
115
|
+
day D−1, so `dist_PDH gt 0` fires on the day that closes above it, and `dist_PDH crossesAbove 0` compares
|
|
116
|
+
two bars that each read their own day's level — the first bar of a new day included. A `spread` of a
|
|
117
|
+
bar's own value against one of these levels reads that bar's level the same way. A relation over a
|
|
118
|
+
session-profile level — `spread`, `distance` or `levelInteraction`, chained forms included, the level as its
|
|
119
|
+
side or its operand — is built only on the strategy's anchor rung (`{rel: 'anchor'}`): on any other rung the
|
|
120
|
+
operand is not offered and the column is REFUSED at save. The same holds
|
|
115
121
|
for every timeless metric — these levels, funding, the regime and the other bundle
|
|
116
122
|
reads: a `value` column over one accepts only `offset: 0`, and a larger offset is REFUSED at save,
|
|
117
123
|
because there is no earlier bar to cut back to.
|
|
@@ -127,7 +133,7 @@ group (contract `84.0.0`) — and so is a boolean `exit` key: the side an exit c
|
|
|
127
133
|
`lt|lte|gte|gt|between` and the prior-bar operators `crossesAbove|crossesBelow|increased|decreased`;
|
|
128
134
|
rank headers take the comparisons only; classification, direction and boolean headers take
|
|
129
135
|
`is|in|enters|exits` with the served vocabulary; event headers take `is|in`. Groups:
|
|
130
|
-
`ALL | ANY | NOT | N_OF` (with `n`), depth ≤ 2. Every clause and every group carries a required
|
|
136
|
+
`ALL | ANY | NOT | N_OF` (with `n`) | `SEQUENCE` (with `within`, root only), depth ≤ 2. Every clause and every group carries a required
|
|
131
137
|
`hold: { atLeast, of }` — `{ "atLeast": 1, "of": 1 }` is a single read; a clause or group without
|
|
132
138
|
`hold` is refused (`CONDITION_HOLD_INVALID`). `conditionRef` composes named conditions (no
|
|
133
139
|
cycles; forward refs legal) and carries no hold of its own. `sectionKey: null` is sugar for a report-unique header only.
|
|
@@ -159,12 +165,13 @@ bar before: a header whose `conditionHold.maxWindow` is 1 is served none of the
|
|
|
159
165
|
`vol24hUsd increased` is refused (`CONDITION_OPERATOR_UNSUPPORTED`, naming the operators it does
|
|
160
166
|
admit), and on a header that keeps them each reads one bar less than its window.
|
|
161
167
|
|
|
162
|
-
**An edge is
|
|
163
|
-
the bar a state changed, so
|
|
164
|
-
|
|
165
|
-
`
|
|
166
|
-
|
|
167
|
-
|
|
168
|
+
**An edge is counted by the closes it fired on.** `crossesAbove`, `crossesBelow`, `enters` and `exits`
|
|
169
|
+
mark the bar a state changed, so a hold over one counts the closes it fired on: "at least k of n closes"
|
|
170
|
+
is Pine's `math.sum(cond ? 1 : 0, n) >= k`, and `{ 2, 10 }` is "fired on at least 2 of the last 10
|
|
171
|
+
closes". `{ n, n }` over one edge reads TRUE only where it fired on every one of the n closes, which a
|
|
172
|
+
single crossing never does twice in a row. `increased` and `decreased` are no edge: "3 closes in a row"
|
|
173
|
+
of `increased` is three rising closes. Every prior-bar read counts toward the frame-read budget: a
|
|
174
|
+
clause held "within 3 closes" reads four bars.
|
|
168
175
|
|
|
169
176
|
Recipes — each one clause:
|
|
170
177
|
|
|
@@ -186,6 +193,15 @@ Recipes — each one clause:
|
|
|
186
193
|
close above the raised rail — the run of new closing highs ended.
|
|
187
194
|
- **RSI crossed above 50 within the last 3 closes** — `RSI14_now crossesAbove 50` holding
|
|
188
195
|
`{ "atLeast": 1, "of": 3 }`.
|
|
196
|
+
- **Close crossed above a 100 EMA** (a length with no stored point) — `close_close_ema100_spread crossesAbove 0`,
|
|
197
|
+
over `CLOSE × spread` with the operand `{ "metric": "CLOSE", "transformId": "ema", "window": 100 }`: the close's
|
|
198
|
+
signed % gap from `ta.ema(close, 100)`. A stored length keeps its own code: the 20 SMA is `dist_SMA20`.
|
|
199
|
+
- **EMA 34 crossed above EMA 89** — `close_ema34_close_ema89_spread crossesAbove 0`, over `CLOSE × ema` at
|
|
200
|
+
`window: 34` chained into `spread` with the operand `{ "metric": "CLOSE", "transformId": "ema", "window": 89 }`:
|
|
201
|
+
Pine's `ta.crossover(ta.ema(close, 34), ta.ema(close, 89))`. The operand's average is one of `aggregate` (the
|
|
202
|
+
simple average), `ema`, `rma`, `wma`, at a length of at least 2, and nothing chains over the spread.
|
|
203
|
+
- **Two crosses of the 20 EMA in 10 bars** — `dist_EMA20 crossesAbove 0` holding
|
|
204
|
+
`{ "atLeast": 2, "of": 10 }`: the close crossed above the average on at least 2 of the last 10 closes.
|
|
189
205
|
|
|
190
206
|
**Two things block a trade, not one.** `required: true` = a FALSE reading blocks compose-trade
|
|
191
207
|
before billing. And the RESOLVED verdict binds entry DIRECTION: `UP` admits long setups only,
|
|
@@ -241,8 +257,8 @@ Inline it when:
|
|
|
241
257
|
`conditionRef`, so "together on 3 closes in a row" over a sub-rule needs its clauses inline.
|
|
242
258
|
|
|
243
259
|
Inlining a `NOT` is not always a flipped operator. A clause whose read ran and found no value reads
|
|
244
|
-
FALSE, so `NOT [
|
|
245
|
-
`
|
|
260
|
+
FALSE, so `NOT [dist_donchianHiPrior20 gt -0.52]` reads TRUE on a coin with no channel value while
|
|
261
|
+
`dist_donchianHiPrior20 lte -0.52` reads FALSE; `NOT [CVD_state is "bearish"]` and
|
|
246
262
|
`CVD_state in ["bullish", "neutral"]` part the same way. Flip only a header that always carries a
|
|
247
263
|
value, or choose deliberately which answer a missing value gives.
|
|
248
264
|
|
|
@@ -292,8 +308,10 @@ the served domain is refused (`CONDITION_HOLD_ILLEGAL`, the domain in `allowedDo
|
|
|
292
308
|
a header admits only Once:
|
|
293
309
|
|
|
294
310
|
- `NOT_REWINDABLE` — the value is stored for the current bar only (the session-field scalars,
|
|
295
|
-
ranks,
|
|
296
|
-
`LIQUID_FLOOR` holds Once because `vol24hUsd` is a bundle scalar.
|
|
311
|
+
ranks, enrichment metrics, a change at or below the strategy timeframe). **Worked liquidity floor:**
|
|
312
|
+
`LIQUID_FLOOR` holds Once because `vol24hUsd` is a bundle scalar. A structure-zone column is not one of
|
|
313
|
+
these: it holds on its own timeframe up to the window its `conditionHold` serves, each counted bar
|
|
314
|
+
reading the zone set stored for that bar.
|
|
297
315
|
- `DEVELOPING` — the column reads a bar still forming: a Developing candle column above the strategy
|
|
298
316
|
timeframe, or a change over a horizon above it. **Developing columns cannot be held**; set a candle
|
|
299
317
|
column Confirmed to count closes, or read a change at or below the strategy timeframe.
|
|
@@ -305,7 +323,7 @@ Candle columns (at, above or below the strategy timeframe), the market and stabl
|
|
|
305
323
|
(each counted on its subject's own bars), the regime (counted on the regime rung),
|
|
306
324
|
and the funding and open-interest histories (on the coarser of the strategy timeframe and their own
|
|
307
325
|
hourly cadence) can all be held. **A crossover is an event**: it fires on the bar a state changes,
|
|
308
|
-
so
|
|
326
|
+
so a hold over it counts the closes it fired on, as an edge's does.
|
|
309
327
|
|
|
310
328
|
**Group hold — closes counted together.** A group's `hold` counts its members' joint reading on the
|
|
311
329
|
same bar: the group's own outcome, its members folded by its operator, must read TRUE on at least
|
|
@@ -313,18 +331,72 @@ same bar: the group's own outcome, its members folded by its operator, must read
|
|
|
313
331
|
"together": "together on 3 closes in a row", "together within 5 closes", "together on at least 2 of
|
|
314
332
|
5 closes". Inside a group holding more than Once, every member holds Once and none is a
|
|
315
333
|
`conditionRef` — each read is counted by exactly one hold — so a row holding its own closes, a
|
|
316
|
-
reference, or a held group inside is refused, naming the member. A conjunction
|
|
317
|
-
|
|
334
|
+
reference, or a held group inside is refused, naming the member. A conjunction over a crossover
|
|
335
|
+
(`ALL(cross, x)`) counts the closes on which both read TRUE together. Reach for a split to keep a condition's
|
|
318
336
|
MEANING separable; a reference carries its condition's one answer for the bar being decided and is
|
|
319
337
|
never counted across closes.
|
|
320
338
|
|
|
339
|
+
**In order — steps over a window.** An entry condition's ROOT group may be
|
|
340
|
+
`{ "kind": "group", "op": "SEQUENCE", "within": 8, "hold": { "atLeast": 1, "of": 1 }, "members": [ … ] }` —
|
|
341
|
+
the editor's **In order**. Its members are its steps, in order, at least two: each step is one
|
|
342
|
+
clause, one group of clauses, or a `conditionRef` to a condition that reads one bar (one clause or
|
|
343
|
+
one group of clauses, no reference, every hold Once). It reads TRUE when every step reads TRUE on a
|
|
344
|
+
bar of the window, each on a STRICTLY later bar than the step before, and the last step on a bar
|
|
345
|
+
that closed inside the decided strategy bar — so steps on a timeframe coarser than the strategy's
|
|
346
|
+
complete only when the decided close is one of that timeframe's own closes, and read FALSE on every
|
|
347
|
+
other; two steps never match the same bar, neither of the window's timeframe nor of either step's own
|
|
348
|
+
(two `1h` steps counted on `15m` bars never both match one hour), and an older match never
|
|
349
|
+
stands in for a missing later one. The window counts `within` completed bars of the steps' finest column
|
|
350
|
+
timeframe (at least 2, at most what the steps' columns serve — the group hold rule over the steps,
|
|
351
|
+
references expanded), so on a `15m` step under a `1h` strategy the last step may read TRUE on any of
|
|
352
|
+
the four `15m` bars inside the decided `1h` bar. Every step and the sequence hold Once: the window is
|
|
353
|
+
the count. A step reads UNRESOLVED where its bar is unreadable, and the sequence reads UNRESOLVED only
|
|
354
|
+
when an unreadable bar could still complete the match. The sequence is root only (never inside a
|
|
355
|
+
group, never a step of another) and entry only: an exit rule that is one, or reads one, is refused
|
|
356
|
+
(`CONDITION_EXIT_SEQUENCE_UNSUPPORTED`). A misshapen sequence is refused with
|
|
357
|
+
`CONDITION_SEQUENCE_INVALID` — for a step reference, `details.context.refusal` names why the referenced
|
|
358
|
+
condition is not one bar (`STEP_HOLDS_WINDOW`, `STEP_NESTS_GROUP`, `STEP_READS_REFERENCE`,
|
|
359
|
+
`STEP_IS_SEQUENCE`) — and a window outside its domain with `CONDITION_SEQUENCE_WINDOW_INVALID`, the domain
|
|
360
|
+
in `allowedDomain`. Its evidence is one `kind: "sequence"` line — each step's `outcome`, `matchedBar`
|
|
361
|
+
(`closesBack` on the window's `timeframe`) and `reference` — followed by the matched steps' own clause
|
|
362
|
+
lines, each read at the bar it matched.
|
|
363
|
+
|
|
364
|
+
Worked, in the shape Pine users write most:
|
|
365
|
+
|
|
366
|
+
- **"A happened within the last N bars, and B is true now"** — Pine `ta.barssince(A) <= N and B` — is
|
|
367
|
+
In order within N+1 [A, B], with B the LAST step, so B reads TRUE on the decided bar and A on one
|
|
368
|
+
of the N bars before it. `MACD_TURNED` = In order within 6 [`MACD_CROSS_UP`, `RSI_ABOVE_50`] is Pine
|
|
369
|
+
`ta.barssince(ta.crossover(macd, signal)) <= 5 and rsi > 50`.
|
|
370
|
+
- **The lower timeframe last**: `LONG_TRIGGER` = In order within 8 [`NEAR_SWING_LOW`, `LTF_TURN_UP`]
|
|
371
|
+
reads "near a swing low, then a lower-timeframe turn up, inside 8 bars" — and the 8 are bars of the
|
|
372
|
+
finest step's timeframe, so with a `15m` turn under a `1h` strategy the window is 8 × 15m = 2h, not 8
|
|
373
|
+
strategy bars. No one Pine line says this: `request.security` on the lower timeframe returns only its
|
|
374
|
+
last bar inside the chart bar, while the sequence lets the turn match on ANY `15m` bar of the window
|
|
375
|
+
inside the decided hour.
|
|
376
|
+
|
|
377
|
+
Two differences from Pine: two steps never share a bar. The sequence finds A on ANY earlier bar of the
|
|
378
|
+
window (Pine's `ta.barssince` reports only the most recent A), so it fails to complete only where A's sole
|
|
379
|
+
occurrence in the window is B's own bar — where Pine's `ta.barssince(A)` is 0. To accept that case too,
|
|
380
|
+
make the sequence its own condition and enter on an `ANY` over its `conditionRef` and the one-bar group
|
|
381
|
+
A AND B. And a step whose bar is unreadable reads UNRESOLVED, never FALSE, where Pine's `na` makes the
|
|
382
|
+
comparison false.
|
|
383
|
+
|
|
384
|
+
A swing-failure pattern on ONE candle is not an ordering: it is a single `levelInteraction`
|
|
385
|
+
clause, `is "reject_from_above"` at a swing low's level (`reject_from_below` at a high); "on the
|
|
386
|
+
same or the next candle" is an `ANY` over that clause and a sequence of the sweep and the reclaim
|
|
387
|
+
within 2 — and ANY is not the root sequence, so that sequence is its own condition the `ANY` reads by
|
|
388
|
+
`conditionRef`, which the entry may do. Neither is a parity claim for a TradingView sweep or SFP
|
|
389
|
+
script: name what the port gives up. That sequence needs a level that outlives the close beyond it, so
|
|
390
|
+
a liquidity pool takes its own next-candle form instead: the close beyond retires the pool, and the next
|
|
391
|
+
bar reads the reclaim column, `poolAboveRecl is "true"` (`## Market structure levels`).
|
|
392
|
+
|
|
321
393
|
**Confirmed / Developing, per candle column.** Every transform whose home is the coin's candle series
|
|
322
394
|
carries `bars`: `"closed"` is Confirmed — the newest bar completed at the strategy close — and
|
|
323
395
|
`"all"` is Developing, the higher-timeframe bar still in progress at that close, which REPAINTS until
|
|
324
|
-
it completes. Left unset
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
396
|
+
it completes. Left unset a column reads Confirmed at every timeframe; Developing applies only where
|
|
397
|
+
you choose it. At or below the strategy timeframe a Developing choice sets only what the live lane
|
|
398
|
+
shows — no bar is in progress at the anchor's own close — so there it is legal and changes no decision
|
|
399
|
+
taken at that close. A condition reading a
|
|
328
400
|
developing bar is single-frame: its clause holds Once (a Developing column cannot be held), it
|
|
329
401
|
carries no verdict and it cannot be an exit rule. One exception overrides both the stored value and the default: a column reading a metric with
|
|
330
402
|
no live value (itself, or a `spread` operand) reads completed bars at every rung, because the forming
|
|
@@ -333,14 +405,15 @@ horizon in the metric, so above the strategy timeframe it is Developing at every
|
|
|
333
405
|
selector. The resolved answer for a column is served on `effectiveParameters.bars`, and it states both
|
|
334
406
|
exceptions.
|
|
335
407
|
|
|
336
|
-
**A higher-timeframe level is measured from
|
|
337
|
-
Donchian band
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
bar's close
|
|
342
|
-
|
|
343
|
-
|
|
408
|
+
**A higher-timeframe candle-homed level is measured from that timeframe's own bar close.** The
|
|
409
|
+
distance to a `4h` Donchian band reads the `4h` bar's own close at every slot, the newest included, as
|
|
410
|
+
the `4h` chart reads it — so it changes once per `4h` bar, and the `levelInteraction` label on the same
|
|
411
|
+
level reads the same bar. `PRICE_ZONE` classifies its own bar's close the same way. A period level or a
|
|
412
|
+
mark (`PDH`, a session level, `MARK`) is measured from the current strategy-bar price, `LAST` — the
|
|
413
|
+
strategy bar's close under a decision, the last traded price on display — and an earlier bar's distance
|
|
414
|
+
to a period level from that bar's close against the level its own bar opened with. A breakout chain
|
|
415
|
+
(`rollingMax(n, offset 1) × distance`) reads each bar's own close against the rolling extreme, as the
|
|
416
|
+
distance to the catalogued `DONCHIAN_UPPER_PRIOR` does.
|
|
344
417
|
|
|
345
418
|
**The lane a strategy is deployed to.** The one report-level scalar family is the **session field**:
|
|
346
419
|
five scalars (`fieldPlayers`, `fieldUpBias`, `fieldBiasDir`, `captConc`, `picksSpread`, each headed
|
|
@@ -418,45 +491,77 @@ one of five labels: `touch_from_below`, `touch_from_above`, `reject_from_below`,
|
|
|
418
491
|
below when it closed at or under it. For a level computed from its own bar (a band, `VWAP`, a moving
|
|
419
492
|
average, `ST_LINE`, `PSAR`, the Ichimoku conversion and base lines) that is the prior bar's level, so a
|
|
420
493
|
level that moved between the two bars is judged on the bar it stood at; for a level whose price was fixed
|
|
421
|
-
before the bar (a prior-bar Donchian rail, the break memory, a swing level, the displaced Ichimoku lines, a
|
|
422
|
-
prior-UTC-day or previous trading-session level or pivot) it is the bar's own level.
|
|
494
|
+
before the bar (a prior-bar Donchian rail, the break memory as of the bar before, a swing level, the displaced Ichimoku lines, a
|
|
495
|
+
prior-UTC-day or previous trading-session level or pivot) it is the bar's own level. A developing session
|
|
496
|
+
level (`TPO_POC`, `LONDON_HIGH`, an opening range, a single print, …) is read on a completed bar, as both
|
|
497
|
+
the side and the level, as it stood when the bar opened — the prior bar's reading in the same day or session
|
|
498
|
+
— so a bar that prints a new session high and closes above the old one reads `none` and
|
|
499
|
+
`dist_LONDON_HIGH crossesAbove 0` fires; on the day's or session's first bar no such level is in force and
|
|
500
|
+
the clause is unresolved. A live read's still-forming bar keeps the level as it stands at the read, the value
|
|
501
|
+
a chart shows, and takes its side from the level in force at the bar's open. From below: a bar that closes through the level is a break and reads `none`; a bar whose high
|
|
423
502
|
reached the level and whose close came back under it is `reject_from_below`; a bar whose high came
|
|
424
|
-
within the
|
|
503
|
+
within the TOUCH tolerance of the level is `touch_from_below`. From above is the mirror on the low. A
|
|
504
|
+
close through the level in force reads `none` in either direction, a prior close exactly on the level
|
|
505
|
+
included — that bar is the `distance` crossing (Pine's `ta.crossover`: on or under the level before,
|
|
506
|
+
above it now).
|
|
425
507
|
|
|
426
508
|
- **A reject bar reports reject.** It is never also reported as a touch, so "touched or rejected" is
|
|
427
509
|
an `in` clause over both labels of a side: `bbUpper20_lvl in ["touch_from_below","reject_from_below"]`.
|
|
428
|
-
-
|
|
429
|
-
|
|
430
|
-
`
|
|
510
|
+
- **The TOUCH tolerance is one knob, never two.** A column carries exactly one of `buffer` — whole
|
|
511
|
+
basis points of the level, default `0` (exact contact); `buffer: 25` is 0.25%, header `<code>_lvl_b25`
|
|
512
|
+
— or `touchAtr` — a multiple of the column rung's ATR14 at the prior bar, header `<code>_lvl_a<m>`
|
|
513
|
+
(`touchAtr: 0.5` on `EMA20` is `EMA20_lvl_a0.5`) — never both. Only the touch reads it: a close through
|
|
514
|
+
the level and a reject are decided before any tolerance, and a reject must pierce the level itself.
|
|
515
|
+
Their ranges and steps are the served authoring parameters', read from the column contract. A
|
|
516
|
+
`touchAtr` column reads `null` on a bar whose prior bar has no ATR14 yet. Two tolerances are two
|
|
517
|
+
columns (`bbUpper20_lvl`, `bbUpper20_lvl_b25`).
|
|
431
518
|
- **A break is a crossing, never a label.** The break of a level is `distance` over the same level
|
|
432
519
|
crossing 0: `dist_bbUpper20 crossesAbove 0` from below, `crossesBelow 0` from above. On the strategy's
|
|
433
520
|
own rung a `…_from_below` label never holds on a bar where `crossesAbove 0` holds.
|
|
434
521
|
- **Which levels take it.**
|
|
435
522
|
- **Offered:** a candle-homed level — a band (`BB_UPPER`, `BB_LOWER`, `KC_UPPER`, `KC_LOWER`),
|
|
436
523
|
`VWAP`, a moving average (`SMA20`, `EMA20`, …), `ST_LINE`, `PSAR`, the prior-bar Donchian rails
|
|
437
|
-
(`DONCHIAN_UPPER_PRIOR`, `DONCHIAN_LOWER_PRIOR`), the Donchian break memory
|
|
438
|
-
`
|
|
524
|
+
(`DONCHIAN_UPPER_PRIOR`, `DONCHIAN_LOWER_PRIOR`), the Donchian break memory as of the bar before
|
|
525
|
+
(`DONCHIAN_BROKEN_HI_PRIOR`, `DONCHIAN_BROKEN_LO_PRIOR`, Pine's `brk[1]`), the Ichimoku lines, the swing levels (`SWING_FRACTAL_HIGH`,
|
|
439
526
|
`SWING_FRACTAL_LOW`) — reads its own value at each bar. A prior-UTC-day level or pivot (`PDH`, `PDL`,
|
|
440
|
-
`PDO`, `PIVOT_P`, `PRIOR_TPO_POC`, …)
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
527
|
+
`PDO`, `PIVOT_P`, `PRIOR_TPO_POC`, …), a previous trading-session level (`PRIOR_LONDON_HIGH`, …) and
|
|
528
|
+
every developing session level — the developing day, week and month value area and point of control
|
|
529
|
+
(`TPO_POC`, `TPO_VAH`, `WEEK_TPO_POC`, …), the current trading sessions' highs, lows and opens
|
|
530
|
+
(`LONDON_HIGH`, `ASIA_OPEN`, …), the opening ranges, the initial balance and its extensions, and today's
|
|
531
|
+
single prints (`TPO_SINGLE_PRINT_ABOVE`/`_BELOW`) — reads each bar's own snapshot of the profile, kept
|
|
532
|
+
for the newest 24 strategy bars, so a clause over it can be held across them as any other clause: at
|
|
533
|
+
12:00 on a `1h` strategy `LONDON_HIGH` reads London's high, and the bar before it read London's high as
|
|
534
|
+
it stood then; a verb over a developing level reads it as it stood when its bar opened. A structure zone's edge
|
|
535
|
+
(`ZONE_SUPPORT_HIGH` `zoneSupHi`, `ZONE_SUPPORT_LOW` `zoneSupLo`, `ZONE_RESIST_HIGH` `zoneResHi`,
|
|
536
|
+
`ZONE_RESIST_LOW` `zoneResLo`), and its midpoint, `(high + low) / 2` — the FVG split, ICT's consequent
|
|
537
|
+
encroachment (`ZONE_SUPPORT_MID` `zoneSupMid`, `ZONE_RESIST_MID` `zoneResMid`), at the strategy's anchor rung
|
|
538
|
+
only, reads at each completed bar the nearest zone of the zones standing when that bar opened — so a zone first
|
|
539
|
+
found from the bar's own data is not its level, and the zone its own close fills still is; the midpoint is always
|
|
540
|
+
the zone its side's edges read. On `PSAR` a wick that
|
|
444
541
|
trades through the SAR flips it on that bar, so a rejection needs the low (high) to meet the SAR
|
|
445
|
-
exactly and a touch needs a
|
|
446
|
-
- **Not offered:**
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
542
|
+
exactly and a touch needs a tolerance; its flip is `dist_PSAR crossesAbove 0` / `crossesBelow 0`.
|
|
543
|
+
- **Not offered:** the naked points of control and the naked single prints (`NAKED_POC_ABOVE`,
|
|
544
|
+
`NAKED_POC_BELOW`, `NAKED_SINGLE_PRINT_ABOVE`, `NAKED_SINGLE_PRINT_BELOW`), each chosen as the nearest
|
|
545
|
+
untested level beyond the bar's own close, so a close can never pass it — read the distance to it; and
|
|
546
|
+
the same-bar Donchian rails (`DONCHIAN_UPPER`, `DONCHIAN_LOWER`), each the extreme of the window ending at the very bar it would
|
|
547
|
+
classify, which a close can never pass — read `DONCHIAN_UPPER_PRIOR` / `DONCHIAN_LOWER_PRIOR`. The same rule refuses
|
|
548
|
+
them under `distance`; the same-bar gap is `CLOSE × spread(DONCHIAN_UPPER)` (`close_donchianHi20_spread`), a
|
|
549
|
+
number that is never above 0 and so never a breakout; and
|
|
550
|
+
the Donchian break memory itself (`DONCHIAN_BROKEN_HI`, `DONCHIAN_BROKEN_LO`), which the bar's own close
|
|
551
|
+
records or clears, so the bar it is broken or recovered on has no level in force at its open — read
|
|
552
|
+
`DONCHIAN_BROKEN_HI_PRIOR` / `DONCHIAN_BROKEN_LO_PRIOR`, the memory as it stood after the bar before
|
|
553
|
+
(`value` and `distance` over the memory stay offered). A
|
|
554
|
+
price fact (`CLOSE`, `HLC3`, `MARK`) is refused: it is the price, not a level. Under `distance`, `CLOSE` and
|
|
555
|
+
`LAST` are refused at every rung: a distance is measured from the bar's own close (the last price for a bundle
|
|
556
|
+
level), so from either it is 0 on every bar.
|
|
453
557
|
- **A higher-rung level reads that rung's completed bar.** `bbUpper20_htf_lvl` classifies the last
|
|
454
558
|
completed regime-rung bar from its own high, low and close, never the strategy bar's price — so
|
|
455
559
|
compose its break on the same rung, `dist_bbUpper20_htf crossesAbove 0`.
|
|
456
560
|
|
|
457
|
-
**`
|
|
458
|
-
|
|
459
|
-
the bar's RANGE did at the edge — touched it,
|
|
561
|
+
**`pctB20` and `BB_UPPER × levelInteraction` answer different questions.** `pctB20` (`BB_PCT_B`) says
|
|
562
|
+
where the CLOSE sits in the envelope — `pctB20 lt 0.05` closed in the bottom 5%, `gt 0.95` in the top 5%, a
|
|
563
|
+
threshold, never a touch. `BB_UPPER × levelInteraction` says what the bar's RANGE did at the edge — touched it,
|
|
564
|
+
or pierced it and closed back.
|
|
460
565
|
|
|
461
566
|
**Candle patterns** — the bar's shape against the ten bars before it (TA-Lib's default settings). A
|
|
462
567
|
pattern carries no trend context: "a hammer in a downtrend" is `pin is "lower_wick"` plus a separate
|
|
@@ -498,6 +603,38 @@ Recipes — the level recipes on candle-homed levels:
|
|
|
498
603
|
- **Price touched or rejected VWAP from above** — `VWAP_lvl in ["touch_from_above","reject_from_above"]`,
|
|
499
604
|
with `buffer: 10` for a touch within 0.1% (header `VWAP_lvl_b10`).
|
|
500
605
|
- **Price broke the 20 EMA** — `dist_EMA20 crossesAbove 0`, the `distance` column over the same level.
|
|
606
|
+
- **Touched the 20 EMA within half an ATR** — an `EMA20 × levelInteraction` column with `touchAtr: 0.5`,
|
|
607
|
+
header `EMA20_lvl_a0.5`; the clause `EMA20_lvl_a0.5 in ["touch_from_above","reject_from_above"]`. The
|
|
608
|
+
column carries `buffer` or `touchAtr`, never both.
|
|
609
|
+
- **Retested the broken 20-bar high and held** — a `DONCHIAN_BROKEN_HI_PRIOR × levelInteraction` column
|
|
610
|
+
with `buffer: 20`, header `donchianBrkHiPrior20_lvl_b20`; the clause
|
|
611
|
+
`donchianBrkHiPrior20_lvl_b20 in ["touch_from_above","reject_from_above"]`. The twin is the break that
|
|
612
|
+
stood when the bar opened, so a bar whose own close records a newer break is still judged against the
|
|
613
|
+
older one.
|
|
614
|
+
- **Failed breakout: lost the broken 20-bar high** — `dist_donchianBrkHiPrior20 crossesBelow 0`: the bar
|
|
615
|
+
closed back under the break that stood when it opened; `dist_donchianBrkHiPrior20 lt 0` is the state.
|
|
616
|
+
On that bar the memory itself (`donchianBrkHi20`) reads no value, because the close cleared it.
|
|
617
|
+
- **Price rejected the top of the support zone** — a `ZONE_SUPPORT_HIGH × levelInteraction` column,
|
|
618
|
+
header `zoneSupHi_lvl`; the clause `zoneSupHi_lvl is "reject_from_above"`: the low pierced the nearest
|
|
619
|
+
support zone's high and the close came back above it.
|
|
620
|
+
- **Price lost the support zone** — `dist_zoneSupLo crossesBelow 0`, the `distance` column over the zone's
|
|
621
|
+
low: the close through its far edge, the close that fills the zone. A close exactly on the low is not.
|
|
622
|
+
Author it on the `CONFIRMING_CLOSE` basis: on the `LIVE` basis the live price picks a zone it has not
|
|
623
|
+
passed, so `dist_zoneSupLo` reads `0` or above and never crosses below.
|
|
624
|
+
- **Inside or near the support zone** — the nearest-zone distance reads `0` while price is inside the zone,
|
|
625
|
+
so "inside or within 1% above the nearest support zone" is `zones_support_dist between 0 1`;
|
|
626
|
+
`dist_zoneSupHi` is the signed distance to the zone's top and reads below `0` inside it.
|
|
627
|
+
|
|
628
|
+
Confirmation recipes — each composed from `distance` and the hold, never from a label:
|
|
629
|
+
|
|
630
|
+
- **Broke by at least X%** — `dist_EMA20 crossesAbove 0.5`: the close crossed 0.5% above the average.
|
|
631
|
+
- **Broke and held 3 closes** — `dist_EMA20 crossesAbove 0` holding `{ "atLeast": 1, "of": 3 }` AND
|
|
632
|
+
`dist_EMA20 gt 0` holding `{ "atLeast": 3, "of": 3 }`: it crossed within the last 3 closes and closed
|
|
633
|
+
above on all 3.
|
|
634
|
+
- **Above the level 3 closes in a row** — `dist_EMA20 gt 0` holding `{ "atLeast": 3, "of": 3 }` alone is a
|
|
635
|
+
state, never "broke and held": it holds on every close of a run that began long before.
|
|
636
|
+
- **Rejected and closed back by X%** — `EMA20_lvl is "reject_from_below"` AND `dist_EMA20 lt -0.3`: the
|
|
637
|
+
high pierced the average and the close came back at least 0.3% under it.
|
|
501
638
|
- **A bullish engulfing within the last 3 bars** — `engulf is "bullish"` holding
|
|
502
639
|
`{ "atLeast": 1, "of": 3 }`.
|
|
503
640
|
- **An inside bar** — `barContain is "inside"`.
|
|
@@ -509,9 +646,10 @@ Recipes — the level recipes on candle-homed levels:
|
|
|
509
646
|
|
|
510
647
|
## Swing structure
|
|
511
648
|
|
|
512
|
-
Swing highs, swing lows and the structure they spell, from the market-data swing engine.
|
|
513
|
-
is stored under the bar it describes, so a swing column holds and takes the prior-bar
|
|
514
|
-
any candle column.
|
|
649
|
+
Swing highs, swing lows and the structure they spell, from the market-data swing engine. At the default
|
|
650
|
+
pair every value is stored under the bar it describes, so a swing column holds and takes the prior-bar
|
|
651
|
+
operators like any candle column. Off it the server computes the swings over the column's own bars, and a
|
|
652
|
+
condition over the column reads one bar (*Off 2/2* below).
|
|
515
653
|
|
|
516
654
|
| Key | Header | Reads |
|
|
517
655
|
|---|---|---|
|
|
@@ -519,23 +657,28 @@ any candle column.
|
|
|
519
657
|
| `SWING_FRACTAL_LOW` | `fractalLo` | the most recent swing low — a price level |
|
|
520
658
|
| `SWING_FRACTAL_LABEL` | `fractalLabel` | `HH`, `HL`, `LH`, `LL`, `none` — the most recent swing against the one before it on its side |
|
|
521
659
|
|
|
522
|
-
**The rule.** A swing high is a bar whose high is at or above the highs of the
|
|
523
|
-
strictly above the highs of the
|
|
524
|
-
is
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
660
|
+
**The rule.** A swing high is a bar whose high is at or above the highs of the `leftBars` bars before it
|
|
661
|
+
and strictly above the highs of the `rightBars` bars after it; a swing low mirrors it on the lows. The pair
|
|
662
|
+
is two each side by default (Pine's `ta.pivothigh(2, 2)`), and `ta.pivothigh(left, right)` at any other
|
|
663
|
+
pair. An equal extreme is allowed on the left and not on the right, so of a run of equal highs the newest is
|
|
664
|
+
the swing. A swing is published from the bar that completes its right side — `rightBars` bars after its
|
|
665
|
+
own — never earlier and never from a forming bar. Each level is held until the next swing on its side
|
|
666
|
+
replaces it.
|
|
528
667
|
|
|
529
668
|
- **The label is a held state, not an event.** It reads the most recent swing: `HH` / `LH` for a high
|
|
530
669
|
(an equal high is `LH` — it failed to make a higher high), `HL` / `LL` for a low (an equal low is
|
|
531
|
-
`HL`), `none` when no
|
|
532
|
-
clause over it reads FALSE.
|
|
533
|
-
- **A swing level does not remember a broken level.**
|
|
534
|
-
|
|
670
|
+
`HL`), `none` when no earlier swing on its side is in reach. On too short a history it reads nothing,
|
|
671
|
+
and a clause over it reads FALSE.
|
|
672
|
+
- **A swing level does not remember a broken level.** The level steps to the next swing on its side as
|
|
673
|
+
soon as one is decided, `rightBars` bars after that swing's own bar, so a retest of the BROKEN level is
|
|
674
|
+
not a swing-level read.
|
|
535
675
|
- **The two levels take** `distance`, `spread`, `aggregate`, `trajectory`, `efficiency`, the
|
|
536
676
|
statistics (`zscore`, `stddev`, `linregSlope`, `pctl`, `rollingMin`, `rollingMax`) and
|
|
537
677
|
`levelInteraction`, and both rank across the board
|
|
538
|
-
(`dist_fractalHi_rank_near`: the coins closest to their own last swing high).
|
|
678
|
+
(`dist_fractalHi_rank_near`: the coins closest to their own last swing high). Off 2/2 they take
|
|
679
|
+
`distance`, `spread`, `trajectory`, `efficiency` and `levelInteraction` only: `aggregate`, the
|
|
680
|
+
statistics and `rank` read the stored 2/2 and refuse the pair. A transform's catalog entry serves
|
|
681
|
+
`metricParametersAccepted`.
|
|
539
682
|
- **The break is the crossing toward the level.** `dist_fractalHi crossesAbove 0` is a close through the
|
|
540
683
|
last swing high and never fires when the level steps onto a new swing, because the bar that confirms
|
|
541
684
|
a swing high sits under it. The opposite crossing (`dist_fractalHi crossesBelow 0`, or
|
|
@@ -543,8 +686,27 @@ its side replaces it.
|
|
|
543
686
|
break.
|
|
544
687
|
- **A swing confirmed on the break bar can already have moved the label**, so a structure condition
|
|
545
688
|
paired with a break is held over the bars before it.
|
|
546
|
-
|
|
547
|
-
|
|
689
|
+
- **The pair is the column's knob**, `leftBars` / `rightBars` (2/2 by default; header `_l<left>r<right>`
|
|
690
|
+
off it, `fractalLo_l21r21`). A pivot's age, `SWING_FRACTAL_LOW_BARS_AGO` (`fractalLoAgo`) and
|
|
691
|
+
`SWING_FRACTAL_HIGH_BARS_AGO` (`fractalHiAgo`), reads the pair's `rightBars` on the bar that decides it,
|
|
692
|
+
so on that bar the pivot bar is `rightBars` bars back: a candle pattern AT the swing is the pattern
|
|
693
|
+
column at that offset, beside the age pinned to `rightBars` — the offset equals `rightBars` and changes
|
|
694
|
+
with it. The pair reads `left + right + 1` bars to decide one pivot and must fit the readable depth
|
|
695
|
+
(`strategy-authoring`'s knob rules hold the bound).
|
|
696
|
+
- **Off 2/2 a condition reads one bar.** Each bar of an off-default column needs the full readable depth
|
|
697
|
+
behind it, so a condition over it admits:
|
|
698
|
+
- no hold beyond one close (`CONDITION_HOLD_ILLEGAL`);
|
|
699
|
+
- no **In order** step (`CONDITION_SEQUENCE_WINDOW_INVALID`);
|
|
700
|
+
- no prior-bar operator: `crossesAbove`, `crossesBelow`, `increased`, `decreased`, `enters` and `exits`
|
|
701
|
+
are refused with `CONDITION_OPERATOR_UNSUPPORTED`, which leaves `lt`, `lte`, `gte`, `gt`, `between`,
|
|
702
|
+
`is` and `in`.
|
|
703
|
+
|
|
704
|
+
So off 2/2 every reading is a state. The structure is `fractalLabel_l5r5 in ["HH","HL"]`. A swing decided
|
|
705
|
+
on this bar is its age pinned to `rightBars`: `fractalHiAgo_l5r5 between 5 5`. The bullish break is the
|
|
706
|
+
state `dist_fractalHi_l5r5 gt 0`: the close stands above the last 5/5 swing high, from the break until
|
|
707
|
+
the close falls back or the level steps.
|
|
708
|
+
|
|
709
|
+
Recipes — the five structure reads are at the default pair; off it, read them through *Off 2/2* above:
|
|
548
710
|
|
|
549
711
|
- **The swing structure is bullish** — `fractalLabel in ["HH","HL"]`.
|
|
550
712
|
- **A higher high was confirmed on this bar** — `fractalHi increased` (it also catches a second
|
|
@@ -556,18 +718,98 @@ Recipes:
|
|
|
556
718
|
- **A break of the last swing low while the structure was bullish** — `dist_fractalLo crossesBelow 0`
|
|
557
719
|
together with `fractalLabel in ["HH","HL"]` holding `{ "atLeast": 1, "of": 3 }`, so the bullish
|
|
558
720
|
read may sit on the bars before the break.
|
|
721
|
+
- **A hammer at a 21/21 swing low** (LuxAlgo *Swing Highs/Lows & Candle Patterns*, length 21) —
|
|
722
|
+
`fractalLoAgo_l21r21 between 21 21` AND `pin_o21 is "lower_wick"`; mirror with `fractalHiAgo_l21r21`
|
|
723
|
+
and `upper_wick` at a swing high, and `engulf_o21` for an engulfing. The whole conditions are
|
|
724
|
+
`references/recipes.md`, *Candle at a swing and liquidity-pool sweeps*.
|
|
725
|
+
|
|
726
|
+
## Market structure levels (LuxAlgo SMC)
|
|
727
|
+
|
|
728
|
+
The levels LuxAlgo's Smart Money Concepts v7.0 draws, at its own defaults unless a column sets a knob:
|
|
729
|
+
swing length 50, internal length 5 (fixed), equal-pivot length 3 (`equalBars`), equal threshold 0.1 ×
|
|
730
|
+
ATR(200) (`equalThreshold`), confluence filter off. A header carries only a knob off its default, so
|
|
731
|
+
the default columns read `structHi`, `iStructLo`, `eqhLvl`. The server computes them over the column's
|
|
732
|
+
own bars; nothing is stored, and none is ranked.
|
|
733
|
+
|
|
734
|
+
**A condition over a market-structure column reads one bar**, at every setting, defaults included, as over a swing
|
|
735
|
+
column off 2/2 (*Off 2/2* in `## Swing structure`, which names the refusal codes). Each bar needs the full readable
|
|
736
|
+
depth behind it, so a condition over one admits:
|
|
737
|
+
- no hold beyond one close;
|
|
738
|
+
- no **In order** step;
|
|
739
|
+
- no operator that reads the bar before: `crossesAbove`, `crossesBelow`, `increased`, `decreased`, `enters` and
|
|
740
|
+
`exits` are refused.
|
|
741
|
+
|
|
742
|
+
Every reading in this section is therefore a state.
|
|
743
|
+
|
|
744
|
+
| Key | Header | Reads |
|
|
745
|
+
|---|---|---|
|
|
746
|
+
| `SWING_PENDING_HIGH` / `_LOW` | `structHi` / `structLo` | the swing high / low the next swing break is tested against — LuxAlgo's current level while no close has crossed it |
|
|
747
|
+
| `INTERNAL_PENDING_HIGH` / `_LOW` | `iStructHi` / `iStructLo` | the same on the internal structure (length 5) |
|
|
748
|
+
| `EQH_LEVEL` / `EQL_LEVEL` | `eqhLvl` / `eqlLvl` | the newer pivot of the latest equal-high / equal-low pair, held until the next equal-length pivot on its side |
|
|
749
|
+
| `SWING_STRUCTURE_LEVEL` | `structLvl` | the level the latest swing break crossed |
|
|
750
|
+
| `LIQUIDITY_POOL_ABOVE` / `_BELOW` | `poolAbove` / `poolBelow` | the nearest intact buyside pool above price / sellside pool below it — an equal-high / equal-low pair's newer pivot, kept until a close beyond it retires it, several at once |
|
|
751
|
+
| `LIQUIDITY_POOL_ABOVE_INTACT` / `LIQUIDITY_POOL_BELOW_INTACT` | `poolAboveOk` / `poolBelowOk` | false only on the bar whose close retires that pool |
|
|
752
|
+
| `LIQUIDITY_POOL_ABOVE_TOUCHES` / `LIQUIDITY_POOL_BELOW_TOUCHES` | `poolAboveTouch` / `poolBelowTouch` | the bars since that pool formed whose `levelInteraction` against it is a touch or a reject |
|
|
753
|
+
| `LIQUIDITY_POOL_ABOVE_RETIRED` / `LIQUIDITY_POOL_BELOW_RETIRED` | `poolAboveRetired` / `poolBelowRetired` | the pool the previous bar's close retired, read on the next bar only — a level the level verbs take |
|
|
754
|
+
| `LIQUIDITY_POOL_ABOVE_RECLAIMED` / `LIQUIDITY_POOL_BELOW_RECLAIMED` | `poolAboveRecl` / `poolBelowRecl` | true when this bar's close is back at or inside the pool the previous bar's close retired |
|
|
755
|
+
|
|
756
|
+
- **A pending level reads on the bar whose close crosses it**, and nothing from the next bar until a new
|
|
757
|
+
pivot is recorded. So `dist_structHi gt 0` is true on that bar alone: every close through the pending swing
|
|
758
|
+
high, the bar LuxAlgo marks BOS or CHoCH. The state is the crossing. It also reads the first, anchoring break,
|
|
759
|
+
which `structEvt` leaves untagged because its tag depends on a bias the column's bars have not yet proven.
|
|
760
|
+
- **An internal crossing LuxAlgo does not count stays pending**: where the internal level is the swing
|
|
761
|
+
level's own price, or the confluence filter refuses the bar, the close goes through and the internal
|
|
762
|
+
level still reads, so `dist_iStructHi` reads above 0 while the close stays through it, and the internal
|
|
763
|
+
event does not fire.
|
|
764
|
+
- **No close retires an equal-pivot level** — LuxAlgo tests no break on equal highs. A sweep is its REJECT
|
|
765
|
+
(`eqhLvl_lvl is "reject_from_below"`). A close through it is the state `dist_eqhLvl gt 0`, which holds while
|
|
766
|
+
the close stays above, not the crossing bar alone.
|
|
767
|
+
- **A close beyond a liquidity pool retires it** (LuxAlgo Liquidity Swings): the pool still reads on that
|
|
768
|
+
bar, and from the next bar `poolAbove` reads the next pool out. A pool's sweep takes two forms: on one
|
|
769
|
+
candle its REJECT, and over two candles the close beyond followed by a close back, which the next bar
|
|
770
|
+
reads through the retired pool — `poolAboveRetired` (the pool the last close took, on that bar only)
|
|
771
|
+
and `poolAboveRecl` (this close is back at or under it).
|
|
772
|
+
|
|
773
|
+
| Recipe | Column | Header |
|
|
774
|
+
|---|---|---|
|
|
775
|
+
| Distance to the pending swing high | `{ "metric": "SWING_PENDING_HIGH", "transformId": "distance", "timeframe": { "rel": "anchor" } }` | `dist_structHi` |
|
|
776
|
+
| Rejection at the pending swing high | `{ "metric": "SWING_PENDING_HIGH", "transformId": "levelInteraction", "timeframe": { "rel": "anchor" } }` | `structHi_lvl` |
|
|
777
|
+
| Sweep of the equal highs | `{ "metric": "EQH_LEVEL", "transformId": "levelInteraction", "timeframe": { "rel": "anchor" } }` | `eqhLvl_lvl` |
|
|
778
|
+
| Sweep of the buyside liquidity pool | `{ "metric": "LIQUIDITY_POOL_ABOVE", "transformId": "levelInteraction", "timeframe": { "rel": "anchor" } }` | `poolAbove_lvl` |
|
|
779
|
+
| Close back under the buyside pool the last bar retired | `{ "metric": "LIQUIDITY_POOL_ABOVE_RECLAIMED", "transformId": "value", "timeframe": { "rel": "anchor" } }` | `poolAboveRecl` |
|
|
780
|
+
| Distance to the pending internal low | `{ "metric": "INTERNAL_PENDING_LOW", "transformId": "distance", "timeframe": { "rel": "anchor" } }` | `dist_iStructLo` |
|
|
781
|
+
| A swing length of 20 | `{ "metric": "SWING_PENDING_HIGH", "transformId": "distance", "timeframe": { "rel": "anchor" }, "swingLength": 20 }` | `dist_structHi_s20` |
|
|
782
|
+
|
|
783
|
+
- **Approaching the swing high** — `dist_structHi gt -0.5` AND `dist_structHi lt 0` (Pine
|
|
784
|
+
`close < hi and close > hi * 0.995`).
|
|
785
|
+
- **Swing break of structure** — `dist_structHi gt 0` (Pine `ta.crossover(close, hi)`, LuxAlgo's break
|
|
786
|
+
test). The pending high reads on the break bar only, so this state is the crossing. Pair it with
|
|
787
|
+
`structEvt is "BOS↑"` to drop the anchoring break and a CHoCH.
|
|
788
|
+
- **Swept the equal highs and closed back** — `eqhLvl_lvl is "reject_from_below"` (Pine
|
|
789
|
+
`close[1] <= eqh and high >= eqh and close < eqh`).
|
|
790
|
+
- **Swept the buyside liquidity pool and closed back** — `poolAbove_lvl is "reject_from_below"`; the
|
|
791
|
+
sellside sweep is `poolBelow_lvl is "reject_from_above"`. On the same or the next candle it is an `ANY`
|
|
792
|
+
of that clause and `poolAboveRecl is "true"` (sellside `poolBelowRecl`). The whole conditions are
|
|
793
|
+
`references/recipes.md`, *Candle at a swing and liquidity-pool sweeps*.
|
|
559
794
|
|
|
560
795
|
## Entry
|
|
561
796
|
|
|
562
|
-
`{ trigger, levelOffsetAtrMultiple, validForBars }` — the axis's keys, and the trigger decides
|
|
797
|
+
`{ trigger, levelOffsetAtrMultiple, validForBars, levels }` — the axis's keys, and the trigger decides
|
|
563
798
|
which of them you send. `ON_CANDLE_CLOSE` is sent ALONE, as `{ "trigger": "ON_CANDLE_CLOSE" }`: a
|
|
564
|
-
`levelOffsetAtrMultiple` or `
|
|
565
|
-
trigger — `STOP_THROUGH_LEVEL` or `ON_RETEST` — sends
|
|
799
|
+
`levelOffsetAtrMultiple`, `validForBars` or `levels` beside it is refused as an unrecognized key. A level
|
|
800
|
+
trigger — `STOP_THROUGH_LEVEL` or `ON_RETEST` — sends all three, no defaults. The axis is staged
|
|
566
801
|
WHOLE, so a level trigger missing one is refused rather than half-kept. It is not required on every
|
|
567
802
|
CREATE: a CREATE that stages no entry takes the platform's seed entry, so stage it whenever the
|
|
568
|
-
setup names one. There is no
|
|
569
|
-
|
|
570
|
-
|
|
803
|
+
setup names one. There is no confirm-timeframe key: the bar whose close decides an entry is the
|
|
804
|
+
strategy's OWN timeframe.
|
|
805
|
+
|
|
806
|
+
**A level trigger names its level, once per trade direction.** `levels` is `{ "LONG": <level>,
|
|
807
|
+
"SHORT": <level> }`, each a level reference — `{ "metric": "DONCHIAN_UPPER", "timeframe": { "rel": "anchor" }, "bars": null, "offset": 0, "knobs": {}, "windowExtreme": null }` — naming a price level a section
|
|
808
|
+
of the evaluated coin yields: the same levels a condition's level reference reads, at the column's own timeframe,
|
|
809
|
+
`bars`, `offset` and knobs, or the extreme of a `rollingMax` / `rollingMin` window (`windowExtreme`). The two
|
|
810
|
+
directions are authored separately and never mirrored, so an asymmetric strategy is native. A level the report does
|
|
811
|
+
not yield is refused at save, naming `entry.levels.LONG` or `entry.levels.SHORT`; add a column that reads it, or choose
|
|
812
|
+
one the report has.
|
|
571
813
|
|
|
572
814
|
**Every trigger is decided at the close of the strategy's own bar — there are three, and the close
|
|
573
815
|
is the only entry clock.** The newest completed bar is read on the closed basis — every one-close
|
|
@@ -578,21 +820,25 @@ from that close. A fourth value, `AT_SIGNAL`, is readable on strategies authored
|
|
|
578
820
|
and is REFUSED on every stage and save; there is no live-reading entry to author.
|
|
579
821
|
|
|
580
822
|
- `ON_CANDLE_CLOSE` — the entry is taken AT the qualifying close, at market.
|
|
581
|
-
- `STOP_THROUGH_LEVEL` — at the qualifying close a TRIGGER order rests past the
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
- `ON_RETEST` — at the qualifying close a LIMIT order rests in front of the
|
|
586
|
-
|
|
587
|
-
short)
|
|
588
|
-
failure
|
|
823
|
+
- `STOP_THROUGH_LEVEL` — at the qualifying close a TRIGGER order rests past the direction's level, read on that
|
|
824
|
+
bar, by the offset (a breakout: the 20-bar high `DONCHIAN_UPPER` for a long, the 20-bar low `DONCHIAN_LOWER` for a
|
|
825
|
+
short), and the exchange book is the watcher; the entry is taken when price trades through, not when the platform
|
|
826
|
+
notices. The level must sit beyond the mark in the trade's direction.
|
|
827
|
+
- `ON_RETEST` — at the qualifying close a LIMIT order rests in front of the direction's level by the offset, waiting
|
|
828
|
+
for a return to it (a pullback: the broken 20-bar high `DONCHIAN_BROKEN_HI` for a long, the broken low
|
|
829
|
+
`DONCHIAN_BROKEN_LO` for a short). The level must sit behind the mark. Not filling is a correct outcome, not a
|
|
830
|
+
failure.
|
|
831
|
+
|
|
832
|
+
Either way a level with no reading on the decided bar, or on the wrong side of the mark, is no setup — refused with
|
|
833
|
+
its stage, never substituted by another level. The entry price is fixed at the decision: a level that moves while the
|
|
834
|
+
order waits does not move the order.
|
|
589
835
|
|
|
590
836
|
**A multi-bar hold belongs to the CLAUSE (or group) that needs it.** Declare that clause's own
|
|
591
837
|
`hold` — "3 closes in a row", "within 5 closes" — the entry axis counts no bars, and there is no displacement band: the
|
|
592
838
|
platform's entry-deviation gate measures the live mark against the decided close and refuses a fill
|
|
593
839
|
that drifted past the budget in either direction.
|
|
594
840
|
|
|
595
|
-
`levelOffsetAtrMultiple` (0–2) is an UNSIGNED distance from the
|
|
841
|
+
`levelOffsetAtrMultiple` (0–2) is an UNSIGNED distance from the named level in ATR multiples — a
|
|
596
842
|
long adds it, a short subtracts it, so a breakout stop rests past its edge and a pullback limit
|
|
597
843
|
rests in front of its edge, and a signed value would invert the trigger's meaning. `validForBars`
|
|
598
844
|
(1–24) denominates validity in the strategy's OWN bars rather than minutes, because a 1h setup
|
|
@@ -602,10 +848,10 @@ mirror for a sell — or the entry is refused rather than filled at the market;
|
|
|
602
848
|
how far from the mark a level may rest.
|
|
603
849
|
|
|
604
850
|
**The trigger decides the shape, so there is no inert dial to leave.** Under `ON_CANDLE_CLOSE` the
|
|
605
|
-
two parameters do not exist on the input — the server stores its seed values for
|
|
606
|
-
read (`get_strategy`) still shows all
|
|
607
|
-
`ON_CANDLE_CLOSE` is staging `{ "trigger": "ON_CANDLE_CLOSE" }` alone; never copy the read's
|
|
608
|
-
|
|
851
|
+
two parameters and the levels do not exist on the input — the server stores its seed values for the parameters and
|
|
852
|
+
no level — while a read (`get_strategy`) still shows all four keys, `levels` as `null`. Switching a level trigger back
|
|
853
|
+
to `ON_CANDLE_CLOSE` is staging `{ "trigger": "ON_CANDLE_CLOSE" }` alone; never copy the read's parameters back
|
|
854
|
+
beside it.
|
|
609
855
|
|
|
610
856
|
## Report sections
|
|
611
857
|
|
|
@@ -641,15 +887,44 @@ header is. Worked sections and conditions: `references/recipes.md`, *Market and
|
|
|
641
887
|
|
|
642
888
|
## Trade levels
|
|
643
889
|
|
|
644
|
-
`{ minStopLossAtrMultiple, maxStopLossAtrMultiple, minRiskRewardRatio, minAtrPct }` — where stops
|
|
645
|
-
and targets may sit, and how much a coin must move before it is
|
|
646
|
-
`minStopLossAtrMultiple < maxStopLossAtrMultiple` (≤ the
|
|
647
|
-
within the served range. `minAtrPct` is the ATR floor: a coin whose ATR% sits below it is refused
|
|
890
|
+
`{ minStopLossAtrMultiple, maxStopLossAtrMultiple, minRiskRewardRatio, minAtrPct, tradeLevelMenu }` — where stops
|
|
891
|
+
and targets may sit, which stops and targets the agent may choose from, and how much a coin must move before it is
|
|
892
|
+
worth trading at all. `minStopLossAtrMultiple < maxStopLossAtrMultiple` (≤ the 5×ATR structural cap),
|
|
893
|
+
`minRiskRewardRatio` within the served range. `minAtrPct` is the ATR floor: a coin whose ATR% sits below it is refused
|
|
648
894
|
(`ATR_VOLATILITY_BELOW_MIN`) before any condition is read, with bounds from
|
|
649
895
|
`get_trading_config_catalog`; it is multiplied with `maxStopLossAtrMultiple` in the capital check, so
|
|
650
|
-
a high floor with a wide stop needs more capital per trade. The axis is staged whole — all
|
|
896
|
+
a high floor with a wide stop needs more capital per trade. The axis is staged whole — all five keys.
|
|
651
897
|
Sizing is risk-budget based — a wider stop means a smaller position, never more risk.
|
|
652
898
|
|
|
899
|
+
**The menu: the author lists the options, the agent picks a pair.** `tradeLevelMenu` is `{ "LONG": { stops, targets },
|
|
900
|
+
"SHORT": { stops, targets } }` — each direction authored on its own, never mirrored, each list 1–8 options. Every ATR
|
|
901
|
+
below is the strategy timeframe's.
|
|
902
|
+
|
|
903
|
+
- A **stop** option is one of `{ "kind": "ATR", "atrMultiple": m }` (0 < m ≤ 5), `{ "kind": "LEVEL", "level": <level
|
|
904
|
+
reference>, "bufferAtrMultiple": b }` (0 ≤ b ≤ 5: the stop sits b × ATR beyond the level on the loss side), or
|
|
905
|
+
`{ "kind": "PERCENT", "percent": p }` (0 < p < 100, a fixed percent from entry).
|
|
906
|
+
- A **target** option is `{ "kind": "R_MULTIPLE", "multiple": r }` (0 < r ≤ 10) or `{ "kind": "LEVEL", "level": <level
|
|
907
|
+
reference> }`.
|
|
908
|
+
|
|
909
|
+
A level reference is the same shape the entry axis names, and must be a level the report yields. At each decision the
|
|
910
|
+
platform pairs every stop with every target, prices them on the decided bar, and drops a pair whose stop is not on
|
|
911
|
+
the loss side of entry or whose target is not on the profit side, a stop tighter than `minStopLossAtrMultiple` or wider
|
|
912
|
+
than `maxStopLossAtrMultiple` (or the 5×ATR cap), and a level target whose reward is under `minRiskRewardRatio`. A
|
|
913
|
+
level with no reading on the bar drops its options; nothing is stretched or substituted. Pairs that land on the same
|
|
914
|
+
two prices are one setup naming every option that made it. The agent chooses one setup; a one-option list is a fixed
|
|
915
|
+
choice.
|
|
916
|
+
|
|
917
|
+
**R is the pair's own risk.** An `R_MULTIPLE` target sits `r × |entry − stop|` from entry for the stop it is paired
|
|
918
|
+
with, so 2R beside a 2×ATR stop is twice as far as 2R beside a 1×ATR stop. Its reward is exactly r, so the save refuses
|
|
919
|
+
an R option below `minRiskRewardRatio` (it could never trade) rather than dropping it per trade.
|
|
920
|
+
|
|
921
|
+
**What the save refuses, per direction** (each naming its field): a list outside 1–8 options; an option outside its
|
|
922
|
+
bounds; a level the report does not yield; an R target below `minRiskRewardRatio`; a target level that is the
|
|
923
|
+
direction's entry level (no reward); and one level in both the stop and the target list. The entry level may also be a
|
|
924
|
+
stop. A CREATE that stages no menu opens with the seed — stops ATR 1× / 1.5× / 2× plus the Donchian edge and Bollinger
|
|
925
|
+
band on the loss side, targets 1.5R / 2R / 3R (those at or above the minimum) plus the Donchian edge and Bollinger band
|
|
926
|
+
on the profit side, never a target at its own entry level — keeping only the levels its report yields.
|
|
927
|
+
|
|
653
928
|
## Position management
|
|
654
929
|
|
|
655
930
|
`{ breakEvenEnabled, breakEvenTriggerR, trailingEnabled, trailingTriggerR, trailingGivebackPct,
|
|
@@ -684,7 +959,7 @@ rejects an `offset`) belongs in prose above — those are permanent. A claim tha
|
|
|
684
959
|
|
|
685
960
|
| Script / primitive | Key the catalog would need | Nearest expressible neighbour |
|
|
686
961
|
|---|---|---|
|
|
687
|
-
| 100-period SMA | `SMA100` | the shipped 50- or 200-period simple average, whichever the thesis leans on |
|
|
962
|
+
| 100-period SMA | `SMA100` | close against it is exact: `CLOSE × spread` against the averaged operand `{ "metric": "CLOSE", "transformId": "aggregate", "window": 100 }` (`close_close_mean100_spread`) is (close − `ta.sma(close, 100)`) ÷ that average × 100 per bar, so `gt 0` is close above it, `lt 0` close below it, `crossesAbove 0` / `crossesBelow 0` the cross, and the value itself the percent gap. `CLOSE × aggregate` at window 100 (`close_mean100`) is the average's own value (`close_mean100 increased` is a rising average). Only `levelInteraction` against it — a touch or reject of the average as a level — uses the shipped 50- or 200-period simple average, whichever the thesis leans on |
|
|
688
963
|
|
|
689
964
|
## Where the worked material lives
|
|
690
965
|
|
|
@@ -693,7 +968,8 @@ and the absence section above. The worked material is disclosed on demand, so it
|
|
|
693
968
|
you ask for it. Read a reference with `read_skill_reference` when you reach the work it covers:
|
|
694
969
|
|
|
695
970
|
- **`references/recipes.md`** — copy-adaptable column objects and condition fragments: cross
|
|
696
|
-
detection,
|
|
971
|
+
detection, recency and structure, a candle pattern at a swing and the sweep of a liquidity pool on one or two candles,
|
|
972
|
+
board-relative ranks, cross-venue basis, crowd positioning, the market-regime and
|
|
697
973
|
stablecoin-peg sections, coin selection, and the discovery fields worth reading before you
|
|
698
974
|
compose.
|
|
699
975
|
- **`references/playbooks.md`** — five validated desk-grade compositions end to end, and how to
|