サンプル
実際のコンパイラとランタイムを通るプログラム。それぞれ、必要な権限とターミナルへの作用を記しています。
Pure:どこでも動く
- 01Exact feesExact money: what a fill costs, with no binary rounding anywhere.
- 02Position sizingPosition sizing from a risk budget, rounded the way an exchange wants: prices to the tick, quantities down to the lot step (never up).
- 03Parse fillsReading text a person pasted: a few fills as CSV lines, parsed without
- 04Time bucketsTime without a clock: every instant comes from the data. Bucketing
- 05IndicatorsCausal indicators on a short series: each value uses only what was known
- 11Language basicsthe core of the language in one place — constants, records,
- 16Missing values"no value" is always said, never a silent 0 — empty
Host:ターミナルのデータとエンジンが必要
- 07Candle volatilityA published dataset's candles, hour by hour: realized volatility frommarket.read
- 08Backtest jobA backtest as a job: submit it, look at it while it runs, wait for itsmarket.readbacktest.run
- 09Market stateWhat a strategy could have known at an instant, computed by TTT's ownmarket.readresearch.submit
- 10Parameter sweepA small parameter sweep: the same strategy at three window lengths, allmarket.readbacktest.run
- 17Trade pagesread a run's closed trades page by page (`trades_page`), themarket.readbacktest.run
- 24Hook on symbol changea hook for "a symbol changes": say what the chart was and what it
- 26Hook on fill loga hook for "order filled": print what was filled, from the event.
- 33Leverage trap"the leverage trap": funding at an extreme, open interest climbing, price going nowhere -- the setup of a squeeze. Scores itmarket.readworkspace.write
- 39Gamma flip crossthe gamma flip: the strike where the options market's net gamma changes sign. Above it dealers damp moves, below it they feedmarket.readworkspace.readworkspace.write
- 40Carry scannerthe carry scanner: reads funding and basis (mark against index) for every symbol the terminal offers, ranks them, and opens amarket.readworkspace.readworkspace.write
- 45Orderflow strategyan order-flow strategy, described in T0 and run by TTT's engine. It buys when sellers were absorbed -- heavy one-sided selling that did notmarket.readbacktest.run
- 46Vwap 3sd reversiona VWAP reversion strategy, described in T0 and run by TTT's engine -- the same strategy, with the same rules, in a backtest and live on themarket.readbacktest.run
- 47Live vwap reversionthe VWAP third-deviation reversion of `46_vwap_3sd_reversion.tzs` (a bar closes beyond the third deviation of the session VWAP; the targetorders.submit
- 48Forming bar momentuma strategy that decides INSIDE the bar, from the bar still forming -- not from the last one that closed. It buys when, in the minute inorders.submit
- 49Footprint testa TEST strategy, made to trade often -- to see positions open with their take-profit and their stop on the chart, and those be hit.orders.submit
- 50Sweep fade manageda managed order-flow trade, written to use what a complex strategy needs: an entry that carries its own stop and target, a part of theorders.submit
- 51Intraday momentumBitcoin intraday time-series momentum, as published -- Shen, Urquhart and Wang, "Bitcoin intraday time-series momentum",orders.submit
- 52Flow supertrend kalmana trend strategy on the order-flow Supertrend. It enters when the fifteen-minute Supertrend made of what traded turnsorders.submit
- 53Stacked imbalance stopa footprint strategy. It buys when the last closed five-minute bar was bought hard -- positive delta, stacked buy imbalancesorders.submit
- 54Trend and fade bookstwo independent positions on one symbol -- a trend book and a fade book -- each with its own entries, its own scaling out and its ownorders.submit
- 55Pyramid with statea pyramid that remembers and that notices when an order is turned away. The strategy adds to a winning long up to `max_adds`orders.submit
- 56Opening range breakoutthe opening-range breakout. The first 30 minutes of the UTC day set a range; a stop order rests above it and another below,orders.submit
- 57Handler followera strategy decided by a function of the program (a handler) instead of by rules. The strategy keeps its signals -- the last pricemarket.readbacktest.run
- 58Scale out breakouta trade managed with resting exits. A breakout enters on a stop order that carries its own bracket; half of the position is taken at aorders.submit
- 59Handler with contexta handler that reads what the strategy holds. `handler bar(5) = on_bar(ctx, px, average)` gives the function a `handlers.Context` -- the open positionsmarket.readbacktest.run
- 60Gamma flip fadea strategy that reads the dealers' gamma. Under the gamma flip the dealers hedge with the move and it runs; over it they hedge againstorders.submit
- 65Sized by riska strategy that does not size its own trades. It says which way, where its stop is, and `Sizing.ByRisk`: the quantity is left to theorders.submit
- 69Risk sweephow much of the account to risk on each trade, found by running instead of guessing. The same strategy and the same dataset are backtested once for each value of themarket.readbacktest.run
- 73Notify on crossa strategy that tells and never trades. On every closed five-minute bar a handler compares the last price with its three-bar average and, when the price has gone to theorders.submit
- 77Alma crossa trend strategy on the Arnaud Legoux Moving Average (Arnaud Legoux and Dimitrios Kouzis-Loukas, 2009): it buys when a bar closes above the ALMA and sells when a bar closes below it,orders.submit
- 78Tunable ema crossan EMA crossover whose parameters say which of them an optimizer may move, with decorators (ADR-0015). It buys when the fast EMA of the closed bars crosses above the slow one and sells when it crossesorders.submit
- 79Trend flipthe volume-confirmed trend flip, on 4-hour bars, exactly as the research rule (docs/research/PREREGISTRATION-TREND-FLIP.md, Amendments 1-4), written as a strategy with every number a parameter the optimizerorders.submit
- 80Large trade wick fadefade a one-hour candle whose wick is longer than its body and holds large prints. If the candle's upper wick is longer than its body and at least `min_prints` large AGGRESSIVE BUYS traded in thatorders.submit
- 81Vwap touch fadefade the touch of the rolling VWAP. When the price reaches the rolling VWAP of 20 candles it is bought if it came down onto the line and sold if it came up to it -- against the cross --, with a target on aorders.submit
- 82Vwap candle cross fadefade a one-hour candle that reaches the THIRD band of the rolling VWAP. When a candle CLOSES and, against its own point of the bands of the VWAP of 20 candles -- what the terminal's RVWAP 20 draws at thatorders.submit
- 83Vwap candle big trades fadeexample 82 with one more filter, the large prints before the entry. Fade a one-hour candle that reaches the THIRD band of the rolling VWAP, but only when at least `big_least` (3) of the last `big_last` (5) large prints (each of at least `big_qty`: 20 BTC, the terminal's Large trades at 20 x) were on the trade's side -- bought by the aggressor for a long, sold for a short. When a candle CLOSES and, against its own point of the bands of the VWAP of 20 candles -- what the terminal's RVWAP 20 draws at thatorders.submit
- 84Ema cross big tradesfollow a cross of the price over its EMA of 20 candles when the big money agrees, and take the profit in three steps. When the price crosses the EMA from below to above, and at least 4 of the last 5 largeorders.submit
- 85Ichimoku tk big tradesfollow the TK cross of the Ichimoku cloud (the Tenkan over the Kijun, 20 and 60 candles) when the big money agrees, and take the profit in three steps. When the Tenkan crosses the Kijun from below to above, and at least 4 of the last 5 largeorders.submit
- 86Vwap cross big tradesfollow the price crossing the middle line of the rolling VWAP (the VWAP itself, the middle band of the chart's Rolling VWAP) when the big money agrees, and take the profit in three steps. When the price crosses the VWAP from below to above, and at least 4 of the last 5 largeorders.submit
- 87Turtle breakouta long-only Turtle breakout on daily bands of the New York trading day, with an optional day-trading mode. The trading day runs from 17:00 to 17:00 New York (summer time included); the bands and the ATR are made fromorders.submit
Workspace:チャートやパネルを読む・変更する
- 06WorkspaceThe terminal's own charts: read them, then change the active one.workspace.readworkspace.write
- 12Workspace inspectwhat is open in the terminal right now — charts, the activeworkspace.read
- 13Open chartopen a new chart in the terminal, at a chosen timeframe, andworkspace.readworkspace.write
- 14Open panelopen one of the panels the terminal itself offers, check it isworkspace.readworkspace.write
- 15Capabilitieswhat this terminal offers programs right now, contract bynone (it describes; it grants nothing)
- 18Close by prefixclose every chart whose symbol starts with a prefix (hereworkspace.readworkspace.write
- 19One chart per symbolmake sure there is a chart for each symbol of a watch list, atworkspace.readworkspace.write
- 20All charts to timeframeput every open chart on one timeframe, and say which onesworkspace.readworkspace.write
- 21Indicator by prefixturn an indicator on for every chart whose symbol starts withworkspace.readworkspace.write
- 22Focus or openbring a symbol's chart to the front, opening one if there isworkspace.readworkspace.write
- 23Charts by symbola report of the workspace by symbol — how many charts eachworkspace.read
- 25Hook on start open chartsa hook for "the terminal starts": make sure the charts you work withworkspace.readworkspace.write
- 27Trigger close chartsthe script of a Price Trigger Line: when the price crosses the line,workspace.readworkspace.write
- 28Trigger time reportthe script of a Time Trigger Line: when the market clock reaches theworkspace.read
- 29Custom indicatora custom indicator written in T0: an EMA of the chart's closes drawn as a line on the chart, and a mark where amarket.readworkspace.readworkspace.write
- 30Prior day levelsyesterday's high, low and close as levels on the chart, from the daily candles.market.readworkspace.readworkspace.write
- 31Level alertthe script of a Price Trigger Line that raises an alert: a chime on this terminal and, if you give it an address, aworkspace.writeexternal.access
- 32Hook session layouta hook for "every N seconds" that changes the desk when a trading session opens: the active chart's timeframe andworkspace.readworkspace.write
- 34Liquidation cascadea liquidation thermometer: how the last five minutes of forced closes compare with the hour before, and a mark on the chartmarket.readworkspace.readworkspace.write
- 35Gamma wall absorptionthe call wall and the put wall of the options market as levels on the chart, and a mark when the last closed bar wasmarket.readworkspace.readworkspace.write
- 36Pulled wallthe wall that was not there: the largest resting bid of the book five minutes ago, followed every ten seconds, marked on themarket.readworkspace.readworkspace.write
- 37Stop sweepthe stop sweep: the last closed bar broke under the lows of the twenty bars before it, a spike of long liquidations went off inmarket.readworkspace.readworkspace.write
- 38Icebergthe iceberg: a band of the book that is hit and fills back up again and again. Follows the largest resting bid and the largestmarket.readworkspace.readworkspace.write
- 41Cvd divergencespot against perpetual during a liquidation: over the last hour of five-minute bars, finds the bars in which long liquidations ranmarket.readworkspace.readworkspace.write
- 42Vwap monitora VWAP that watches, as an institutional desk computes it -- every trade at the price it printed, merged bar by bar into a running mean andmarket.readworkspace.readworkspace.write
- 43Delta divergence monitorthe divergence between price and the session's cumulative delta, watched bar by bar. It keeps the session's bars, its running delta andmarket.readworkspace.readworkspace.write
- 44Absorption zones monitorabsorption zones with a life, watched bar by bar. A closed one-minute bar that traded at least 2.5 times the recent average volume, withmarket.readworkspace.readworkspace.write
- 72On level crosswhat to do when an indicator gives a signal. Attached as a hook to the event `indicator_signal` (Script Hooks, with the indicator's name as the source filter), it chimes, says what theworkspace.writescript.run