[{"data":1,"prerenderedAt":1723},["ShallowReactive",2],{"kscript:strategies/fill-simulation":3},{"slug":4,"filePath":5,"frontmatter":6,"rawMarkdown":11,"tree":12},"strategies/fill-simulation","strategies/fill-simulation.md",{"title":7,"description":8,"verified":9},"Fill Simulation","How the backtester decides when and at what price orders fill, how intrabar ordering questions are resolved with finer data, and how precision is reported.",{"engine":10},"3.0.61","---\ntitle: Fill Simulation\ndescription: How the backtester decides when and at what price orders fill, how intrabar ordering questions are resolved with finer data, and how precision is reported.\nverified:\n  engine: 3.0.61\n---\n\n## The execution model\n\nOrders are processed at each new confirmed bar in a fixed sequence:\n\n1. Protective exits of the open position (stop, limit, trail) are evaluated against the bar's range under the fill model.\n2. Pending signal exits from `close` and `closeAll`, in insertion order.\n3. Pending entries, in insertion order: market orders at the open, resting limit and stop orders if touched.\n4. Orders your script places during this bar join the queue for the next bar.\n\nFill prices follow bar mechanics:\n\n- **Market fills** execute at the next bar's open, slippage-adjusted.\n- **Limit fills** execute when the bar trades through the level (long entry: `low \u003C= limit`), at the better of open and limit, with no slippage: a limit price is a bound by definition.\n- **Stop fills** mirror the touch rule and are slippage-adjusted, because stops cross the market.\n- **Trailing stops** activate when favorable excursion reaches `trailPoints`, then ratchet with new extremes and fill under stop rules with `exitReason=\"trail\"`.\n\nEquity is recorded on every bar (cash plus the open position marked at that bar's close, minus fees paid), so drawdown and exposure account for flat periods too.\n\nThe whole per-bar pipeline, in order:\n\n```text\n                          one confirmed bar\n  ---------------------------------------------------------------->\n\n  [funding settles]   [protective exits]   [signal exits]   [entries fill]\n   perps only:          stop / limit /       close() /        market at open,\n   debits cash and      trail vs the         closeAll()       resting limit /\n   committed margin     bar's range                           stop if touched\n        |                                                          |\n        v                                                          v\n  .................. phase-end liquidation check ..................\n   perps only: the FINAL position vs its liquidation price\n        |\n        v\n  [your script runs at bar close]  ->  orders placed here queue for the NEXT bar\n```\n\nTwo consequences worth internalizing: your script always sees the bar's completed fills (a flat-position guard is already flat on the bar its exit filled), and nothing your script places can fill until the following bar.\n\n## How perps liquidation is decided\n\n\nFor `instrument=\"perps\"`, liquidation has one evaluation at the end of each confirmed bar. In the ordinary price-action path, that check runs after the normal order-processing phases above and uses the final remaining position for the bar. The liquidation order is system-owned: it is not placed in your pending order queue and it cannot be canceled.\n\nIf a position was already open and the bar gaps through its liquidation level, the fill uses the worse bar price. For a long, an open below the liquidation level fills at that open; otherwise a low through the level fills at the liquidation level. Shorts mirror that rule with the high and an open above the liquidation level.\n\nWhen fills on the same chart bar changed the final position composition, OHLC data cannot prove whether the adverse extreme happened before or after the final composition existed. The engine resolves that honestly by assuming liquidation when the final liquidation level is reached, clamping the fill to the bar's traded range, incrementing `ambiguousFillCount`, and flagging the closed trade. The `perps-ambiguous-liquidation.ks` output records `ambiguousFillCount=1`; its final long `P_liq` is `122.625`, outside the fixture bar's `90` to `120` traded range, so the liquidation fill is clamped to the bar high and recorded at `120`. This is not a hidden path guess. It is the explicit limit of chart-bar granularity.\n\nLiquidation is live from the entry fill onward, so entry-bar liquidation is possible. Funding settlements are applied in the bar-open phase before same-instant fills. If a settlement depletes the prior position's committed margin to zero or below, the bar still has one phase-end liquidation evaluation, but the settlement forces that outcome: the prior position liquidates at the settlement bar's open, and later same-bar fills cannot rescue it. After any perps close, if equity would be negative at the fill price, the engine floors equity at zero and records the clamped amount in `stats.bankruptcyDeficit`.\n\nThree shapes cover almost every liquidation. When the bar trades through the level, the fill is the level itself. When price gaps past it, the fill is the bar price, because that is where the market actually traded:\n\n```text\n   trades through P_liq            gaps through P_liq\n        (fill = P_liq)             (fill = open, worse)\n\n   100 -+-- open                   100 -+-- prior close\n        |                               |\n   P_liq ==== fill ====                 |      (no trading here)\n        |                               |\n    90 -+-- low                     80 -+-- open  \u003C- fill\n```\n\nAnd when fills changed the position inside the same bar, OHLC cannot prove whether the adverse extreme came before or after the change, so the engine assumes liquidation, clamps the fill to the bar's traded range, and counts it in `ambiguousFillCount`:\n\n```text\n   same-bar entry + adverse extreme: order unknowable from OHLC\n\n   high -+----------------?  did price hit the extreme\n         |    entry fills  ?  before or after the entry?\n         |    somewhere    ?\n    low -+----------------?   -> assume liquidation, clamp fill\n                                 into [low, high], count it\n```\n\n## Intrabar ordering and fill models\n\nA single OHLC bar tells you the range it traded, not the path it took. When both a protective stop and a profit limit sit inside one bar's range, the bar alone cannot say which traded first. The engine handles this class of question in three layers:\n\n1. **Certainty first.** A leg already marketable at the open fills at the open. Decisions that are certain at chart level never involve any assumption.\n2. **Finer data second.** When the platform holds finer-interval bars for that epoch, the engine walks them in time order and lets the actual path settle the question (see below).\n3. **Declared assumption last.** Only when no finer data covers the bar does the declared `fillModel` decide:\n   - `\"pessimistic\"` (default): the stop is assumed to have filled first. The decision is counted in `ambiguousFillCount` and the trade is flagged.\n   - `\"pathHeuristic\"`: the TradingView-style path assumption (the open moves toward the nearer of high and low first). Natural path resolutions are not counted; only exact distance ties fall back to the pessimistic rule and count.\n\nBoth models are fully deterministic.\n\n## Sub-bar resolution\n\nBacktests load a ladder of finer-interval bars over the replay window, subject to what the platform retains per lane (roughly: 1m for recent days, then 5m, 15m, and 1h reaching back years). Every ordering question that falls inside covered epochs is resolved by walking those finer bars with the exact same per-bar rules (touch, gap-through at opens, limit legs unslipped, stops slippage-adjusted). The first leg to trigger wins, at the triggering sub-bar's price.\n\nTwo properties keep this honest:\n\n- Uncontested fills are byte-identical with and without finer data. The walk resolves ordering, it never changes the price of a fill that was already certain.\n- If a single finest-lane bar still contains both levels, that residual question is settled by the declared `fillModel` and counted, exactly as a chart bar would be.\n\n## Reading the precision report\n\nThe Strategy Tester's run-details popover reports what the simulation actually did:\n\n- **Fill precision: exact.** The run posed no intrabar ordering questions at all.\n- **Fill precision: verified on 1m + 5m data.** Every contested fill was settled by walking finer bars.\n- **Fill precision: N of M contested fills verified.** Partial coverage: the rest were settled by the fill model over epochs with no finer data.\n- **Fill precision: bar resolution.** No finer data was available; the fill model settled everything.\n\nThe same popover reports the compute time and, for `slippageModel=\"bookEstimate\"` runs, the [slippage disclosure](slippage-and-costs.md#reading-the-slippage-disclosure).\n\n## Choosing an interval to trust\n\nCross-interval agreement has one structural limit worth understanding: brackets arm on the bar after the entry fills. On a 1-hour chart that protection gap is an hour of price movement; on a 1-minute chart it is a minute. A strategy whose stops are tight relative to its chart interval will genuinely behave differently at finer intervals, and no fill simulator can reconcile that, because the strategies are seeing different information. Practical guidance:\n\n- Backtest at the interval you intend to run the strategy on.\n- Keep stops and targets wide relative to the chart interval's typical bar range, or move to a finer chart.\n- Treat the precision line as part of the result. A verified run at bar resolution over deep history and a fully walked run over recent months are both useful, but they are not the same experiment.\n",{"type":13,"children":14,"data":1716,"position":1718},"root",[15,36,38,53,54,172,173,188,189,386,387,400,401,415,416,555,556,570,571,588,589,623,624,639,640,814,815,848,849,864,865,942,943,976,977,1046,1047,1063,1064,1078,1079,1280,1281,1295,1296,1312,1313,1328,1329,1342,1343,1402,1403,1420,1421,1435,1436,1569,1570,1626,1627,1643,1644,1659,1660],{"type":16,"tagName":17,"properties":18,"children":20,"position":32},"element","h2",{"id":19},"the-execution-model",[21],{"type":22,"value":23,"position":24},"text","The execution model",{"start":25,"end":29},{"line":26,"column":27,"offset":28},1,4,3,{"line":26,"column":30,"offset":31},23,22,{"start":33,"end":35},{"line":26,"column":26,"offset":34},0,{"line":26,"column":30,"offset":31},{"type":22,"value":37},"\n",{"type":16,"tagName":39,"properties":40,"children":41,"position":50},"p",{},[42],{"type":22,"value":43,"position":44},"Orders are processed at each new confirmed bar in a fixed sequence:",{"start":45,"end":47},{"line":28,"column":26,"offset":46},24,{"line":28,"column":48,"offset":49},68,91,{"start":51,"end":52},{"line":28,"column":26,"offset":46},{"line":28,"column":48,"offset":49},{"type":22,"value":37},{"type":16,"tagName":55,"properties":56,"children":57,"position":169},"ol",{},[58,59,76,77,134,135,151,152,168],{"type":22,"value":37},{"type":16,"tagName":60,"properties":61,"children":62,"position":72},"li",{},[63],{"type":22,"value":64,"position":65},"Protective exits of the open position (stop, limit, trail) are evaluated against the bar's range under the fill model.",{"start":66,"end":69},{"line":67,"column":27,"offset":68},5,96,{"line":67,"column":70,"offset":71},122,214,{"start":73,"end":75},{"line":67,"column":26,"offset":74},93,{"line":67,"column":70,"offset":71},{"type":22,"value":37},{"type":16,"tagName":60,"properties":78,"children":79,"position":130},{},[80,89,103,110,123],{"type":22,"value":81,"position":82},"Pending signal exits from ",{"start":83,"end":86},{"line":84,"column":27,"offset":85},6,218,{"line":84,"column":87,"offset":88},30,244,{"type":16,"tagName":90,"properties":91,"children":92,"position":100},"code",{},[93],{"type":22,"value":94,"position":95},"close",{"start":96,"end":97},{"line":84,"column":87,"offset":88},{"line":84,"column":98,"offset":99},37,251,{"start":101,"end":102},{"line":84,"column":87,"offset":88},{"line":84,"column":98,"offset":99},{"type":22,"value":104,"position":105}," and ",{"start":106,"end":107},{"line":84,"column":98,"offset":99},{"line":84,"column":108,"offset":109},42,256,{"type":16,"tagName":90,"properties":111,"children":112,"position":120},{},[113],{"type":22,"value":114,"position":115},"closeAll",{"start":116,"end":117},{"line":84,"column":108,"offset":109},{"line":84,"column":118,"offset":119},52,266,{"start":121,"end":122},{"line":84,"column":108,"offset":109},{"line":84,"column":118,"offset":119},{"type":22,"value":124,"position":125},", in insertion order.",{"start":126,"end":127},{"line":84,"column":118,"offset":119},{"line":84,"column":128,"offset":129},73,287,{"start":131,"end":133},{"line":84,"column":26,"offset":132},215,{"line":84,"column":128,"offset":129},{"type":22,"value":37},{"type":16,"tagName":60,"properties":136,"children":137,"position":147},{},[138],{"type":22,"value":139,"position":140},"Pending entries, in insertion order: market orders at the open, resting limit and stop orders if touched.",{"start":141,"end":144},{"line":142,"column":27,"offset":143},7,291,{"line":142,"column":145,"offset":146},109,396,{"start":148,"end":150},{"line":142,"column":26,"offset":149},288,{"line":142,"column":145,"offset":146},{"type":22,"value":37},{"type":16,"tagName":60,"properties":153,"children":154,"position":164},{},[155],{"type":22,"value":156,"position":157},"Orders your script places during this bar join the queue for the next bar.",{"start":158,"end":161},{"line":159,"column":27,"offset":160},8,400,{"line":159,"column":162,"offset":163},78,474,{"start":165,"end":167},{"line":159,"column":26,"offset":166},397,{"line":159,"column":162,"offset":163},{"type":22,"value":37},{"start":170,"end":171},{"line":67,"column":26,"offset":74},{"line":159,"column":162,"offset":163},{"type":22,"value":37},{"type":16,"tagName":39,"properties":174,"children":175,"position":185},{},[176],{"type":22,"value":177,"position":178},"Fill prices follow bar mechanics:",{"start":179,"end":182},{"line":180,"column":26,"offset":181},10,476,{"line":180,"column":183,"offset":184},34,509,{"start":186,"end":187},{"line":180,"column":26,"offset":181},{"line":180,"column":183,"offset":184},{"type":22,"value":37},{"type":16,"tagName":190,"properties":191,"children":192,"position":383},"ul",{},[193,194,227,228,279,280,311,312,382],{"type":22,"value":37},{"type":16,"tagName":60,"properties":195,"children":196,"position":223},{},[197,216],{"type":16,"tagName":198,"properties":199,"children":200,"position":210},"strong",{},[201],{"type":22,"value":202,"position":203},"Market fills",{"start":204,"end":207},{"line":205,"column":67,"offset":206},12,515,{"line":205,"column":208,"offset":209},17,527,{"start":211,"end":213},{"line":205,"column":28,"offset":212},513,{"line":205,"column":214,"offset":215},19,529,{"type":22,"value":217,"position":218}," execute at the next bar's open, slippage-adjusted.",{"start":219,"end":220},{"line":205,"column":214,"offset":215},{"line":205,"column":221,"offset":222},70,580,{"start":224,"end":226},{"line":205,"column":26,"offset":225},511,{"line":205,"column":221,"offset":222},{"type":22,"value":37},{"type":16,"tagName":60,"properties":229,"children":230,"position":275},{},[231,249,255,268],{"type":16,"tagName":198,"properties":232,"children":233,"position":243},{},[234],{"type":22,"value":235,"position":236},"Limit fills",{"start":237,"end":240},{"line":238,"column":67,"offset":239},13,585,{"line":238,"column":241,"offset":242},16,596,{"start":244,"end":246},{"line":238,"column":28,"offset":245},583,{"line":238,"column":247,"offset":248},18,598,{"type":22,"value":250,"position":251}," execute when the bar trades through the level (long entry: ",{"start":252,"end":253},{"line":238,"column":247,"offset":248},{"line":238,"column":162,"offset":254},658,{"type":16,"tagName":90,"properties":256,"children":257,"position":265},{},[258],{"type":22,"value":259,"position":260},"low \u003C= limit",{"start":261,"end":262},{"line":238,"column":162,"offset":254},{"line":238,"column":263,"offset":264},92,672,{"start":266,"end":267},{"line":238,"column":162,"offset":254},{"line":238,"column":263,"offset":264},{"type":22,"value":269,"position":270},"), at the better of open and limit, with no slippage: a limit price is a bound by definition.",{"start":271,"end":272},{"line":238,"column":263,"offset":264},{"line":238,"column":273,"offset":274},185,765,{"start":276,"end":278},{"line":238,"column":26,"offset":277},581,{"line":238,"column":273,"offset":274},{"type":22,"value":37},{"type":16,"tagName":60,"properties":281,"children":282,"position":307},{},[283,300],{"type":16,"tagName":198,"properties":284,"children":285,"position":295},{},[286],{"type":22,"value":287,"position":288},"Stop fills",{"start":289,"end":292},{"line":290,"column":67,"offset":291},14,770,{"line":290,"column":293,"offset":294},15,780,{"start":296,"end":298},{"line":290,"column":28,"offset":297},768,{"line":290,"column":208,"offset":299},782,{"type":22,"value":301,"position":302}," mirror the touch rule and are slippage-adjusted, because stops cross the market.",{"start":303,"end":304},{"line":290,"column":208,"offset":299},{"line":290,"column":305,"offset":306},98,863,{"start":308,"end":310},{"line":290,"column":26,"offset":309},766,{"line":290,"column":305,"offset":306},{"type":22,"value":37},{"type":16,"tagName":60,"properties":313,"children":314,"position":378},{},[315,331,338,351,358,371],{"type":16,"tagName":198,"properties":316,"children":317,"position":325},{},[318],{"type":22,"value":319,"position":320},"Trailing stops",{"start":321,"end":323},{"line":293,"column":67,"offset":322},868,{"line":293,"column":214,"offset":324},882,{"start":326,"end":328},{"line":293,"column":28,"offset":327},866,{"line":293,"column":329,"offset":330},21,884,{"type":22,"value":332,"position":333}," activate when favorable excursion reaches ",{"start":334,"end":335},{"line":293,"column":329,"offset":330},{"line":293,"column":336,"offset":337},64,927,{"type":16,"tagName":90,"properties":339,"children":340,"position":348},{},[341],{"type":22,"value":342,"position":343},"trailPoints",{"start":344,"end":345},{"line":293,"column":336,"offset":337},{"line":293,"column":346,"offset":347},77,940,{"start":349,"end":350},{"line":293,"column":336,"offset":337},{"line":293,"column":346,"offset":347},{"type":22,"value":352,"position":353},", then ratchet with new extremes and fill under stop rules with ",{"start":354,"end":355},{"line":293,"column":346,"offset":347},{"line":293,"column":356,"offset":357},141,1004,{"type":16,"tagName":90,"properties":359,"children":360,"position":368},{},[361],{"type":22,"value":362,"position":363},"exitReason=\"trail\"",{"start":364,"end":365},{"line":293,"column":356,"offset":357},{"line":293,"column":366,"offset":367},161,1024,{"start":369,"end":370},{"line":293,"column":356,"offset":357},{"line":293,"column":366,"offset":367},{"type":22,"value":372,"position":373},".",{"start":374,"end":375},{"line":293,"column":366,"offset":367},{"line":293,"column":376,"offset":377},162,1025,{"start":379,"end":381},{"line":293,"column":26,"offset":380},864,{"line":293,"column":376,"offset":377},{"type":22,"value":37},{"start":384,"end":385},{"line":205,"column":26,"offset":225},{"line":293,"column":376,"offset":377},{"type":22,"value":37},{"type":16,"tagName":39,"properties":388,"children":389,"position":397},{},[390],{"type":22,"value":391,"position":392},"Equity is recorded on every bar (cash plus the open position marked at that bar's close, minus fees paid), so drawdown and exposure account for flat periods too.",{"start":393,"end":395},{"line":208,"column":26,"offset":394},1027,{"line":208,"column":376,"offset":396},1188,{"start":398,"end":399},{"line":208,"column":26,"offset":394},{"line":208,"column":376,"offset":396},{"type":22,"value":37},{"type":16,"tagName":39,"properties":402,"children":403,"position":412},{},[404],{"type":22,"value":405,"position":406},"The whole per-bar pipeline, in order:",{"start":407,"end":409},{"line":214,"column":26,"offset":408},1190,{"line":214,"column":410,"offset":411},38,1227,{"start":413,"end":414},{"line":214,"column":26,"offset":408},{"line":214,"column":410,"offset":411},{"type":22,"value":37},{"type":13,"children":417},[418],{"type":16,"tagName":419,"properties":420,"children":424,"data":-1},"pre",{"class":421,"style":422,"tabindex":423},"shiki shiki-themes github-dark github-light","--shiki-dark:#e1e4e8;--shiki-light:#24292e;--shiki-dark-bg:#24292e;--shiki-light-bg:#fff","0",[425],{"type":16,"tagName":90,"properties":426,"children":427},{},[428,438,439,447,448,456,457,465,466,474,475,483,484,492,493,501,502,510,511,519,520,528,529,537,538,546,547],{"type":16,"tagName":429,"properties":430,"children":432},"span",{"class":431},"line",[433],{"type":16,"tagName":429,"properties":434,"children":435},{},[436],{"type":22,"value":437},"                          one confirmed bar",{"type":22,"value":37},{"type":16,"tagName":429,"properties":440,"children":441},{"class":431},[442],{"type":16,"tagName":429,"properties":443,"children":444},{},[445],{"type":22,"value":446},"  ---------------------------------------------------------------->",{"type":22,"value":37},{"type":16,"tagName":429,"properties":449,"children":450},{"class":431},[451],{"type":16,"tagName":429,"properties":452,"children":453},{},[454],{"type":22,"value":455},"",{"type":22,"value":37},{"type":16,"tagName":429,"properties":458,"children":459},{"class":431},[460],{"type":16,"tagName":429,"properties":461,"children":462},{},[463],{"type":22,"value":464},"  [funding settles]   [protective exits]   [signal exits]   [entries fill]",{"type":22,"value":37},{"type":16,"tagName":429,"properties":467,"children":468},{"class":431},[469],{"type":16,"tagName":429,"properties":470,"children":471},{},[472],{"type":22,"value":473},"   perps only:          stop / limit /       close() /        market at open,",{"type":22,"value":37},{"type":16,"tagName":429,"properties":476,"children":477},{"class":431},[478],{"type":16,"tagName":429,"properties":479,"children":480},{},[481],{"type":22,"value":482},"   debits cash and      trail vs the         closeAll()       resting limit /",{"type":22,"value":37},{"type":16,"tagName":429,"properties":485,"children":486},{"class":431},[487],{"type":16,"tagName":429,"properties":488,"children":489},{},[490],{"type":22,"value":491},"   committed margin     bar's range                           stop if touched",{"type":22,"value":37},{"type":16,"tagName":429,"properties":494,"children":495},{"class":431},[496],{"type":16,"tagName":429,"properties":497,"children":498},{},[499],{"type":22,"value":500},"        |                                                          |",{"type":22,"value":37},{"type":16,"tagName":429,"properties":503,"children":504},{"class":431},[505],{"type":16,"tagName":429,"properties":506,"children":507},{},[508],{"type":22,"value":509},"        v                                                          v",{"type":22,"value":37},{"type":16,"tagName":429,"properties":512,"children":513},{"class":431},[514],{"type":16,"tagName":429,"properties":515,"children":516},{},[517],{"type":22,"value":518},"  .................. phase-end liquidation check ..................",{"type":22,"value":37},{"type":16,"tagName":429,"properties":521,"children":522},{"class":431},[523],{"type":16,"tagName":429,"properties":524,"children":525},{},[526],{"type":22,"value":527},"   perps only: the FINAL position vs its liquidation price",{"type":22,"value":37},{"type":16,"tagName":429,"properties":530,"children":531},{"class":431},[532],{"type":16,"tagName":429,"properties":533,"children":534},{},[535],{"type":22,"value":536},"        |",{"type":22,"value":37},{"type":16,"tagName":429,"properties":539,"children":540},{"class":431},[541],{"type":16,"tagName":429,"properties":542,"children":543},{},[544],{"type":22,"value":545},"        v",{"type":22,"value":37},{"type":16,"tagName":429,"properties":548,"children":549},{"class":431},[550],{"type":16,"tagName":429,"properties":551,"children":552},{},[553],{"type":22,"value":554},"  [your script runs at bar close]  ->  orders placed here queue for the NEXT bar",{"type":22,"value":37},{"type":16,"tagName":39,"properties":557,"children":558,"position":567},{},[559],{"type":22,"value":560,"position":561},"Two consequences worth internalizing: your script always sees the bar's completed fills (a flat-position guard is already flat on the bar its exit filled), and nothing your script places can fill until the following bar.",{"start":562,"end":564},{"line":410,"column":26,"offset":563},2030,{"line":410,"column":565,"offset":566},221,2250,{"start":568,"end":569},{"line":410,"column":26,"offset":563},{"line":410,"column":565,"offset":566},{"type":22,"value":37},{"type":16,"tagName":17,"properties":572,"children":574,"position":584},{"id":573},"how-perps-liquidation-is-decided",[575],{"type":22,"value":576,"position":577},"How perps liquidation is decided",{"start":578,"end":581},{"line":579,"column":27,"offset":580},40,2255,{"line":579,"column":582,"offset":583},36,2287,{"start":585,"end":587},{"line":579,"column":26,"offset":586},2252,{"line":579,"column":582,"offset":583},{"type":22,"value":37},{"type":16,"tagName":39,"properties":590,"children":591,"position":620},{},[592,600,613],{"type":22,"value":593,"position":594},"For ",{"start":595,"end":598},{"line":596,"column":26,"offset":597},43,2290,{"line":596,"column":67,"offset":599},2294,{"type":16,"tagName":90,"properties":601,"children":602,"position":610},{},[603],{"type":22,"value":604,"position":605},"instrument=\"perps\"",{"start":606,"end":607},{"line":596,"column":67,"offset":599},{"line":596,"column":608,"offset":609},25,2314,{"start":611,"end":612},{"line":596,"column":67,"offset":599},{"line":596,"column":608,"offset":609},{"type":22,"value":614,"position":615},", liquidation has one evaluation at the end of each confirmed bar. In the ordinary price-action path, that check runs after the normal order-processing phases above and uses the final remaining position for the bar. The liquidation order is system-owned: it is not placed in your pending order queue and it cannot be canceled.",{"start":616,"end":617},{"line":596,"column":608,"offset":609},{"line":596,"column":618,"offset":619},351,2640,{"start":621,"end":622},{"line":596,"column":26,"offset":597},{"line":596,"column":618,"offset":619},{"type":22,"value":37},{"type":16,"tagName":39,"properties":625,"children":626,"position":636},{},[627],{"type":22,"value":628,"position":629},"If a position was already open and the bar gaps through its liquidation level, the fill uses the worse bar price. For a long, an open below the liquidation level fills at that open; otherwise a low through the level fills at the liquidation level. Shorts mirror that rule with the high and an open above the liquidation level.",{"start":630,"end":633},{"line":631,"column":26,"offset":632},45,2642,{"line":631,"column":634,"offset":635},327,2968,{"start":637,"end":638},{"line":631,"column":26,"offset":632},{"line":631,"column":634,"offset":635},{"type":22,"value":37},{"type":16,"tagName":39,"properties":641,"children":642,"position":811},{},[643,652,665,672,685,692,705,712,725,732,745,752,765,772,785,792,804],{"type":22,"value":644,"position":645},"When fills on the same chart bar changed the final position composition, OHLC data cannot prove whether the adverse extreme happened before or after the final composition existed. The engine resolves that honestly by assuming liquidation when the final liquidation level is reached, clamping the fill to the bar's traded range, incrementing ",{"start":646,"end":649},{"line":647,"column":26,"offset":648},47,2970,{"line":647,"column":650,"offset":651},342,3311,{"type":16,"tagName":90,"properties":653,"children":654,"position":662},{},[655],{"type":22,"value":656,"position":657},"ambiguousFillCount",{"start":658,"end":659},{"line":647,"column":650,"offset":651},{"line":647,"column":660,"offset":661},362,3331,{"start":663,"end":664},{"line":647,"column":650,"offset":651},{"line":647,"column":660,"offset":661},{"type":22,"value":666,"position":667},", and flagging the closed trade. The ",{"start":668,"end":669},{"line":647,"column":660,"offset":661},{"line":647,"column":670,"offset":671},399,3368,{"type":16,"tagName":90,"properties":673,"children":674,"position":682},{},[675],{"type":22,"value":676,"position":677},"perps-ambiguous-liquidation.ks",{"start":678,"end":679},{"line":647,"column":670,"offset":671},{"line":647,"column":680,"offset":681},431,3400,{"start":683,"end":684},{"line":647,"column":670,"offset":671},{"line":647,"column":680,"offset":681},{"type":22,"value":686,"position":687}," output records ",{"start":688,"end":689},{"line":647,"column":680,"offset":681},{"line":647,"column":690,"offset":691},447,3416,{"type":16,"tagName":90,"properties":693,"children":694,"position":702},{},[695],{"type":22,"value":696,"position":697},"ambiguousFillCount=1",{"start":698,"end":699},{"line":647,"column":690,"offset":691},{"line":647,"column":700,"offset":701},469,3438,{"start":703,"end":704},{"line":647,"column":690,"offset":691},{"line":647,"column":700,"offset":701},{"type":22,"value":706,"position":707},"; its final long ",{"start":708,"end":709},{"line":647,"column":700,"offset":701},{"line":647,"column":710,"offset":711},486,3455,{"type":16,"tagName":90,"properties":713,"children":714,"position":722},{},[715],{"type":22,"value":716,"position":717},"P_liq",{"start":718,"end":719},{"line":647,"column":710,"offset":711},{"line":647,"column":720,"offset":721},493,3462,{"start":723,"end":724},{"line":647,"column":710,"offset":711},{"line":647,"column":720,"offset":721},{"type":22,"value":726,"position":727}," is ",{"start":728,"end":729},{"line":647,"column":720,"offset":721},{"line":647,"column":730,"offset":731},497,3466,{"type":16,"tagName":90,"properties":733,"children":734,"position":742},{},[735],{"type":22,"value":736,"position":737},"122.625",{"start":738,"end":739},{"line":647,"column":730,"offset":731},{"line":647,"column":740,"offset":741},506,3475,{"start":743,"end":744},{"line":647,"column":730,"offset":731},{"line":647,"column":740,"offset":741},{"type":22,"value":746,"position":747},", outside the fixture bar's ",{"start":748,"end":749},{"line":647,"column":740,"offset":741},{"line":647,"column":750,"offset":751},534,3503,{"type":16,"tagName":90,"properties":753,"children":754,"position":762},{},[755],{"type":22,"value":756,"position":757},"90",{"start":758,"end":759},{"line":647,"column":750,"offset":751},{"line":647,"column":760,"offset":761},538,3507,{"start":763,"end":764},{"line":647,"column":750,"offset":751},{"line":647,"column":760,"offset":761},{"type":22,"value":766,"position":767}," to ",{"start":768,"end":769},{"line":647,"column":760,"offset":761},{"line":647,"column":770,"offset":771},542,3511,{"type":16,"tagName":90,"properties":773,"children":774,"position":782},{},[775],{"type":22,"value":776,"position":777},"120",{"start":778,"end":779},{"line":647,"column":770,"offset":771},{"line":647,"column":780,"offset":781},547,3516,{"start":783,"end":784},{"line":647,"column":770,"offset":771},{"line":647,"column":780,"offset":781},{"type":22,"value":786,"position":787}," traded range, so the liquidation fill is clamped to the bar high and recorded at ",{"start":788,"end":789},{"line":647,"column":780,"offset":781},{"line":647,"column":790,"offset":791},629,3598,{"type":16,"tagName":90,"properties":793,"children":794,"position":801},{},[795],{"type":22,"value":776,"position":796},{"start":797,"end":798},{"line":647,"column":790,"offset":791},{"line":647,"column":799,"offset":800},634,3603,{"start":802,"end":803},{"line":647,"column":790,"offset":791},{"line":647,"column":799,"offset":800},{"type":22,"value":805,"position":806},". This is not a hidden path guess. It is the explicit limit of chart-bar granularity.",{"start":807,"end":808},{"line":647,"column":799,"offset":800},{"line":647,"column":809,"offset":810},719,3688,{"start":812,"end":813},{"line":647,"column":26,"offset":648},{"line":647,"column":809,"offset":810},{"type":22,"value":37},{"type":16,"tagName":39,"properties":816,"children":817,"position":845},{},[818,826,839],{"type":22,"value":819,"position":820},"Liquidation is live from the entry fill onward, so entry-bar liquidation is possible. Funding settlements are applied in the bar-open phase before same-instant fills. If a settlement depletes the prior position's committed margin to zero or below, the bar still has one phase-end liquidation evaluation, but the settlement forces that outcome: the prior position liquidates at the settlement bar's open, and later same-bar fills cannot rescue it. After any perps close, if equity would be negative at the fill price, the engine floors equity at zero and records the clamped amount in ",{"start":821,"end":824},{"line":822,"column":26,"offset":823},49,3690,{"line":822,"column":239,"offset":825},4274,{"type":16,"tagName":90,"properties":827,"children":828,"position":836},{},[829],{"type":22,"value":830,"position":831},"stats.bankruptcyDeficit",{"start":832,"end":833},{"line":822,"column":239,"offset":825},{"line":822,"column":834,"offset":835},610,4299,{"start":837,"end":838},{"line":822,"column":239,"offset":825},{"line":822,"column":834,"offset":835},{"type":22,"value":372,"position":840},{"start":841,"end":842},{"line":822,"column":834,"offset":835},{"line":822,"column":843,"offset":844},611,4300,{"start":846,"end":847},{"line":822,"column":26,"offset":823},{"line":822,"column":843,"offset":844},{"type":22,"value":37},{"type":16,"tagName":39,"properties":850,"children":851,"position":861},{},[852],{"type":22,"value":853,"position":854},"Three shapes cover almost every liquidation. When the bar trades through the level, the fill is the level itself. When price gaps past it, the fill is the bar price, because that is where the market actually traded:",{"start":855,"end":858},{"line":856,"column":26,"offset":857},51,4302,{"line":856,"column":859,"offset":860},216,4517,{"start":862,"end":863},{"line":856,"column":26,"offset":857},{"line":856,"column":859,"offset":860},{"type":22,"value":37},{"type":13,"children":866},[867],{"type":16,"tagName":419,"properties":868,"children":869,"data":-1},{"class":421,"style":422,"tabindex":423},[870],{"type":16,"tagName":90,"properties":871,"children":872},{},[873,881,882,890,891,898,899,907,908,916,917,925,926,933,934],{"type":16,"tagName":429,"properties":874,"children":875},{"class":431},[876],{"type":16,"tagName":429,"properties":877,"children":878},{},[879],{"type":22,"value":880},"   trades through P_liq            gaps through P_liq",{"type":22,"value":37},{"type":16,"tagName":429,"properties":883,"children":884},{"class":431},[885],{"type":16,"tagName":429,"properties":886,"children":887},{},[888],{"type":22,"value":889},"        (fill = P_liq)             (fill = open, worse)",{"type":22,"value":37},{"type":16,"tagName":429,"properties":892,"children":893},{"class":431},[894],{"type":16,"tagName":429,"properties":895,"children":896},{},[897],{"type":22,"value":455},{"type":22,"value":37},{"type":16,"tagName":429,"properties":900,"children":901},{"class":431},[902],{"type":16,"tagName":429,"properties":903,"children":904},{},[905],{"type":22,"value":906},"   100 -+-- open                   100 -+-- prior close",{"type":22,"value":37},{"type":16,"tagName":429,"properties":909,"children":910},{"class":431},[911],{"type":16,"tagName":429,"properties":912,"children":913},{},[914],{"type":22,"value":915},"        |                               |",{"type":22,"value":37},{"type":16,"tagName":429,"properties":918,"children":919},{"class":431},[920],{"type":16,"tagName":429,"properties":921,"children":922},{},[923],{"type":22,"value":924},"   P_liq ==== fill ====                 |      (no trading here)",{"type":22,"value":37},{"type":16,"tagName":429,"properties":927,"children":928},{"class":431},[929],{"type":16,"tagName":429,"properties":930,"children":931},{},[932],{"type":22,"value":915},{"type":22,"value":37},{"type":16,"tagName":429,"properties":935,"children":936},{"class":431},[937],{"type":16,"tagName":429,"properties":938,"children":939},{},[940],{"type":22,"value":941},"    90 -+-- low                     80 -+-- open  \u003C- fill",{"type":22,"value":37},{"type":16,"tagName":39,"properties":944,"children":945,"position":973},{},[946,954,966],{"type":22,"value":947,"position":948},"And when fills changed the position inside the same bar, OHLC cannot prove whether the adverse extreme came before or after the change, so the engine assumes liquidation, clamps the fill to the bar's traded range, and counts it in ",{"start":949,"end":951},{"line":336,"column":26,"offset":950},4906,{"line":336,"column":952,"offset":953},232,5137,{"type":16,"tagName":90,"properties":955,"children":956,"position":963},{},[957],{"type":22,"value":656,"position":958},{"start":959,"end":960},{"line":336,"column":952,"offset":953},{"line":336,"column":961,"offset":962},252,5157,{"start":964,"end":965},{"line":336,"column":952,"offset":953},{"line":336,"column":961,"offset":962},{"type":22,"value":967,"position":968},":",{"start":969,"end":970},{"line":336,"column":961,"offset":962},{"line":336,"column":971,"offset":972},253,5158,{"start":974,"end":975},{"line":336,"column":26,"offset":950},{"line":336,"column":971,"offset":972},{"type":22,"value":37},{"type":13,"children":978},[979],{"type":16,"tagName":419,"properties":980,"children":981,"data":-1},{"class":421,"style":422,"tabindex":423},[982],{"type":16,"tagName":90,"properties":983,"children":984},{},[985,993,994,1001,1002,1010,1011,1019,1020,1028,1029,1037,1038],{"type":16,"tagName":429,"properties":986,"children":987},{"class":431},[988],{"type":16,"tagName":429,"properties":989,"children":990},{},[991],{"type":22,"value":992},"   same-bar entry + adverse extreme: order unknowable from OHLC",{"type":22,"value":37},{"type":16,"tagName":429,"properties":995,"children":996},{"class":431},[997],{"type":16,"tagName":429,"properties":998,"children":999},{},[1000],{"type":22,"value":455},{"type":22,"value":37},{"type":16,"tagName":429,"properties":1003,"children":1004},{"class":431},[1005],{"type":16,"tagName":429,"properties":1006,"children":1007},{},[1008],{"type":22,"value":1009},"   high -+----------------?  did price hit the extreme",{"type":22,"value":37},{"type":16,"tagName":429,"properties":1012,"children":1013},{"class":431},[1014],{"type":16,"tagName":429,"properties":1015,"children":1016},{},[1017],{"type":22,"value":1018},"         |    entry fills  ?  before or after the entry?",{"type":22,"value":37},{"type":16,"tagName":429,"properties":1021,"children":1022},{"class":431},[1023],{"type":16,"tagName":429,"properties":1024,"children":1025},{},[1026],{"type":22,"value":1027},"         |    somewhere    ?",{"type":22,"value":37},{"type":16,"tagName":429,"properties":1030,"children":1031},{"class":431},[1032],{"type":16,"tagName":429,"properties":1033,"children":1034},{},[1035],{"type":22,"value":1036},"    low -+----------------?   -> assume liquidation, clamp fill",{"type":22,"value":37},{"type":16,"tagName":429,"properties":1039,"children":1040},{"class":431},[1041],{"type":16,"tagName":429,"properties":1042,"children":1043},{},[1044],{"type":22,"value":1045},"                                 into [low, high], count it",{"type":22,"value":37},{"type":16,"tagName":17,"properties":1048,"children":1050,"position":1059},{"id":1049},"intrabar-ordering-and-fill-models",[1051],{"type":22,"value":1052,"position":1053},"Intrabar ordering and fill models",{"start":1054,"end":1057},{"line":1055,"column":27,"offset":1056},76,5506,{"line":1055,"column":98,"offset":1058},5539,{"start":1060,"end":1062},{"line":1055,"column":26,"offset":1061},5503,{"line":1055,"column":98,"offset":1058},{"type":22,"value":37},{"type":16,"tagName":39,"properties":1065,"children":1066,"position":1075},{},[1067],{"type":22,"value":1068,"position":1069},"A single OHLC bar tells you the range it traded, not the path it took. When both a protective stop and a profit limit sit inside one bar's range, the bar alone cannot say which traded first. The engine handles this class of question in three layers:",{"start":1070,"end":1072},{"line":162,"column":26,"offset":1071},5541,{"line":162,"column":1073,"offset":1074},250,5790,{"start":1076,"end":1077},{"line":162,"column":26,"offset":1071},{"line":162,"column":1073,"offset":1074},{"type":22,"value":37},{"type":16,"tagName":55,"properties":1080,"children":1081,"position":1277},{},[1082,1083,1113,1114,1145,1146,1276],{"type":22,"value":37},{"type":16,"tagName":60,"properties":1084,"children":1085,"position":1109},{},[1086,1102],{"type":16,"tagName":198,"properties":1087,"children":1088,"position":1097},{},[1089],{"type":22,"value":1090,"position":1091},"Certainty first.",{"start":1092,"end":1095},{"line":1093,"column":84,"offset":1094},80,5797,{"line":1093,"column":31,"offset":1096},5813,{"start":1098,"end":1100},{"line":1093,"column":27,"offset":1099},5795,{"line":1093,"column":46,"offset":1101},5815,{"type":22,"value":1103,"position":1104}," A leg already marketable at the open fills at the open. Decisions that are certain at chart level never involve any assumption.",{"start":1105,"end":1106},{"line":1093,"column":46,"offset":1101},{"line":1093,"column":1107,"offset":1108},152,5943,{"start":1110,"end":1112},{"line":1093,"column":26,"offset":1111},5792,{"line":1093,"column":1107,"offset":1108},{"type":22,"value":37},{"type":16,"tagName":60,"properties":1115,"children":1116,"position":1141},{},[1117,1134],{"type":16,"tagName":198,"properties":1118,"children":1119,"position":1128},{},[1120],{"type":22,"value":1121,"position":1122},"Finer data second.",{"start":1123,"end":1126},{"line":1124,"column":84,"offset":1125},81,5949,{"line":1124,"column":46,"offset":1127},5967,{"start":1129,"end":1131},{"line":1124,"column":27,"offset":1130},5947,{"line":1124,"column":1132,"offset":1133},26,5969,{"type":22,"value":1135,"position":1136}," When the platform holds finer-interval bars for that epoch, the engine walks them in time order and lets the actual path settle the question (see below).",{"start":1137,"end":1138},{"line":1124,"column":1132,"offset":1133},{"line":1124,"column":1139,"offset":1140},180,6123,{"start":1142,"end":1144},{"line":1124,"column":26,"offset":1143},5944,{"line":1124,"column":1139,"offset":1140},{"type":22,"value":37},{"type":16,"tagName":60,"properties":1147,"children":1148,"position":1272},{},[1149,1167,1173,1186,1190,1271],{"type":16,"tagName":198,"properties":1150,"children":1151,"position":1161},{},[1152],{"type":22,"value":1153,"position":1154},"Declared assumption last.",{"start":1155,"end":1158},{"line":1156,"column":84,"offset":1157},82,6129,{"line":1156,"column":1159,"offset":1160},31,6154,{"start":1162,"end":1164},{"line":1156,"column":27,"offset":1163},6127,{"line":1156,"column":1165,"offset":1166},33,6156,{"type":22,"value":1168,"position":1169}," Only when no finer data covers the bar does the declared ",{"start":1170,"end":1171},{"line":1156,"column":1165,"offset":1166},{"line":1156,"column":49,"offset":1172},6214,{"type":16,"tagName":90,"properties":1174,"children":1175,"position":1183},{},[1176],{"type":22,"value":1177,"position":1178},"fillModel",{"start":1179,"end":1180},{"line":1156,"column":49,"offset":1172},{"line":1156,"column":1181,"offset":1182},102,6225,{"start":1184,"end":1185},{"line":1156,"column":49,"offset":1172},{"line":1156,"column":1181,"offset":1182},{"type":22,"value":1187,"position":1188}," decide:\n",{"start":1189,"end":-1},{"line":1156,"column":1181,"offset":1182},{"type":16,"tagName":190,"properties":1191,"children":1192,"position":1268},{},[1193,1194,1239,1240,1267],{"type":22,"value":37},{"type":16,"tagName":60,"properties":1195,"children":1196,"position":1235},{},[1197,1211,1217,1228],{"type":16,"tagName":90,"properties":1198,"children":1199,"position":1208},{},[1200],{"type":22,"value":1201,"position":1202},"\"pessimistic\"",{"start":1203,"end":1206},{"line":1204,"column":84,"offset":1205},83,6239,{"line":1204,"column":329,"offset":1207},6254,{"start":1209,"end":1210},{"line":1204,"column":84,"offset":1205},{"line":1204,"column":329,"offset":1207},{"type":22,"value":1212,"position":1213}," (default): the stop is assumed to have filled first. The decision is counted in ",{"start":1214,"end":1215},{"line":1204,"column":329,"offset":1207},{"line":1204,"column":1181,"offset":1216},6335,{"type":16,"tagName":90,"properties":1218,"children":1219,"position":1225},{},[1220],{"type":22,"value":656,"position":1221},{"start":1222,"end":1223},{"line":1204,"column":1181,"offset":1216},{"line":1204,"column":70,"offset":1224},6355,{"start":1226,"end":1227},{"line":1204,"column":1181,"offset":1216},{"line":1204,"column":70,"offset":1224},{"type":22,"value":1229,"position":1230}," and the trade is flagged.",{"start":1231,"end":1232},{"line":1204,"column":70,"offset":1224},{"line":1204,"column":1233,"offset":1234},148,6381,{"start":1236,"end":1238},{"line":1204,"column":27,"offset":1237},6237,{"line":1204,"column":1233,"offset":1234},{"type":22,"value":37},{"type":16,"tagName":60,"properties":1241,"children":1242,"position":1263},{},[1243,1257],{"type":16,"tagName":90,"properties":1244,"children":1245,"position":1254},{},[1246],{"type":22,"value":1247,"position":1248},"\"pathHeuristic\"",{"start":1249,"end":1252},{"line":1250,"column":84,"offset":1251},84,6387,{"line":1250,"column":30,"offset":1253},6404,{"start":1255,"end":1256},{"line":1250,"column":84,"offset":1251},{"line":1250,"column":30,"offset":1253},{"type":22,"value":1258,"position":1259},": the TradingView-style path assumption (the open moves toward the nearer of high and low first). Natural path resolutions are not counted; only exact distance ties fall back to the pessimistic rule and count.",{"start":1260,"end":1261},{"line":1250,"column":30,"offset":1253},{"line":1250,"column":952,"offset":1262},6613,{"start":1264,"end":1266},{"line":1250,"column":27,"offset":1265},6385,{"line":1250,"column":952,"offset":1262},{"type":22,"value":37},{"start":1269,"end":1270},{"line":1204,"column":27,"offset":1237},{"line":1250,"column":952,"offset":1262},{"type":22,"value":37},{"start":1273,"end":1275},{"line":1156,"column":26,"offset":1274},6124,{"line":1250,"column":952,"offset":1262},{"type":22,"value":37},{"start":1278,"end":1279},{"line":1093,"column":26,"offset":1111},{"line":1250,"column":952,"offset":1262},{"type":22,"value":37},{"type":16,"tagName":39,"properties":1282,"children":1283,"position":1292},{},[1284],{"type":22,"value":1285,"position":1286},"Both models are fully deterministic.",{"start":1287,"end":1290},{"line":1288,"column":26,"offset":1289},86,6615,{"line":1288,"column":98,"offset":1291},6651,{"start":1293,"end":1294},{"line":1288,"column":26,"offset":1289},{"line":1288,"column":98,"offset":1291},{"type":22,"value":37},{"type":16,"tagName":17,"properties":1297,"children":1299,"position":1308},{"id":1298},"sub-bar-resolution",[1300],{"type":22,"value":1301,"position":1302},"Sub-bar resolution",{"start":1303,"end":1306},{"line":1304,"column":27,"offset":1305},88,6656,{"line":1304,"column":31,"offset":1307},6674,{"start":1309,"end":1311},{"line":1304,"column":26,"offset":1310},6653,{"line":1304,"column":31,"offset":1307},{"type":22,"value":37},{"type":16,"tagName":39,"properties":1314,"children":1315,"position":1325},{},[1316],{"type":22,"value":1317,"position":1318},"Backtests load a ladder of finer-interval bars over the replay window, subject to what the platform retains per lane (roughly: 1m for recent days, then 5m, 15m, and 1h reaching back years). Every ordering question that falls inside covered epochs is resolved by walking those finer bars with the exact same per-bar rules (touch, gap-through at opens, limit legs unslipped, stops slippage-adjusted). The first leg to trigger wins, at the triggering sub-bar's price.",{"start":1319,"end":1322},{"line":1320,"column":26,"offset":1321},90,6676,{"line":1320,"column":1323,"offset":1324},465,7140,{"start":1326,"end":1327},{"line":1320,"column":26,"offset":1321},{"line":1320,"column":1323,"offset":1324},{"type":22,"value":37},{"type":16,"tagName":39,"properties":1330,"children":1331,"position":1339},{},[1332],{"type":22,"value":1333,"position":1334},"Two properties keep this honest:",{"start":1335,"end":1337},{"line":263,"column":26,"offset":1336},7142,{"line":263,"column":1165,"offset":1338},7174,{"start":1340,"end":1341},{"line":263,"column":26,"offset":1336},{"line":263,"column":1165,"offset":1338},{"type":22,"value":37},{"type":16,"tagName":190,"properties":1344,"children":1345,"position":1399},{},[1346,1347,1363,1364,1398],{"type":22,"value":37},{"type":16,"tagName":60,"properties":1348,"children":1349,"position":1359},{},[1350],{"type":22,"value":1351,"position":1352},"Uncontested fills are byte-identical with and without finer data. The walk resolves ordering, it never changes the price of a fill that was already certain.",{"start":1353,"end":1356},{"line":1354,"column":28,"offset":1355},94,7178,{"line":1354,"column":1357,"offset":1358},159,7334,{"start":1360,"end":1362},{"line":1354,"column":26,"offset":1361},7176,{"line":1354,"column":1357,"offset":1358},{"type":22,"value":37},{"type":16,"tagName":60,"properties":1365,"children":1366,"position":1394},{},[1367,1375,1387],{"type":22,"value":1368,"position":1369},"If a single finest-lane bar still contains both levels, that residual question is settled by the declared ",{"start":1370,"end":1373},{"line":1371,"column":28,"offset":1372},95,7337,{"line":1371,"column":145,"offset":1374},7443,{"type":16,"tagName":90,"properties":1376,"children":1377,"position":1384},{},[1378],{"type":22,"value":1177,"position":1379},{"start":1380,"end":1381},{"line":1371,"column":145,"offset":1374},{"line":1371,"column":1382,"offset":1383},120,7454,{"start":1385,"end":1386},{"line":1371,"column":145,"offset":1374},{"line":1371,"column":1382,"offset":1383},{"type":22,"value":1388,"position":1389}," and counted, exactly as a chart bar would be.",{"start":1390,"end":1391},{"line":1371,"column":1382,"offset":1383},{"line":1371,"column":1392,"offset":1393},166,7500,{"start":1395,"end":1397},{"line":1371,"column":26,"offset":1396},7335,{"line":1371,"column":1392,"offset":1393},{"type":22,"value":37},{"start":1400,"end":1401},{"line":1354,"column":26,"offset":1361},{"line":1371,"column":1392,"offset":1393},{"type":22,"value":37},{"type":16,"tagName":17,"properties":1404,"children":1406,"position":1416},{"id":1405},"reading-the-precision-report",[1407],{"type":22,"value":1408,"position":1409},"Reading the precision report",{"start":1410,"end":1413},{"line":1411,"column":27,"offset":1412},97,7505,{"line":1411,"column":1414,"offset":1415},32,7533,{"start":1417,"end":1419},{"line":1411,"column":26,"offset":1418},7502,{"line":1411,"column":1414,"offset":1415},{"type":22,"value":37},{"type":16,"tagName":39,"properties":1422,"children":1423,"position":1432},{},[1424],{"type":22,"value":1425,"position":1426},"The Strategy Tester's run-details popover reports what the simulation actually did:",{"start":1427,"end":1430},{"line":1428,"column":26,"offset":1429},99,7535,{"line":1428,"column":1250,"offset":1431},7618,{"start":1433,"end":1434},{"line":1428,"column":26,"offset":1429},{"line":1428,"column":1250,"offset":1431},{"type":22,"value":37},{"type":16,"tagName":190,"properties":1437,"children":1438,"position":1566},{},[1439,1440,1471,1472,1503,1504,1536,1537,1565],{"type":22,"value":37},{"type":16,"tagName":60,"properties":1441,"children":1442,"position":1467},{},[1443,1461],{"type":16,"tagName":198,"properties":1444,"children":1445,"position":1455},{},[1446],{"type":22,"value":1447,"position":1448},"Fill precision: exact.",{"start":1449,"end":1452},{"line":1450,"column":67,"offset":1451},101,7624,{"line":1450,"column":1453,"offset":1454},27,7646,{"start":1456,"end":1458},{"line":1450,"column":28,"offset":1457},7622,{"line":1450,"column":1459,"offset":1460},29,7648,{"type":22,"value":1462,"position":1463}," The run posed no intrabar ordering questions at all.",{"start":1464,"end":1465},{"line":1450,"column":1459,"offset":1460},{"line":1450,"column":1156,"offset":1466},7701,{"start":1468,"end":1470},{"line":1450,"column":26,"offset":1469},7620,{"line":1450,"column":1156,"offset":1466},{"type":22,"value":37},{"type":16,"tagName":60,"properties":1473,"children":1474,"position":1499},{},[1475,1492],{"type":16,"tagName":198,"properties":1476,"children":1477,"position":1486},{},[1478],{"type":22,"value":1479,"position":1480},"Fill precision: verified on 1m + 5m data.",{"start":1481,"end":1483},{"line":1181,"column":67,"offset":1482},7706,{"line":1181,"column":1484,"offset":1485},46,7747,{"start":1487,"end":1489},{"line":1181,"column":28,"offset":1488},7704,{"line":1181,"column":1490,"offset":1491},48,7749,{"type":22,"value":1493,"position":1494}," Every contested fill was settled by walking finer bars.",{"start":1495,"end":1496},{"line":1181,"column":1490,"offset":1491},{"line":1181,"column":1497,"offset":1498},104,7805,{"start":1500,"end":1502},{"line":1181,"column":26,"offset":1501},7702,{"line":1181,"column":1497,"offset":1498},{"type":22,"value":37},{"type":16,"tagName":60,"properties":1505,"children":1506,"position":1532},{},[1507,1525],{"type":16,"tagName":198,"properties":1508,"children":1509,"position":1519},{},[1510],{"type":22,"value":1511,"position":1512},"Fill precision: N of M contested fills verified.",{"start":1513,"end":1516},{"line":1514,"column":67,"offset":1515},103,7810,{"line":1514,"column":1517,"offset":1518},53,7858,{"start":1520,"end":1522},{"line":1514,"column":28,"offset":1521},7808,{"line":1514,"column":1523,"offset":1524},55,7860,{"type":22,"value":1526,"position":1527}," Partial coverage: the rest were settled by the fill model over epochs with no finer data.",{"start":1528,"end":1529},{"line":1514,"column":1523,"offset":1524},{"line":1514,"column":1530,"offset":1531},145,7950,{"start":1533,"end":1535},{"line":1514,"column":26,"offset":1534},7806,{"line":1514,"column":1530,"offset":1531},{"type":22,"value":37},{"type":16,"tagName":60,"properties":1538,"children":1539,"position":1561},{},[1540,1555],{"type":16,"tagName":198,"properties":1541,"children":1542,"position":1550},{},[1543],{"type":22,"value":1544,"position":1545},"Fill precision: bar resolution.",{"start":1546,"end":1548},{"line":1497,"column":67,"offset":1547},7955,{"line":1497,"column":582,"offset":1549},7986,{"start":1551,"end":1553},{"line":1497,"column":28,"offset":1552},7953,{"line":1497,"column":410,"offset":1554},7988,{"type":22,"value":1556,"position":1557}," No finer data was available; the fill model settled everything.",{"start":1558,"end":1559},{"line":1497,"column":410,"offset":1554},{"line":1497,"column":1181,"offset":1560},8052,{"start":1562,"end":1564},{"line":1497,"column":26,"offset":1563},7951,{"line":1497,"column":1181,"offset":1560},{"type":22,"value":37},{"start":1567,"end":1568},{"line":1450,"column":26,"offset":1469},{"line":1497,"column":1181,"offset":1560},{"type":22,"value":37},{"type":16,"tagName":39,"properties":1571,"children":1572,"position":1623},{},[1573,1581,1593,1599,1617],{"type":22,"value":1574,"position":1575},"The same popover reports the compute time and, for ",{"start":1576,"end":1579},{"line":1577,"column":26,"offset":1578},106,8054,{"line":1577,"column":118,"offset":1580},8105,{"type":16,"tagName":90,"properties":1582,"children":1583,"position":1590},{},[1584],{"type":22,"value":1585,"position":1586},"slippageModel=\"bookEstimate\"",{"start":1587,"end":1588},{"line":1577,"column":118,"offset":1580},{"line":1577,"column":1156,"offset":1589},8135,{"start":1591,"end":1592},{"line":1577,"column":118,"offset":1580},{"line":1577,"column":1156,"offset":1589},{"type":22,"value":1594,"position":1595}," runs, the ",{"start":1596,"end":1597},{"line":1577,"column":1156,"offset":1589},{"line":1577,"column":74,"offset":1598},8146,{"type":16,"tagName":1600,"properties":1601,"children":1603,"position":1612},"a",{"href":1602},"slippage-and-costs.md#reading-the-slippage-disclosure",[1604],{"type":22,"value":1605,"position":1606},"slippage disclosure",{"start":1607,"end":1609},{"line":1577,"column":1354,"offset":1608},8147,{"line":1577,"column":1610,"offset":1611},113,8166,{"start":1613,"end":1614},{"line":1577,"column":74,"offset":1598},{"line":1577,"column":1615,"offset":1616},169,8222,{"type":22,"value":372,"position":1618},{"start":1619,"end":1620},{"line":1577,"column":1615,"offset":1616},{"line":1577,"column":1621,"offset":1622},170,8223,{"start":1624,"end":1625},{"line":1577,"column":26,"offset":1578},{"line":1577,"column":1621,"offset":1622},{"type":22,"value":37},{"type":16,"tagName":17,"properties":1628,"children":1630,"position":1639},{"id":1629},"choosing-an-interval-to-trust",[1631],{"type":22,"value":1632,"position":1633},"Choosing an interval to trust",{"start":1634,"end":1637},{"line":1635,"column":27,"offset":1636},108,8228,{"line":1635,"column":1165,"offset":1638},8257,{"start":1640,"end":1642},{"line":1635,"column":26,"offset":1641},8225,{"line":1635,"column":1165,"offset":1638},{"type":22,"value":37},{"type":16,"tagName":39,"properties":1645,"children":1646,"position":1656},{},[1647],{"type":22,"value":1648,"position":1649},"Cross-interval agreement has one structural limit worth understanding: brackets arm on the bar after the entry fills. On a 1-hour chart that protection gap is an hour of price movement; on a 1-minute chart it is a minute. A strategy whose stops are tight relative to its chart interval will genuinely behave differently at finer intervals, and no fill simulator can reconcile that, because the strategies are seeing different information. Practical guidance:",{"start":1650,"end":1653},{"line":1651,"column":26,"offset":1652},110,8259,{"line":1651,"column":1654,"offset":1655},459,8717,{"start":1657,"end":1658},{"line":1651,"column":26,"offset":1652},{"line":1651,"column":1654,"offset":1655},{"type":22,"value":37},{"type":16,"tagName":190,"properties":1661,"children":1662,"position":1713},{},[1663,1664,1680,1681,1695,1696,1712],{"type":22,"value":37},{"type":16,"tagName":60,"properties":1665,"children":1666,"position":1676},{},[1667],{"type":22,"value":1668,"position":1669},"Backtest at the interval you intend to run the strategy on.",{"start":1670,"end":1673},{"line":1671,"column":28,"offset":1672},112,8721,{"line":1671,"column":1674,"offset":1675},62,8780,{"start":1677,"end":1679},{"line":1671,"column":26,"offset":1678},8719,{"line":1671,"column":1674,"offset":1675},{"type":22,"value":37},{"type":16,"tagName":60,"properties":1682,"children":1683,"position":1691},{},[1684],{"type":22,"value":1685,"position":1686},"Keep stops and targets wide relative to the chart interval's typical bar range, or move to a finer chart.",{"start":1687,"end":1689},{"line":1610,"column":28,"offset":1688},8783,{"line":1610,"column":1635,"offset":1690},8888,{"start":1692,"end":1694},{"line":1610,"column":26,"offset":1693},8781,{"line":1610,"column":1635,"offset":1690},{"type":22,"value":37},{"type":16,"tagName":60,"properties":1697,"children":1698,"position":1708},{},[1699],{"type":22,"value":1700,"position":1701},"Treat the precision line as part of the result. A verified run at bar resolution over deep history and a fully walked run over recent months are both useful, but they are not the same experiment.",{"start":1702,"end":1705},{"line":1703,"column":28,"offset":1704},114,8891,{"line":1703,"column":1706,"offset":1707},198,9086,{"start":1709,"end":1711},{"line":1703,"column":26,"offset":1710},8889,{"line":1703,"column":1706,"offset":1707},{"type":22,"value":37},{"start":1714,"end":1715},{"line":1671,"column":26,"offset":1678},{"line":1703,"column":1706,"offset":1707},{"quirksMode":1717},false,{"start":1719,"end":1720},{"line":26,"column":26,"offset":34},{"line":1721,"column":26,"offset":1722},115,9087,1784888032096]