The system at a glance
As of 29 November 2026| Development | More than 3,000 hours to build the K1 system as a whole, Swing Intelligence and ITBF included; its research continues every day |
|---|---|
| K1 research engine | 51,000+ lines of Python in 270+ modules |
| Automated checks | 490+ tests that every change must pass before it is accepted |
| ITBF model | 4,975 lines of Pine Script v6 |
| Markets followed daily | 29: crypto, gold and silver, US index and sector funds, leading US stocks |
| Research record | 96 recorded findings; every test planned in writing before it runs |
| Standard for a new idea | Seven tests, including holdout data, walk-forward windows and 2,000-run Monte Carlo and bootstrap checks |
| Publication | Morning notes, afternoon updates and weekly reviews, each with its sources |
Swing Intelligence
The indicator and the strategySwing Intelligence is a rule-based indicator and strategy for TradingView, written in Pine Script v6. It reads a chart the way a structural analyst does, with one difference: every rule is written down, and every threshold is measured in the market's own volatility rather than in points or percentages.
- Volatility-normalised swings
- Moves are measured in units of the average true range (ATR, 14 periods, Wilder smoothing). A turn is confirmed only when price reverses by a set multiple of ATR on a closed candle, so one rule set reads Bitcoin on a four-hour chart and gold on a daily chart in the same way.
- The range model
- The recent trading range is split into a premium area near the top, an equilibrium band in the middle and a discount area near the bottom (Figure 2). Where price sits in its range is the context for every reading.
- Market structure
- Support and resistance, trendlines, liquidity sweeps, breakouts and changes of character are mapped around each confirmed swing.
- Invalidation built in
- Every confirmed turn comes with the level that would prove it wrong: beyond the reversal extreme, plus a volatility buffer. Two targets complete the picture.
- A strategy twin
- The strategy version runs the same engine in TradingView's Strategy Tester, so anyone can test the rules on their own market, timeframe and costs.
ITBF
The top-and-bottom finderITBF is a hybrid model of 4,975 lines of Pine Script that grades the quality of a trend and looks for the conditions that mark tops and bottoms. It was built the way K1 tests ideas: each component was measured on its own, and the ones that did not improve the results were switched off.
- Trend regime
- An EMA 50 and 100 ribbon, qualified by ADX and directional movement, Kaufman's efficiency ratio, the ribbon's separation in ATR units, its slope, and a limit on how often it flips. A regime is confirmed only after consecutive closes and held until the opposite confirmation, which removes most whipsaws.
- Higher-timeframe agreement
- A four-hour trend is checked against the weekly candle, a daily trend against the monthly one.
- No-trade state
- A chop detector built from weak ADX, low efficiency, a squeezed ribbon and frequent flips.
- Exits and protection
- A failed-breakout exit, a time stop for trades that make no progress, a partial target and a pivot trail.
- Risk overlay
- A two-stage overlay that reacts to soft closes and to the distance from the trend's peak, with hysteresis on the way back.
- Ablation tested
- A structure engine (pivot pools, third-touch trendlines, channels), liquidity sweeps and springs, Wyckoff signs of strength and weakness, candle patterns and oscillator scores were all built and measured. Only what added value stays switched on.
K1
The research engineK1 is the system behind Swing Intelligence. It gathers the data, runs the rules, keeps the records, does the testing and writes the daily analysis. It is written in Python and runs every day on its own server.
- Data
- Prices from exchanges, brokers and TradingView, and economic statistics from official sources, checked for gaps and late candles before anything uses them.
- Engine
- A Python implementation of the Swing Intelligence strategy, matched trade for trade against TradingView, with commission, slippage and price ticks modelled.
- Observation
- 29 markets followed on paper every day. Each closed candle is logged with its events (rejections, engulfing candles, sweeps of prior highs and lows, momentum and volume conditions) and with what followed over the next 3, 6 and 12 candles.
- Trade memory
- Every trade is stored with its maximum adverse and favourable excursion in units of risk, the time it was held, and the market's state at entry: trend side, slope and volatility band.
- Scorecard
- Recent results are compared with a bootstrap band built from history, so drift shows early. A weak spot is reported only when it is statistically separate from the market's average in both halves of the data.
- Strategy Lab
- One pre-registered test a day from a queue of methods and new ideas. Results are recorded whether the idea passes or fails.
- Publication
- Morning notes before the London open, afternoon updates and weekly reviews, each with its sources listed.
How an idea is tested
The seven testsNo idea reaches Swing Intelligence on the strength of a good-looking backtest. The plan is written and published before the test runs, and a candidate has to beat the current rules on all seven tests.
- Design period. Better return per unit of drawdown than the current rules on the first 70% of the history, with at least 20 trades affected.
- Holdout. The same result on the last 30%: data that was never used to choose anything.
- Walk-forward. Better in at least four of six consecutive windows, so the edge is not one good period.
- Double costs. Still better, and still profitable, with commission and slippage doubled.
- Parameter neighbours. At least 75% of the nearby settings still beat the current rules, so the result is not one lucky setting.
- Monte Carlo. The order of trades reshuffled 2,000 times; the 95th-percentile drawdown must stay within set limits.
- Not luck. A bootstrap of the average result per trade: no more than 5% of 2,000 resamples may fall at or below zero.
Beside every result, K1 reports how much capital was actually in use and the return on that capital. Ideas that fail go back to research, and the failure is recorded as carefully as a success.
An idea that passes all seven tests still changes nothing until Keyvan Khodakhah has seen the full results and approved it.
Explore
Free to read and watch- Daily market notesmarkets.khodakhah.netMorning notes before the London open, afternoon updates and weekly reviews across crypto, gold and silver, and US markets.
- Researchmarkets.khodakhah.net/researchLonger studies, such as where gold could find a floor after a bubble, with every source listed.
- Swing Intelligence lessonsmarkets.khodakhah.net/swing-intelligence.htmlFree video lessons on the indicator and the strategy, in order.
- Indicators on TradingViewwww.tradingview.com/u/keyvankhoSwing Intelligence and its strategy, free to add to any chart.
Important
Swing Intelligence and K1 are research and education. Nothing on this site or on markets.khodakhah.net is financial advice or a recommendation to buy or sell any investment.
- We do not give buy or sell signals or trade recommendations, and we do not run a signal service. What Swing Intelligence draws on a chart is an aid for your own analysis; every decision stays yours.
- We do not manage, hold or invest anyone else's money.
- We may hold positions in some of the markets we write about, for our own account.
- Markets can fall as well as rise, and you can lose money. Backtests and past results describe the past and do not promise future results.