Free: indicator teardowns, a repaint checker and open-source scripts. No buy/sell signals, ever.

Taught to TradeSystems over signals.

Explainers / Optimized Trend Tracker (OTT) by KivancO

Optimized Trend Tracker (OTT) by KivancOzbilgic, explained from the source

Optimized Trend Tracker, or OTT, is an open-source TradingView indicator published by KivancOzbilgic, with the idea credited in the code to Anil Ozeksi. It has about 23,000 boosts. It draws two lines on the price chart: a blue "support line" (a moving average) and a purple OTT line (a stop that trails that average). Buy and Sell labels mark where the two lines cross. This page walks through the published code, says what each part really does, and ends with where it fails. It does not say whether the indicator makes money, and it gives no trades.

The surprise: "OTT Period 2" does not mean a 2-bar average

The default average type is VAR, a variable index dynamic average. Its speed comes from two things: the period you set, and a momentum reading (Chande's CMO) that the code always takes over the last 9 bars. The 9 is written into the code. Changing "OTT Period" does not change it.

The CMO scales the average's speed down when price is going sideways. On our invented prices the typical scaling left the default "period 2" average moving like an ordinary exponential average of about 9 bars. A quarter of the time it was as slow as about 20 bars, and a quarter of the time as fast as about 5. So the setting labelled 2 is not a 2-bar average, and how fast the line moves depends on the recent 9 bars, not on the number in the box.

Step 1: the support line

The source (close by default) is smoothed by the chosen average: SMA, EMA, WMA, TMA, VAR, WWMA, ZLEMA or TSF. VAR is the default. This smoothed value is the blue support line.

Step 2: the percent stop

The code puts a band a fixed percent (default 1.4%) below and above the support line. While the trend is up, the lower band can only rise; while it is down, the upper band can only fall. When the support line crosses the band on the other side, the direction flips. This is the same ratchet idea as a Supertrend, but measured in percent of the average, not in ATR.

Step 3: the extra nudge

The chosen band is then moved a further half of the percent (0.7% at default) away from the support line, up when the line is above it and down when below. The result is the OTT value.

Step 4: the line is drawn two bars late

The purple line is plotted as the OTT value from two bars ago, and every Buy and Sell label compares today's support line with that two-bar-old value. This shift is deliberate in the design, and it is why the support line can cross OTT while the stop itself has not moved. It also means the line you see on any bar was computed from data that ended two bars earlier.

Step 5: labels and alerts

By default only the support-line crossings are labelled. Price crossings and colour-change labels exist but are switched off. The script has nine alert conditions (colour change, support-line cross, price cross, each with up and down) and no strategy code.

The green and red highlight between price and OTT compares the support line with the current OTT value, while the drawn line and the labels use the value from two bars ago. With the default VAR average the stop was flat often enough that these agreed on every bar in our test; with EMA selected they disagreed on 2.7% of bars, so the shading can show green while the support line sits below the purple line.

What we checked in Python

We ported the logic to Python and ran it on invented random-walk prices with a typical move of 1% a bar, each bar built from 10 smaller steps: 40 runs of 5,000 bars, the first 300 of each run left out. These prices have no trend to find.

How often the labels appear. With the defaults, a median of 267 Buy or Sell labels per 4,700 bars, about one every 18 bars, on prices with nothing to find. With EMA as the average, 807.

The live bar flickers. Until a bar closes, the support line moves with price. For every 10 crossings that were still there at the close, about 3 more appeared during a bar and were gone by its close (5.5 with EMA). The two-bar shift does not stop this, because the support line side is live.

The effective period. The VAR speed at default was the same as an exponential average of about 9 bars at the median (5 to 20 between the quartiles).

These figures describe the code on invented data, not any market.

Where it fails

Educational only. Not financial advice. Nothing here is a recommendation to buy or sell anything. Optimized Trend Tracker is by KivancOzbilgic (idea by Anil Ozeksi) on TradingView under the Mozilla Public License 2.0; this page describes its published open-source code in our own words and is not affiliated with the authors. Simulation figures come from synthetic random-walk prices and say nothing about how the script behaves on any market.

Also explained: Repaint checker, VWAP, Supertrend, RSI, UT Bot Alerts, Nadaraya-Watson Envelope, Squeeze Momentum, What is repainting on TradingView?, Is TradingView backtesting accurate?, Chandelier Exit, WaveTrend Oscillator, QQE MOD, Pivot highs and lows, Hull Suite, Range Filter, Twin Range Filter, HalfTrend, ZigZag++, SSL Hybrid, CM MacD Ultimate MTF, Volume Profile / Fixed Range, ADX and DI, Support Resistance Channels, Market Structure Break & Order Block, Order Block Finder, Pivot Point SuperTrend, Trendlines with Breaks [LuxAlgo], Divergence for Many Indicators, TradingView script selling terms, Support and Resistance Levels with Break, Liquidity Swings [LuxAlgo], Pine Script errors, Breakout Probability (Expo), Did ChatGPT or Claude write your Pine Sc, Lorentzian Classification, SuperTrend AI (Clustering), Machine Learning Adaptive SuperTrend, Dynamic Swing Anchored VWAP, Support and Resistance Power Channel by , Support and Resistance (High Volume Boxe, Trendline Breakouts With Targets by Char, Breakout Finder by LonesomeTheBlue, Volume Flow Indicator by LazyBear, FVG Order Blocks by BigBeluga, CM_Williams_Vix_Fix by ChrisMoody, Bollinger + RSI Double Strategy by Chart, Ultimate Moving Average MTF by ChrisMood, Fibonacci Bollinger Bands by Rashad, Candlestick Patterns Identified by repo3, MACD + SMA 200 Strategy by ChartArt, Pine Script v5 to v6, Moving Average Cross Alert, Multi-Timefr, WaveTrend Oscillator [WT] by LazyBear, WaveTrend with Crosses [LazyBear], CM_Price-Action-Bars by ChrisMoody, RSI Candles by glaz, CM RSI-2 Strategy Lower Indicator by Chr, CM Stochastic Multi-TimeFrame by ChrisMo, CM_Ultimate RSI Multi Time Frame by Chri, TonyUX EMA Scalper - Buy / Sell by tux, MACD 4C by vkno422, My Pine Script is valid. What did the va

Next steps

  • Get a script fixed. Compiles but behaves differently live, or changes after a reload? In a Pine Script Audit, an AI model reads every line and writes a report on what to fix for $49, or also fixes those problems for $149. It cannot prove a script is safe.
  • Check your own script. Paste its source into the free repaint checker. It runs in your browser and flags known patterns.
Before you trust its backtest: the Integrity Checklist, $19 one-offBack to Taught to Trade

No TradingView account yet? This affiliate link gives you a $15 coupon toward a paid plan, and we earn a commission if you buy one. The free plan is enough to follow this page.