Studio has thirteen statistics indicators. They measure the closes of your last few candles: how straight a line they make, how spread out they are, and where the latest close sits among them. You can use each one in the Indicator condition block, as an Indicator signal, and in the condition exit. They work the same way in Backtest and in the Bot, and your indicator draws them on your chart and in your script.
The line of best fit
Eight of them start from the same line: the straight line that fits your last closes best (least squares). Its end is the least squares moving average.
- Linear regression slope: how far the line moves each candle, in ticks. Below zero, it is falling.
- Linear regression intercept: where the line starts, at the oldest of the closes. It is drawn on price.
- Linear regression angle: the slope as an angle, from minus 90 to 90 degrees. It is measured in ticks, so 45 degrees is one tick a candle on every market.
- R-squared: how closely the closes sit on the line, from 0 (not at all) to 1 (exactly).
- Time series forecast: the line carried one candle ahead. It is drawn on price.
- Standard error: how far the closes sit from the line, measured like a standard deviation of the misses, in ticks.
- Standard error bands: the line's end, with a band a number of standard errors above and below it.
- Standard deviation channel (the linear regression channel): the line's end, with edges a number of standard deviations of the closes around the line above and below it.
The spread of the closes
- Z-score: how many standard deviations the close is from the average of the closes. Below zero, it is under the average.
- Standard deviation: how spread out the closes are, in ticks.
- Variance: the standard deviation squared. Its size is in price squared, so a row asks only whether it is rising, falling or turning.
- Mean absolute deviation: the average distance of the closes from their average, in ticks.
- Percent rank: the share of the earlier closes that this close is at or above, from 0 to 100.
The standard deviation divides by the number of closes, as TradingView's does. Each one is worked out from its published formula. It uses only your broker's prices, on your computer.
What a row can ask
Most can be asked above or below a level you type, crossing it, and the line rising, falling or turning. The slope, standard error, standard deviation and mean absolute deviation take their level in ticks. Variance takes no level, only rising, falling or turning.
The intercept and the forecast are drawn on price, so a row asks whether the close is above or below the line, or crossing it. The two bands answer what Bollinger Bands answer: the close above the top band, below the bottom band or inside them, crossing an edge, touching one, and the width in ticks. They can't be asked rising or falling. The intercept, the forecast and the two bands can also be a moving target.
When it has a value
Each indicator waits until it has as many closed candles as the length you type (percent rank one more), then shows a value. The line of best fit needs at least three closes. A row that needs more candles than your warmup holds is refused when you put the strategy on an account.
In your indicator
Your indicator can draw every one of them on TradingView, NinjaTrader, MetaTrader 5, cTrader and Quantower.
Every number is yours
Each row asks for exactly the numbers its indicator reads: the length, and for the two bands how many standard errors or deviations wide they are. Nothing has a default.