- Forecast a Standard or Laplace distribution.
- Change the how many bars the cones will lookback and sample in their calculations.
- Set how many bars to forecast the cones.
- Let the cones follow price from a set number of bars back.
- Anchor the cones and they will not update from their last location.
- Show or hide any set of cones.
- Change the deviation used of any cone's upper or lower line.
- Change any line's color, style, or width.
- Change or toggle the fill colors between any two cone lines.
- First, there is an assumption that the distribution starting from the cone's origin, based on the number of historical bars sampled, is likely to represent the distribution of future price.
- Price typically hangs around the mean.
- About 68% of price stays within the first deviation cones.
- About 95% of price stays within the second deviation cones.
- About 99.7% of price stays within the third deviation cones.
- When price is between the first and second deviation cones, there is a higher probability for a reversal.
- However, strong momentum while above or below the first deviation can indicate a trend where price maintains itself past the first deviation. For this reason it's recommended to use a alongside the cones.
- There is no mean reversion assumption when price deviates. Price can continue to stay deviated.
- It's recommended that the cones are placed at the beginning of calendar periods. Like the month, week, or day.
- Be mindful when using the cones on various timeframes. As the lookback setting, which selects the number of bars back to load from the cone's origin, will load the number of bars back based on the current timeframe.
Second Deviation Strategy
How to react when price goes beyond the second deviation is contingent on your trading position.
- If you are holding a losing trade and price has moved past the second deviation, it could be time to stop trading and exit.
- If you are holding a winning trade and price has moved past the second deviation, it would be best to look at exit strategies to capitalize on the outperformance.
- If price has moved beyond the second deviation and you hold no position, then do not open any new trades.
- Update cone input setting labels with "Upper" and "Lower" prefixes.
- Add Anchor Type input. Select between placing the origin based on bars or a date selection.
- New Select Date to Place Cones input. When Anchor Type is set to Select Date, the input will anchor and start the cone's origin from a selected date.
- Add @RicardoSantos to Acknowledgements for Date Select feature contribution. Thank you!
- Fix: OriginAnchor and OriginAnchorSub switch update.
- Resolve error: "The study references too many candles in history (5001)."
- Add "Higher Timeframe" to Anchor Type input. Anchor the cones to the beginning of a higher timeframe automatically.
- Add "Anchor Offset" input. Only effects the Higher Timeframe Anchor Type. Set to 1 by default. Offsets the cones to the right or left of the anchor position. Left is a positive number, right is negative.
- Change "Anchor Cones to Bars Back" input to "Lock Cones to Anchor Type". Tooltip reflects change.
- Update "Distribution" input tooltip.
- Update "Bar Forecast" input tooltip. Gives instructions on how to get forecasts past 70 bars.
- Add "Enable Fills" input tooltip.
- Update the Mean Settings section input layout.
When forecasting a period it is helpful to make the desired anchor point of the cone itself out of sample. This is especially noticeable using the Higher Timeframe Anchor Type. If the cones are anchored to the first candle of a period, and that candle is highly volatile, then that volatile candle will significantly alter the cones in spread and direction. It is arguably safer, at least certainly a more consistent practice for interpretations, to offset the cones so that they're not in sample of the desired forecast period.
- Update "Distributions" input title to to "Deviations". This more accurately represents what is being selected.
- The "Laplace" setting now says "Laplace Stdev" to clarify that it is the standard deviation measure.
- Add "Absolute" to Deviations input, this is the Absolute Deviation of the Mean input.
- New "Mean" input to select the desired mean for a deviation calculation. Default setting is "Auto" which will pick a predetermined mean for each selected Deviation input.
- Switch between Median Absolute Deviation and Average Absolute Deviation by changing the Mean calculation input.
- Mean Auto Setting: "Standard" uses Average. "Laplace Stdev" uses Median. "Absolute" uses Median.
- Update note on Basic Interpretations for the cones below.
- Change "Anchor Offset" input title to "HTF Anchor Offset" for clarity.
Why switch from "Distributions" to "Deviations"?
Because no statistical distributions (CDFs / PDFs) are being calculated in this indicator. This indictor offers measurements for different kinds of statistical deviations to calculate the upper and lower cones with. Each cone line is a multiple of that deviation above and below the mean.
There are 2 major points from in the Basic Interpretations section that need to be updated:
1. The 68-95-99.7 rule does not apply when interpreting the cones. That applies to log returns, not price.
2. There is no higher probability or assumption of reversal when price is "between the first and second deviation cones."
Thanks to @lejmer for his help, advice, and these corrections for the interpretations.
What is Absolute Deviation?
Mean Absolute Deviation, or MAD for short, it is another way of measuring the variability of data.
Wikipedia, "Moreover, the MAD is a robust statistic, being more resilient to outliers in a data set than the standard deviation. In the standard deviation, the distances from the mean are squared, so large deviations are weighted more heavily, and thus outliers can heavily influence it. In the MAD, the deviations of a small number of outliers are irrelevant."
@lejmer's acknowledgement was for an separate project, an open source library I have in development.
- 🆕 Use Mean Drift tick input. Adds or removes the drift to the cones caused by the mean's increasing or decreasing value in the future. Turning Use Mean Drift off projects forward only the initial value of the mean, and shifts the values of the cone's deviation lines relative to the mean.
In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.