- ago
Is there a way to draw a Cone of Probability on charts?
2
239
12 Replies

Reply

Bookmark

Sort
- ago
#1
Do you want to draw a probability density function (PDF)? If so, ScottPlot does all that. https://scottplot.net/cookbook/4.1/category/plottable-population/#population-plot and https://scottplot.net/cookbook/4.1/#statistics

ScottPlot also has a Statistics class to compute simple statistics. You can have ScottPlot output an image file to disk (I use the desktop), but I would recommend getting the finantic extension instead so it opens a separate child window. https://www.wealth-lab.com/extension/detail/finantic.InteractiveGraphics

You can search the WL forum for some ScottPlot examples.
0
- ago
#2
While Probability Cones also deal with statistical probability of future prices they're presented in a much more visually appealing way, not like the dots or Gaussian distribution you pointed to. If you have used the Probability Lab in IB's TWS or used Think or Swim you've likely seen them.

Here's how they're typically plotted; note the cone-shaped distribution:

-----------------------

Here are 3 additional references, with a pic from each, in case the developers wish to create an indicator:
1) Probability Cones (https://www.tradingview.com/script/Cp49eQt5-Probability-Cones/)

-----------------------


2) Using Probability Cones to Test for Strategy Death (https://alvarezquanttrading.com/blog/using-probability-cones-to-test-for-strategy-death/)

-----------------------


3) Improving Your Algo Trading By Using Monte Carlo Simulation and Probability Cones (https://towardsdatascience.com/improving-your-algo-trading-by-using-monte-carlo-simulation-and-probability-cones-abacde033adf?gi=7942c763092d)
0
Glitch8
 ( 11.81% )
- ago
#3
This looks like it would fit into our drawing object API, I’ll tag it as a feature request.
0
- ago
#4
Please note:

This "cone" shows prices that are reached with a certain probability. Such a "future price point" depends on three things:
1. how long do prices travel, i.e. how far back lies the starting point
2. Current volatility of underlying symbol
3. The probability level. (Drawn in different colors for different levels above)

Now imagine an indictor which shows such an estimated price every day.
Such an indicator would have
1. a lookback period which defines the starting point
2. calculate volatility internally
3. a volatility multiplier which corresponds with "probability". The larger the distance (in probability units) the lower the probability.

Now, if you understand that an SMA is an un-centered moving average, which calculates the best/average price exactly sma_period/2 bars back in the past, you'll arrive in a formula like this:

Probability_cone_price := SMA(lookback_period*2) +/- volatility * multiplier

... and this is the definition of:

Bollinger Bands
0
- ago
#5
@Glitch,
Kindly consider making it an indicator also, if possible, so it can be plotted off any bar. Reason: I intend to plot (at least initially) at an end-of-period bar and then project the cone forward from that point e.g. plot at last bar of month with forward projection for 20 bars and see how the prices played out w.r.t. the projected range. This way one could backtest its usefulness also. Folks could also project the price cones off of 1st intraday bar.

One thing that may become necessary - be it an API or an indicator - is what happens when the projected period is beyond the last bar; perhaps it could automatically pad the bars by the required # of bars so the user doesn't have to do it manually?
0
- ago
#6
@DrKoch,
QUOTE:
...shows such an estimated price every day

In that case it's Bollinger Band - for that bar.

Price cones, on the other hand, project price probability distribution over a multitude of bars (the projection period).

Also, ref #1 (https://www.tradingview.com/script/Cp49eQt5-Probability-Cones/) alludes that the forecast method can be either Standard or Laplace: BBands use Standard but for price cones perhaps Laplace (double exponential or continuous probability distribution) may be better? I don't know - I've no PhD in Math!!! - but do chime in with your thoughts.
0
Glitch8
 ( 11.81% )
- ago
#7
It doesn't fit within the Indicator paradigm. An Indicator in WL8 is something that returns a value for every bar of the chart. Not something that can plot on the chart.

A Drawing Object makes more sense.

0
- ago
#8
But surely this will also return (multiple) value(s) after the initial lookback period - even if they may be plotted at discrete intervals?
Or perhaps it can be triggered off of some event - just like Trailing Stops get triggered after a trade is entered?
0
Glitch8
 ( 11.81% )
- ago
#9
Exactly! Indicators don't return multiple values per bar, only one.

These probability cones are more analogous to another Drawing Object we already implemented, Volume Profile. It's a Drawing Object that you can drop on the chart, but it's backed by a feature-rich .NET class that you can use in your Strategies.
0
- ago
#10
To clarify, by multiple values I meant obtaining the the value xx StdDev above/below the projected mean at a future* bar - just like one can with multiple BBands. But unlike multiple BBands, which are all separate indicators, the Price Cone would encapsulate all such values within "one" cone.

*Future bar: To avoid confusion, the bar is only a future bar w.r.t. the bar from which it was calculated; the value would be constant regardless of whatever price action happens in the intervening bars - so peeking would not be an issue.
0
Glitch8
 ( 11.81% )
- ago
#11
But doesn't the probability cone by nature return multiple values for each bar since it's plotted? I see it projecting FOUR lines. It also needs an anchor bar, a concept that is just a natural for our Drawing Objects, but completely foreign and unworkable for an Indicator, unless it's something like VWAP that anchors to that start of every day.

I'm not sure what the resistance is to the idea of mapping this to a Drawing Object, with extended framework class support just like our Volume Profile.
0
- ago
#12
Just throwing out ideas, Glitch.
A Drawing Object will of course be nice.
0

Reply

Bookmark

Sort