[{"data":1,"prerenderedAt":1397},["ShallowReactive",2],{"kscript:strategies/slippage-and-costs":3},{"slug":4,"filePath":5,"frontmatter":6,"rawMarkdown":9,"tree":10},"strategies/slippage-and-costs","strategies/slippage-and-costs.md",{"title":7,"description":8},"Slippage and Costs","Commission, flat slippage, and slippageModel=\"bookEstimate\", which prices fills from recorded order-book depth where the platform has it.","---\ntitle: Slippage and Costs\ndescription: Commission, flat slippage, and slippageModel=\"bookEstimate\", which prices fills from recorded order-book depth where the platform has it.\n---\n\n> **Since engine 3.0.61; verified against engine 3.0.61.** Every example on this page is an executed probe against that build.\n\n## Commission\n\n`commissionPercent` is charged on every fill as a percent of the fill's notional value, on entries and exits alike. Fees reduce equity immediately and are reported per trade and in the totals.\n\n## Flat slippage (the default)\n\n`slippageBps` applies adversely to every fill that crosses the market: market entries, stop entries, protective stops, and trailing stops. Buys fill at `price * (1 + bps/10000)`, sells mirror. Limit fills, including take-profit legs, are exempt: a limit price is a bound and can fill better but never worse.\n\nFlat slippage is honest about being a constant: it neither grows with your order size nor tightens on liquid pairs. When you want size-aware and pair-aware slippage, opt into the book estimate.\n\n## Order-book slippage: slippageModel=\"bookEstimate\"\n\n```javascript title=\"scripts/probes/strategies/book-estimate.ks\"\n//@version=2\nstrategy(title=\"Book Estimate Demo\", initialCapital=10000, qtyType=\"fixed\", qtyValue=1, slippageBps=5, slippageModel=\"bookEstimate\")\n\ntimeseries bars = ohlcv(symbol=currentSymbol, exchange=currentExchange)\ntimeseries fast = sma(source=bars.close, period=5)\ntimeseries slow = sma(source=bars.close, period=20)\n\nif (crossover(fast, slow)) {\n  strategy.entry(\"L\", \"long\")\n}\nif (crossunder(fast, slow)) {\n  strategy.closeAll()\n}\n\nplotLine(value=fast, width=1, colors=[\"#4f8cff\"], label=[\"Fast SMA\"], desc=[\"5-period SMA of close\"])\nplotLine(value=slow, width=1, colors=[\"#f59e0b\"], label=[\"Slow SMA\"], desc=[\"20-period SMA of close\"])\n```\n\nWith `slippageModel=\"bookEstimate\"`, backtests load the pair's recorded order-book snapshots (one per chart bar) and price every market-crossing fill by walking that depth:\n\n- **The walk.** A buy consumes the ask side from the best level down, a sell consumes bids, for the order's quantity. The resulting volume-weighted price versus the best level gives an impact fraction, which is applied to the bar-derived fill price. The book contributes its depth shape, never its absolute price levels, so a modestly stale snapshot degrades gracefully instead of teleporting your fill.\n- **Size awareness.** Reversals walk the full quantity they actually cross (the closing leg plus the opening leg). Fills that land on the same bar share that bar's displayed liquidity: a later fill starts below what earlier fills consumed, and exhausting the visible book sends the fill to the declared fallback rather than pretending depth was infinite.\n- **Adverse-moment stress.** Protective stop and trailing fills consume twice their quantity from the book. They execute into adverse moments, and a calm snapshot understates that cost.\n- **Limit exemption.** Limit fills, including take-profit legs, remain exempt, same as the flat model.\n\n### When the book cannot answer\n\nThe walk refuses to invent numbers. A fill falls back to the declared `slippageBps` and is counted when:\n\n- the pair has no recorded book history at all (the run details say so),\n- no snapshot covers that bar (gaps, or the most recent minutes of a live chart),\n- the order's (stressed) quantity exceeds the visible depth,\n- the snapshot's best level sits more than 5% from the fill price (a stale or mismatched book is worse than no book).\n\nThis is an estimate by construction: aggregated snapshots cannot express queue dynamics or replenishment. That is exactly why the counts ship next to the number.\n\n### Reading the slippage disclosure\n\nThe Strategy Tester's run-details popover discloses how slippage was priced:\n\n- **\"Slippage: order-book depth estimate, avg N bps across M fills\"**: every market-crossing fill was priced from recorded depth.\n- **\"Slippage: order-book depth estimate on N of M fills, declared rate for the rest\"**: partial book coverage over the replay window.\n- **\"Slippage: order-book depth not recorded for this pair, declared rate applied\"**: the model fell back entirely; the result is equivalent to `slippageModel=\"fixed\"`.\n\nThe model is declared in the script, not toggled in the UI, so a shared strategy reproduces the same way for everyone who runs it. Book data loads for plus-tier backtests; pairs and epochs without recorded books degrade to the declared rate with the disclosure above.\n\n## Practical guidance\n\n- Set `slippageBps` even when using `bookEstimate`: it is your fallback rate wherever the book cannot answer, so make it realistic for the pair.\n- Size matters now. A strategy that trades 0.1% of equity and one that trades 50x leverage will see very different book impacts on the same signals, which is the point.\n- If the disclosure reports mostly fallback fills on a pair you care about, prefer the flat model with a defensible `slippageBps` instead of an estimate that rarely engaged.\n",{"type":11,"children":12,"data":1390,"position":1392},"root",[13,61,62,79,80,108,109,126,127,174,175,190,191,208,209,769,770,805,806,944,945,963,964,998,999,1074,1075,1089,1090,1106,1107,1122,1123,1246,1247,1262,1263,1279,1280],{"type":14,"tagName":15,"properties":16,"children":17,"position":57},"element","blockquote",{},[18,21,56],{"type":19,"value":20},"text","\n",{"type":14,"tagName":22,"properties":23,"children":24,"position":53},"p",{},[25,46],{"type":14,"tagName":26,"properties":27,"children":28,"position":39},"strong",{},[29],{"type":19,"value":30,"position":31},"Since engine 3.0.61; verified against engine 3.0.61.",{"start":32,"end":36},{"line":33,"column":34,"offset":35},1,5,4,{"line":33,"column":37,"offset":38},57,56,{"start":40,"end":43},{"line":33,"column":41,"offset":42},3,2,{"line":33,"column":44,"offset":45},59,58,{"type":19,"value":47,"position":48}," Every example on this page is an executed probe against that build.",{"start":49,"end":50},{"line":33,"column":44,"offset":45},{"line":33,"column":51,"offset":52},127,126,{"start":54,"end":55},{"line":33,"column":41,"offset":42},{"line":33,"column":51,"offset":52},{"type":19,"value":20},{"start":58,"end":60},{"line":33,"column":33,"offset":59},0,{"line":33,"column":51,"offset":52},{"type":19,"value":20},{"type":14,"tagName":63,"properties":64,"children":66,"position":75},"h2",{"id":65},"commission",[67],{"type":19,"value":68,"position":69},"Commission",{"start":70,"end":72},{"line":41,"column":35,"offset":71},131,{"line":41,"column":73,"offset":74},14,141,{"start":76,"end":78},{"line":41,"column":33,"offset":77},128,{"line":41,"column":73,"offset":74},{"type":19,"value":20},{"type":14,"tagName":22,"properties":81,"children":82,"position":105},{},[83,98],{"type":14,"tagName":84,"properties":85,"children":86,"position":95},"code",{},[87],{"type":19,"value":88,"position":89},"commissionPercent",{"start":90,"end":92},{"line":34,"column":33,"offset":91},143,{"line":34,"column":93,"offset":94},20,162,{"start":96,"end":97},{"line":34,"column":33,"offset":91},{"line":34,"column":93,"offset":94},{"type":19,"value":99,"position":100}," is charged on every fill as a percent of the fill's notional value, on entries and exits alike. Fees reduce equity immediately and are reported per trade and in the totals.",{"start":101,"end":102},{"line":34,"column":93,"offset":94},{"line":34,"column":103,"offset":104},193,335,{"start":106,"end":107},{"line":34,"column":33,"offset":91},{"line":34,"column":103,"offset":104},{"type":19,"value":20},{"type":14,"tagName":63,"properties":110,"children":112,"position":122},{"id":111},"flat-slippage-the-default",[113],{"type":19,"value":114,"position":115},"Flat slippage (the default)",{"start":116,"end":119},{"line":117,"column":35,"offset":118},7,340,{"line":117,"column":120,"offset":121},31,367,{"start":123,"end":125},{"line":117,"column":33,"offset":124},337,{"line":117,"column":120,"offset":121},{"type":19,"value":20},{"type":14,"tagName":22,"properties":128,"children":129,"position":171},{},[130,144,151,164],{"type":14,"tagName":84,"properties":131,"children":132,"position":141},{},[133],{"type":19,"value":134,"position":135},"slippageBps",{"start":136,"end":139},{"line":137,"column":33,"offset":138},9,369,{"line":137,"column":73,"offset":140},382,{"start":142,"end":143},{"line":137,"column":33,"offset":138},{"line":137,"column":73,"offset":140},{"type":19,"value":145,"position":146}," applies adversely to every fill that crosses the market: market entries, stop entries, protective stops, and trailing stops. Buys fill at ",{"start":147,"end":148},{"line":137,"column":73,"offset":140},{"line":137,"column":149,"offset":150},153,521,{"type":14,"tagName":84,"properties":152,"children":153,"position":161},{},[154],{"type":19,"value":155,"position":156},"price * (1 + bps/10000)",{"start":157,"end":158},{"line":137,"column":149,"offset":150},{"line":137,"column":159,"offset":160},178,546,{"start":162,"end":163},{"line":137,"column":149,"offset":150},{"line":137,"column":159,"offset":160},{"type":19,"value":165,"position":166},", sells mirror. Limit fills, including take-profit legs, are exempt: a limit price is a bound and can fill better but never worse.",{"start":167,"end":168},{"line":137,"column":159,"offset":160},{"line":137,"column":169,"offset":170},308,676,{"start":172,"end":173},{"line":137,"column":33,"offset":138},{"line":137,"column":169,"offset":170},{"type":19,"value":20},{"type":14,"tagName":22,"properties":176,"children":177,"position":187},{},[178],{"type":19,"value":179,"position":180},"Flat slippage is honest about being a constant: it neither grows with your order size nor tightens on liquid pairs. When you want size-aware and pair-aware slippage, opt into the book estimate.",{"start":181,"end":184},{"line":182,"column":33,"offset":183},11,678,{"line":182,"column":185,"offset":186},194,871,{"start":188,"end":189},{"line":182,"column":33,"offset":183},{"line":182,"column":185,"offset":186},{"type":19,"value":20},{"type":14,"tagName":63,"properties":192,"children":194,"position":204},{"id":193},"order-book-slippage-slippagemodelbookestimate",[195],{"type":19,"value":196,"position":197},"Order-book slippage: slippageModel=\"bookEstimate\"",{"start":198,"end":201},{"line":199,"column":35,"offset":200},13,876,{"line":199,"column":202,"offset":203},53,925,{"start":205,"end":207},{"line":199,"column":33,"offset":206},873,{"line":199,"column":202,"offset":203},{"type":19,"value":20},{"type":11,"children":210},[211],{"type":14,"tagName":212,"properties":213,"children":218,"data":-1},"pre",{"class":214,"style":215,"tabindex":216,"title":217},"shiki shiki-themes github-dark github-light","--shiki-dark:#e1e4e8;--shiki-light:#24292e;--shiki-dark-bg:#24292e;--shiki-light-bg:#fff","0","scripts/probes/strategies/book-estimate.ks",[219],{"type":14,"tagName":84,"properties":220,"children":221},{},[222,233,234,337,338,341,342,382,383,426,427,468,469,472,473,496,497,534,535,543,544,564,565,582,583,590,591,594,595,685,686],{"type":14,"tagName":223,"properties":224,"children":226},"span",{"class":225},"line",[227],{"type":14,"tagName":223,"properties":228,"children":230},{"style":229},"--shiki-dark:#6A737D;--shiki-light:#6A737D",[231],{"type":19,"value":232},"//@version=2",{"type":19,"value":20},{"type":14,"tagName":223,"properties":235,"children":236},{"class":225},[237,243,249,255,261,266,270,276,281,285,290,295,299,304,309,313,318,323,327,332],{"type":14,"tagName":223,"properties":238,"children":240},{"style":239},"--shiki-dark:#B392F0;--shiki-light:#6F42C1",[241],{"type":19,"value":242},"strategy",{"type":14,"tagName":223,"properties":244,"children":246},{"style":245},"--shiki-dark:#E1E4E8;--shiki-light:#24292E",[247],{"type":19,"value":248},"(title",{"type":14,"tagName":223,"properties":250,"children":252},{"style":251},"--shiki-dark:#F97583;--shiki-light:#D73A49",[253],{"type":19,"value":254},"=",{"type":14,"tagName":223,"properties":256,"children":258},{"style":257},"--shiki-dark:#9ECBFF;--shiki-light:#032F62",[259],{"type":19,"value":260},"\"Book Estimate Demo\"",{"type":14,"tagName":223,"properties":262,"children":263},{"style":245},[264],{"type":19,"value":265},", initialCapital",{"type":14,"tagName":223,"properties":267,"children":268},{"style":251},[269],{"type":19,"value":254},{"type":14,"tagName":223,"properties":271,"children":273},{"style":272},"--shiki-dark:#79B8FF;--shiki-light:#005CC5",[274],{"type":19,"value":275},"10000",{"type":14,"tagName":223,"properties":277,"children":278},{"style":245},[279],{"type":19,"value":280},", qtyType",{"type":14,"tagName":223,"properties":282,"children":283},{"style":251},[284],{"type":19,"value":254},{"type":14,"tagName":223,"properties":286,"children":287},{"style":257},[288],{"type":19,"value":289},"\"fixed\"",{"type":14,"tagName":223,"properties":291,"children":292},{"style":245},[293],{"type":19,"value":294},", qtyValue",{"type":14,"tagName":223,"properties":296,"children":297},{"style":251},[298],{"type":19,"value":254},{"type":14,"tagName":223,"properties":300,"children":301},{"style":272},[302],{"type":19,"value":303},"1",{"type":14,"tagName":223,"properties":305,"children":306},{"style":245},[307],{"type":19,"value":308},", slippageBps",{"type":14,"tagName":223,"properties":310,"children":311},{"style":251},[312],{"type":19,"value":254},{"type":14,"tagName":223,"properties":314,"children":315},{"style":272},[316],{"type":19,"value":317},"5",{"type":14,"tagName":223,"properties":319,"children":320},{"style":245},[321],{"type":19,"value":322},", slippageModel",{"type":14,"tagName":223,"properties":324,"children":325},{"style":251},[326],{"type":19,"value":254},{"type":14,"tagName":223,"properties":328,"children":329},{"style":257},[330],{"type":19,"value":331},"\"bookEstimate\"",{"type":14,"tagName":223,"properties":333,"children":334},{"style":245},[335],{"type":19,"value":336},")",{"type":19,"value":20},{"type":14,"tagName":223,"properties":339,"children":340},{"class":225},[],{"type":19,"value":20},{"type":14,"tagName":223,"properties":343,"children":344},{"class":225},[345,350,354,359,364,368,373,377],{"type":14,"tagName":223,"properties":346,"children":347},{"style":245},[348],{"type":19,"value":349},"timeseries bars ",{"type":14,"tagName":223,"properties":351,"children":352},{"style":251},[353],{"type":19,"value":254},{"type":14,"tagName":223,"properties":355,"children":356},{"style":239},[357],{"type":19,"value":358}," ohlcv",{"type":14,"tagName":223,"properties":360,"children":361},{"style":245},[362],{"type":19,"value":363},"(symbol",{"type":14,"tagName":223,"properties":365,"children":366},{"style":251},[367],{"type":19,"value":254},{"type":14,"tagName":223,"properties":369,"children":370},{"style":245},[371],{"type":19,"value":372},"currentSymbol, exchange",{"type":14,"tagName":223,"properties":374,"children":375},{"style":251},[376],{"type":19,"value":254},{"type":14,"tagName":223,"properties":378,"children":379},{"style":245},[380],{"type":19,"value":381},"currentExchange)",{"type":19,"value":20},{"type":14,"tagName":223,"properties":384,"children":385},{"class":225},[386,391,395,400,405,409,414,418,422],{"type":14,"tagName":223,"properties":387,"children":388},{"style":245},[389],{"type":19,"value":390},"timeseries fast ",{"type":14,"tagName":223,"properties":392,"children":393},{"style":251},[394],{"type":19,"value":254},{"type":14,"tagName":223,"properties":396,"children":397},{"style":239},[398],{"type":19,"value":399}," sma",{"type":14,"tagName":223,"properties":401,"children":402},{"style":245},[403],{"type":19,"value":404},"(source",{"type":14,"tagName":223,"properties":406,"children":407},{"style":251},[408],{"type":19,"value":254},{"type":14,"tagName":223,"properties":410,"children":411},{"style":245},[412],{"type":19,"value":413},"bars.close, period",{"type":14,"tagName":223,"properties":415,"children":416},{"style":251},[417],{"type":19,"value":254},{"type":14,"tagName":223,"properties":419,"children":420},{"style":272},[421],{"type":19,"value":317},{"type":14,"tagName":223,"properties":423,"children":424},{"style":245},[425],{"type":19,"value":336},{"type":19,"value":20},{"type":14,"tagName":223,"properties":428,"children":429},{"class":225},[430,435,439,443,447,451,455,459,464],{"type":14,"tagName":223,"properties":431,"children":432},{"style":245},[433],{"type":19,"value":434},"timeseries slow ",{"type":14,"tagName":223,"properties":436,"children":437},{"style":251},[438],{"type":19,"value":254},{"type":14,"tagName":223,"properties":440,"children":441},{"style":239},[442],{"type":19,"value":399},{"type":14,"tagName":223,"properties":444,"children":445},{"style":245},[446],{"type":19,"value":404},{"type":14,"tagName":223,"properties":448,"children":449},{"style":251},[450],{"type":19,"value":254},{"type":14,"tagName":223,"properties":452,"children":453},{"style":245},[454],{"type":19,"value":413},{"type":14,"tagName":223,"properties":456,"children":457},{"style":251},[458],{"type":19,"value":254},{"type":14,"tagName":223,"properties":460,"children":461},{"style":272},[462],{"type":19,"value":463},"20",{"type":14,"tagName":223,"properties":465,"children":466},{"style":245},[467],{"type":19,"value":336},{"type":19,"value":20},{"type":14,"tagName":223,"properties":470,"children":471},{"class":225},[],{"type":19,"value":20},{"type":14,"tagName":223,"properties":474,"children":475},{"class":225},[476,481,486,491],{"type":14,"tagName":223,"properties":477,"children":478},{"style":251},[479],{"type":19,"value":480},"if",{"type":14,"tagName":223,"properties":482,"children":483},{"style":245},[484],{"type":19,"value":485}," (",{"type":14,"tagName":223,"properties":487,"children":488},{"style":239},[489],{"type":19,"value":490},"crossover",{"type":14,"tagName":223,"properties":492,"children":493},{"style":245},[494],{"type":19,"value":495},"(fast, slow)) {",{"type":19,"value":20},{"type":14,"tagName":223,"properties":498,"children":499},{"class":225},[500,505,510,515,520,525,530],{"type":14,"tagName":223,"properties":501,"children":502},{"style":245},[503],{"type":19,"value":504},"  strategy.",{"type":14,"tagName":223,"properties":506,"children":507},{"style":239},[508],{"type":19,"value":509},"entry",{"type":14,"tagName":223,"properties":511,"children":512},{"style":245},[513],{"type":19,"value":514},"(",{"type":14,"tagName":223,"properties":516,"children":517},{"style":257},[518],{"type":19,"value":519},"\"L\"",{"type":14,"tagName":223,"properties":521,"children":522},{"style":245},[523],{"type":19,"value":524},", ",{"type":14,"tagName":223,"properties":526,"children":527},{"style":257},[528],{"type":19,"value":529},"\"long\"",{"type":14,"tagName":223,"properties":531,"children":532},{"style":245},[533],{"type":19,"value":336},{"type":19,"value":20},{"type":14,"tagName":223,"properties":536,"children":537},{"class":225},[538],{"type":14,"tagName":223,"properties":539,"children":540},{"style":245},[541],{"type":19,"value":542},"}",{"type":19,"value":20},{"type":14,"tagName":223,"properties":545,"children":546},{"class":225},[547,551,555,560],{"type":14,"tagName":223,"properties":548,"children":549},{"style":251},[550],{"type":19,"value":480},{"type":14,"tagName":223,"properties":552,"children":553},{"style":245},[554],{"type":19,"value":485},{"type":14,"tagName":223,"properties":556,"children":557},{"style":239},[558],{"type":19,"value":559},"crossunder",{"type":14,"tagName":223,"properties":561,"children":562},{"style":245},[563],{"type":19,"value":495},{"type":19,"value":20},{"type":14,"tagName":223,"properties":566,"children":567},{"class":225},[568,572,577],{"type":14,"tagName":223,"properties":569,"children":570},{"style":245},[571],{"type":19,"value":504},{"type":14,"tagName":223,"properties":573,"children":574},{"style":239},[575],{"type":19,"value":576},"closeAll",{"type":14,"tagName":223,"properties":578,"children":579},{"style":245},[580],{"type":19,"value":581},"()",{"type":19,"value":20},{"type":14,"tagName":223,"properties":584,"children":585},{"class":225},[586],{"type":14,"tagName":223,"properties":587,"children":588},{"style":245},[589],{"type":19,"value":542},{"type":19,"value":20},{"type":14,"tagName":223,"properties":592,"children":593},{"class":225},[],{"type":19,"value":20},{"type":14,"tagName":223,"properties":596,"children":597},{"class":225},[598,603,608,612,617,621,625,630,634,639,644,649,653,657,662,667,671,675,680],{"type":14,"tagName":223,"properties":599,"children":600},{"style":239},[601],{"type":19,"value":602},"plotLine",{"type":14,"tagName":223,"properties":604,"children":605},{"style":245},[606],{"type":19,"value":607},"(value",{"type":14,"tagName":223,"properties":609,"children":610},{"style":251},[611],{"type":19,"value":254},{"type":14,"tagName":223,"properties":613,"children":614},{"style":245},[615],{"type":19,"value":616},"fast, width",{"type":14,"tagName":223,"properties":618,"children":619},{"style":251},[620],{"type":19,"value":254},{"type":14,"tagName":223,"properties":622,"children":623},{"style":272},[624],{"type":19,"value":303},{"type":14,"tagName":223,"properties":626,"children":627},{"style":245},[628],{"type":19,"value":629},", colors",{"type":14,"tagName":223,"properties":631,"children":632},{"style":251},[633],{"type":19,"value":254},{"type":14,"tagName":223,"properties":635,"children":636},{"style":245},[637],{"type":19,"value":638},"[",{"type":14,"tagName":223,"properties":640,"children":641},{"style":257},[642],{"type":19,"value":643},"\"#4f8cff\"",{"type":14,"tagName":223,"properties":645,"children":646},{"style":245},[647],{"type":19,"value":648},"], label",{"type":14,"tagName":223,"properties":650,"children":651},{"style":251},[652],{"type":19,"value":254},{"type":14,"tagName":223,"properties":654,"children":655},{"style":245},[656],{"type":19,"value":638},{"type":14,"tagName":223,"properties":658,"children":659},{"style":257},[660],{"type":19,"value":661},"\"Fast SMA\"",{"type":14,"tagName":223,"properties":663,"children":664},{"style":245},[665],{"type":19,"value":666},"], desc",{"type":14,"tagName":223,"properties":668,"children":669},{"style":251},[670],{"type":19,"value":254},{"type":14,"tagName":223,"properties":672,"children":673},{"style":245},[674],{"type":19,"value":638},{"type":14,"tagName":223,"properties":676,"children":677},{"style":257},[678],{"type":19,"value":679},"\"5-period SMA of close\"",{"type":14,"tagName":223,"properties":681,"children":682},{"style":245},[683],{"type":19,"value":684},"])",{"type":19,"value":20},{"type":14,"tagName":223,"properties":687,"children":688},{"class":225},[689,693,697,701,706,710,714,718,722,726,731,735,739,743,748,752,756,760,765],{"type":14,"tagName":223,"properties":690,"children":691},{"style":239},[692],{"type":19,"value":602},{"type":14,"tagName":223,"properties":694,"children":695},{"style":245},[696],{"type":19,"value":607},{"type":14,"tagName":223,"properties":698,"children":699},{"style":251},[700],{"type":19,"value":254},{"type":14,"tagName":223,"properties":702,"children":703},{"style":245},[704],{"type":19,"value":705},"slow, width",{"type":14,"tagName":223,"properties":707,"children":708},{"style":251},[709],{"type":19,"value":254},{"type":14,"tagName":223,"properties":711,"children":712},{"style":272},[713],{"type":19,"value":303},{"type":14,"tagName":223,"properties":715,"children":716},{"style":245},[717],{"type":19,"value":629},{"type":14,"tagName":223,"properties":719,"children":720},{"style":251},[721],{"type":19,"value":254},{"type":14,"tagName":223,"properties":723,"children":724},{"style":245},[725],{"type":19,"value":638},{"type":14,"tagName":223,"properties":727,"children":728},{"style":257},[729],{"type":19,"value":730},"\"#f59e0b\"",{"type":14,"tagName":223,"properties":732,"children":733},{"style":245},[734],{"type":19,"value":648},{"type":14,"tagName":223,"properties":736,"children":737},{"style":251},[738],{"type":19,"value":254},{"type":14,"tagName":223,"properties":740,"children":741},{"style":245},[742],{"type":19,"value":638},{"type":14,"tagName":223,"properties":744,"children":745},{"style":257},[746],{"type":19,"value":747},"\"Slow SMA\"",{"type":14,"tagName":223,"properties":749,"children":750},{"style":245},[751],{"type":19,"value":666},{"type":14,"tagName":223,"properties":753,"children":754},{"style":251},[755],{"type":19,"value":254},{"type":14,"tagName":223,"properties":757,"children":758},{"style":245},[759],{"type":19,"value":638},{"type":14,"tagName":223,"properties":761,"children":762},{"style":257},[763],{"type":19,"value":764},"\"20-period SMA of close\"",{"type":14,"tagName":223,"properties":766,"children":767},{"style":245},[768],{"type":19,"value":684},{"type":19,"value":20},{"type":14,"tagName":22,"properties":771,"children":772,"position":802},{},[773,782,795],{"type":19,"value":774,"position":775},"With ",{"start":776,"end":779},{"line":777,"column":33,"offset":778},34,1641,{"line":777,"column":780,"offset":781},6,1646,{"type":14,"tagName":84,"properties":783,"children":784,"position":792},{},[785],{"type":19,"value":786,"position":787},"slippageModel=\"bookEstimate\"",{"start":788,"end":789},{"line":777,"column":780,"offset":781},{"line":777,"column":790,"offset":791},36,1676,{"start":793,"end":794},{"line":777,"column":780,"offset":781},{"line":777,"column":790,"offset":791},{"type":19,"value":796,"position":797},", backtests load the pair's recorded order-book snapshots (one per chart bar) and price every market-crossing fill by walking that depth:",{"start":798,"end":799},{"line":777,"column":790,"offset":791},{"line":777,"column":800,"offset":801},173,1813,{"start":803,"end":804},{"line":777,"column":33,"offset":778},{"line":777,"column":800,"offset":801},{"type":19,"value":20},{"type":14,"tagName":807,"properties":808,"children":809,"position":941},"ul",{},[810,811,842,843,874,875,907,908,940],{"type":19,"value":20},{"type":14,"tagName":812,"properties":813,"children":814,"position":838},"li",{},[815,831],{"type":14,"tagName":26,"properties":816,"children":817,"position":825},{},[818],{"type":19,"value":819,"position":820},"The walk.",{"start":821,"end":823},{"line":790,"column":34,"offset":822},1819,{"line":790,"column":73,"offset":824},1828,{"start":826,"end":828},{"line":790,"column":41,"offset":827},1817,{"line":790,"column":829,"offset":830},16,1830,{"type":19,"value":832,"position":833}," A buy consumes the ask side from the best level down, a sell consumes bids, for the order's quantity. The resulting volume-weighted price versus the best level gives an impact fraction, which is applied to the bar-derived fill price. The book contributes its depth shape, never its absolute price levels, so a modestly stale snapshot degrades gracefully instead of teleporting your fill.",{"start":834,"end":835},{"line":790,"column":829,"offset":830},{"line":790,"column":836,"offset":837},404,2218,{"start":839,"end":841},{"line":790,"column":33,"offset":840},1815,{"line":790,"column":836,"offset":837},{"type":19,"value":20},{"type":14,"tagName":812,"properties":844,"children":845,"position":870},{},[846,863],{"type":14,"tagName":26,"properties":847,"children":848,"position":857},{},[849],{"type":19,"value":850,"position":851},"Size awareness.",{"start":852,"end":855},{"line":853,"column":34,"offset":854},37,2223,{"line":853,"column":93,"offset":856},2238,{"start":858,"end":860},{"line":853,"column":41,"offset":859},2221,{"line":853,"column":861,"offset":862},22,2240,{"type":19,"value":864,"position":865}," Reversals walk the full quantity they actually cross (the closing leg plus the opening leg). Fills that land on the same bar share that bar's displayed liquidity: a later fill starts below what earlier fills consumed, and exhausting the visible book sends the fill to the declared fallback rather than pretending depth was infinite.",{"start":866,"end":867},{"line":853,"column":861,"offset":862},{"line":853,"column":868,"offset":869},355,2573,{"start":871,"end":873},{"line":853,"column":33,"offset":872},2219,{"line":853,"column":868,"offset":869},{"type":19,"value":20},{"type":14,"tagName":812,"properties":876,"children":877,"position":903},{},[878,896],{"type":14,"tagName":26,"properties":879,"children":880,"position":890},{},[881],{"type":19,"value":882,"position":883},"Adverse-moment stress.",{"start":884,"end":887},{"line":885,"column":34,"offset":886},38,2578,{"line":885,"column":888,"offset":889},27,2600,{"start":891,"end":893},{"line":885,"column":41,"offset":892},2576,{"line":885,"column":894,"offset":895},29,2602,{"type":19,"value":897,"position":898}," Protective stop and trailing fills consume twice their quantity from the book. They execute into adverse moments, and a calm snapshot understates that cost.",{"start":899,"end":900},{"line":885,"column":894,"offset":895},{"line":885,"column":901,"offset":902},186,2759,{"start":904,"end":906},{"line":885,"column":33,"offset":905},2574,{"line":885,"column":901,"offset":902},{"type":19,"value":20},{"type":14,"tagName":812,"properties":909,"children":910,"position":936},{},[911,929],{"type":14,"tagName":26,"properties":912,"children":913,"position":923},{},[914],{"type":19,"value":915,"position":916},"Limit exemption.",{"start":917,"end":920},{"line":918,"column":34,"offset":919},39,2764,{"line":918,"column":921,"offset":922},21,2780,{"start":924,"end":926},{"line":918,"column":41,"offset":925},2762,{"line":918,"column":927,"offset":928},23,2782,{"type":19,"value":930,"position":931}," Limit fills, including take-profit legs, remain exempt, same as the flat model.",{"start":932,"end":933},{"line":918,"column":927,"offset":928},{"line":918,"column":934,"offset":935},103,2862,{"start":937,"end":939},{"line":918,"column":33,"offset":938},2760,{"line":918,"column":934,"offset":935},{"type":19,"value":20},{"start":942,"end":943},{"line":790,"column":33,"offset":840},{"line":918,"column":934,"offset":935},{"type":19,"value":20},{"type":14,"tagName":946,"properties":947,"children":949,"position":959},"h3",{"id":948},"when-the-book-cannot-answer",[950],{"type":19,"value":951,"position":952},"When the book cannot answer",{"start":953,"end":956},{"line":954,"column":34,"offset":955},41,2868,{"line":954,"column":957,"offset":958},32,2895,{"start":960,"end":962},{"line":954,"column":33,"offset":961},2864,{"line":954,"column":957,"offset":958},{"type":19,"value":20},{"type":14,"tagName":22,"properties":965,"children":966,"position":995},{},[967,976,988],{"type":19,"value":968,"position":969},"The walk refuses to invent numbers. A fill falls back to the declared ",{"start":970,"end":973},{"line":971,"column":33,"offset":972},43,2897,{"line":971,"column":974,"offset":975},71,2967,{"type":14,"tagName":84,"properties":977,"children":978,"position":985},{},[979],{"type":19,"value":134,"position":980},{"start":981,"end":982},{"line":971,"column":974,"offset":975},{"line":971,"column":983,"offset":984},84,2980,{"start":986,"end":987},{"line":971,"column":974,"offset":975},{"line":971,"column":983,"offset":984},{"type":19,"value":989,"position":990}," and is counted when:",{"start":991,"end":992},{"line":971,"column":983,"offset":984},{"line":971,"column":993,"offset":994},105,3001,{"start":996,"end":997},{"line":971,"column":33,"offset":972},{"line":971,"column":993,"offset":994},{"type":19,"value":20},{"type":14,"tagName":807,"properties":1000,"children":1001,"position":1071},{},[1002,1003,1019,1020,1036,1037,1053,1054,1070],{"type":19,"value":20},{"type":14,"tagName":812,"properties":1004,"children":1005,"position":1015},{},[1006],{"type":19,"value":1007,"position":1008},"the pair has no recorded book history at all (the run details say so),",{"start":1009,"end":1012},{"line":1010,"column":41,"offset":1011},45,3005,{"line":1010,"column":1013,"offset":1014},73,3075,{"start":1016,"end":1018},{"line":1010,"column":33,"offset":1017},3003,{"line":1010,"column":1013,"offset":1014},{"type":19,"value":20},{"type":14,"tagName":812,"properties":1021,"children":1022,"position":1032},{},[1023],{"type":19,"value":1024,"position":1025},"no snapshot covers that bar (gaps, or the most recent minutes of a live chart),",{"start":1026,"end":1029},{"line":1027,"column":41,"offset":1028},46,3078,{"line":1027,"column":1030,"offset":1031},82,3157,{"start":1033,"end":1035},{"line":1027,"column":33,"offset":1034},3076,{"line":1027,"column":1030,"offset":1031},{"type":19,"value":20},{"type":14,"tagName":812,"properties":1038,"children":1039,"position":1049},{},[1040],{"type":19,"value":1041,"position":1042},"the order's (stressed) quantity exceeds the visible depth,",{"start":1043,"end":1046},{"line":1044,"column":41,"offset":1045},47,3160,{"line":1044,"column":1047,"offset":1048},61,3218,{"start":1050,"end":1052},{"line":1044,"column":33,"offset":1051},3158,{"line":1044,"column":1047,"offset":1048},{"type":19,"value":20},{"type":14,"tagName":812,"properties":1055,"children":1056,"position":1066},{},[1057],{"type":19,"value":1058,"position":1059},"the snapshot's best level sits more than 5% from the fill price (a stale or mismatched book is worse than no book).",{"start":1060,"end":1063},{"line":1061,"column":41,"offset":1062},48,3221,{"line":1061,"column":1064,"offset":1065},118,3336,{"start":1067,"end":1069},{"line":1061,"column":33,"offset":1068},3219,{"line":1061,"column":1064,"offset":1065},{"type":19,"value":20},{"start":1072,"end":1073},{"line":1010,"column":33,"offset":1017},{"line":1061,"column":1064,"offset":1065},{"type":19,"value":20},{"type":14,"tagName":22,"properties":1076,"children":1077,"position":1086},{},[1078],{"type":19,"value":1079,"position":1080},"This is an estimate by construction: aggregated snapshots cannot express queue dynamics or replenishment. That is exactly why the counts ship next to the number.",{"start":1081,"end":1084},{"line":1082,"column":33,"offset":1083},50,3338,{"line":1082,"column":94,"offset":1085},3499,{"start":1087,"end":1088},{"line":1082,"column":33,"offset":1083},{"line":1082,"column":94,"offset":1085},{"type":19,"value":20},{"type":14,"tagName":946,"properties":1091,"children":1093,"position":1102},{"id":1092},"reading-the-slippage-disclosure",[1094],{"type":19,"value":1095,"position":1096},"Reading the slippage disclosure",{"start":1097,"end":1100},{"line":1098,"column":34,"offset":1099},52,3505,{"line":1098,"column":790,"offset":1101},3536,{"start":1103,"end":1105},{"line":1098,"column":33,"offset":1104},3501,{"line":1098,"column":790,"offset":1101},{"type":19,"value":20},{"type":14,"tagName":22,"properties":1108,"children":1109,"position":1119},{},[1110],{"type":19,"value":1111,"position":1112},"The Strategy Tester's run-details popover discloses how slippage was priced:",{"start":1113,"end":1116},{"line":1114,"column":33,"offset":1115},54,3538,{"line":1114,"column":1117,"offset":1118},77,3614,{"start":1120,"end":1121},{"line":1114,"column":33,"offset":1115},{"line":1114,"column":1117,"offset":1118},{"type":19,"value":20},{"type":14,"tagName":807,"properties":1124,"children":1125,"position":1243},{},[1126,1127,1158,1159,1190,1191,1242],{"type":19,"value":20},{"type":14,"tagName":812,"properties":1128,"children":1129,"position":1154},{},[1130,1147],{"type":14,"tagName":26,"properties":1131,"children":1132,"position":1141},{},[1133],{"type":19,"value":1134,"position":1135},"\"Slippage: order-book depth estimate, avg N bps across M fills\"",{"start":1136,"end":1138},{"line":38,"column":34,"offset":1137},3620,{"line":38,"column":1139,"offset":1140},68,3683,{"start":1142,"end":1144},{"line":38,"column":41,"offset":1143},3618,{"line":38,"column":1145,"offset":1146},70,3685,{"type":19,"value":1148,"position":1149},": every market-crossing fill was priced from recorded depth.",{"start":1150,"end":1151},{"line":38,"column":1145,"offset":1146},{"line":38,"column":1152,"offset":1153},130,3745,{"start":1155,"end":1157},{"line":38,"column":33,"offset":1156},3616,{"line":38,"column":1152,"offset":1153},{"type":19,"value":20},{"type":14,"tagName":812,"properties":1160,"children":1161,"position":1186},{},[1162,1179],{"type":14,"tagName":26,"properties":1163,"children":1164,"position":1173},{},[1165],{"type":19,"value":1166,"position":1167},"\"Slippage: order-book depth estimate on N of M fills, declared rate for the rest\"",{"start":1168,"end":1170},{"line":37,"column":34,"offset":1169},3750,{"line":37,"column":1171,"offset":1172},86,3831,{"start":1174,"end":1176},{"line":37,"column":41,"offset":1175},3748,{"line":37,"column":1177,"offset":1178},88,3833,{"type":19,"value":1180,"position":1181},": partial book coverage over the replay window.",{"start":1182,"end":1183},{"line":37,"column":1177,"offset":1178},{"line":37,"column":1184,"offset":1185},135,3880,{"start":1187,"end":1189},{"line":37,"column":33,"offset":1188},3746,{"line":37,"column":1184,"offset":1185},{"type":19,"value":20},{"type":14,"tagName":812,"properties":1192,"children":1193,"position":1238},{},[1194,1211,1218,1231],{"type":14,"tagName":26,"properties":1195,"children":1196,"position":1205},{},[1197],{"type":19,"value":1198,"position":1199},"\"Slippage: order-book depth not recorded for this pair, declared rate applied\"",{"start":1200,"end":1202},{"line":45,"column":34,"offset":1201},3885,{"line":45,"column":1203,"offset":1204},83,3963,{"start":1206,"end":1208},{"line":45,"column":41,"offset":1207},3883,{"line":45,"column":1209,"offset":1210},85,3965,{"type":19,"value":1212,"position":1213},": the model fell back entirely; the result is equivalent to ",{"start":1214,"end":1215},{"line":45,"column":1209,"offset":1210},{"line":45,"column":1216,"offset":1217},145,4025,{"type":14,"tagName":84,"properties":1219,"children":1220,"position":1228},{},[1221],{"type":19,"value":1222,"position":1223},"slippageModel=\"fixed\"",{"start":1224,"end":1225},{"line":45,"column":1216,"offset":1217},{"line":45,"column":1226,"offset":1227},168,4048,{"start":1229,"end":1230},{"line":45,"column":1216,"offset":1217},{"line":45,"column":1226,"offset":1227},{"type":19,"value":1232,"position":1233},".",{"start":1234,"end":1235},{"line":45,"column":1226,"offset":1227},{"line":45,"column":1236,"offset":1237},169,4049,{"start":1239,"end":1241},{"line":45,"column":33,"offset":1240},3881,{"line":45,"column":1236,"offset":1237},{"type":19,"value":20},{"start":1244,"end":1245},{"line":38,"column":33,"offset":1156},{"line":45,"column":1236,"offset":1237},{"type":19,"value":20},{"type":14,"tagName":22,"properties":1248,"children":1249,"position":1259},{},[1250],{"type":19,"value":1251,"position":1252},"The model is declared in the script, not toggled in the UI, so a shared strategy reproduces the same way for everyone who runs it. Book data loads for plus-tier backtests; pairs and epochs without recorded books degrade to the declared rate with the disclosure above.",{"start":1253,"end":1256},{"line":1254,"column":33,"offset":1255},60,4051,{"line":1254,"column":1257,"offset":1258},268,4318,{"start":1260,"end":1261},{"line":1254,"column":33,"offset":1255},{"line":1254,"column":1257,"offset":1258},{"type":19,"value":20},{"type":14,"tagName":63,"properties":1264,"children":1266,"position":1275},{"id":1265},"practical-guidance",[1267],{"type":19,"value":1268,"position":1269},"Practical guidance",{"start":1270,"end":1273},{"line":1271,"column":35,"offset":1272},62,4323,{"line":1271,"column":861,"offset":1274},4341,{"start":1276,"end":1278},{"line":1271,"column":33,"offset":1277},4320,{"line":1271,"column":861,"offset":1274},{"type":19,"value":20},{"type":14,"tagName":807,"properties":1281,"children":1282,"position":1387},{},[1283,1284,1335,1336,1351,1352,1386],{"type":19,"value":20},{"type":14,"tagName":812,"properties":1285,"children":1286,"position":1331},{},[1287,1295,1306,1312,1325],{"type":19,"value":1288,"position":1289},"Set ",{"start":1290,"end":1293},{"line":1291,"column":41,"offset":1292},64,4345,{"line":1291,"column":117,"offset":1294},4349,{"type":14,"tagName":84,"properties":1296,"children":1297,"position":1303},{},[1298],{"type":19,"value":134,"position":1299},{"start":1300,"end":1301},{"line":1291,"column":117,"offset":1294},{"line":1291,"column":93,"offset":1302},4362,{"start":1304,"end":1305},{"line":1291,"column":117,"offset":1294},{"line":1291,"column":93,"offset":1302},{"type":19,"value":1307,"position":1308}," even when using ",{"start":1309,"end":1310},{"line":1291,"column":93,"offset":1302},{"line":1291,"column":853,"offset":1311},4379,{"type":14,"tagName":84,"properties":1313,"children":1314,"position":1322},{},[1315],{"type":19,"value":1316,"position":1317},"bookEstimate",{"start":1318,"end":1319},{"line":1291,"column":853,"offset":1311},{"line":1291,"column":1320,"offset":1321},51,4393,{"start":1323,"end":1324},{"line":1291,"column":853,"offset":1311},{"line":1291,"column":1320,"offset":1321},{"type":19,"value":1326,"position":1327},": it is your fallback rate wherever the book cannot answer, so make it realistic for the pair.",{"start":1328,"end":1329},{"line":1291,"column":1320,"offset":1321},{"line":1291,"column":1216,"offset":1330},4487,{"start":1332,"end":1334},{"line":1291,"column":33,"offset":1333},4343,{"line":1291,"column":1216,"offset":1330},{"type":19,"value":20},{"type":14,"tagName":812,"properties":1337,"children":1338,"position":1347},{},[1339],{"type":19,"value":1340,"position":1341},"Size matters now. A strategy that trades 0.1% of equity and one that trades 50x leverage will see very different book impacts on the same signals, which is the point.",{"start":1342,"end":1345},{"line":1343,"column":41,"offset":1344},65,4490,{"line":1343,"column":1236,"offset":1346},4656,{"start":1348,"end":1350},{"line":1343,"column":33,"offset":1349},4488,{"line":1343,"column":1236,"offset":1346},{"type":19,"value":20},{"type":14,"tagName":812,"properties":1353,"children":1354,"position":1382},{},[1355,1364,1375],{"type":19,"value":1356,"position":1357},"If the disclosure reports mostly fallback fills on a pair you care about, prefer the flat model with a defensible ",{"start":1358,"end":1361},{"line":1359,"column":41,"offset":1360},66,4659,{"line":1359,"column":1362,"offset":1363},117,4773,{"type":14,"tagName":84,"properties":1365,"children":1366,"position":1372},{},[1367],{"type":19,"value":134,"position":1368},{"start":1369,"end":1370},{"line":1359,"column":1362,"offset":1363},{"line":1359,"column":1152,"offset":1371},4786,{"start":1373,"end":1374},{"line":1359,"column":1362,"offset":1363},{"line":1359,"column":1152,"offset":1371},{"type":19,"value":1376,"position":1377}," instead of an estimate that rarely engaged.",{"start":1378,"end":1379},{"line":1359,"column":1152,"offset":1371},{"line":1359,"column":1380,"offset":1381},174,4830,{"start":1383,"end":1385},{"line":1359,"column":33,"offset":1384},4657,{"line":1359,"column":1380,"offset":1381},{"type":19,"value":20},{"start":1388,"end":1389},{"line":1291,"column":33,"offset":1333},{"line":1359,"column":1380,"offset":1381},{"quirksMode":1391},false,{"start":1393,"end":1394},{"line":33,"column":33,"offset":59},{"line":1395,"column":33,"offset":1396},67,4831,1783408980457]