#### J007RMC

##### Active member

**2019 Donor**

**VIP**

Mobius: Here's a study that uses an old method of predicting what price is likely to do in the very short term. The study uses linear regression as the forecasting tool. It looks at the current trend over a short period and a period one magnitude higher adds the slope of those trends then differences that with price to plot an oscillator around 0. If both periods agree the probability is trend will continue for one standard deviation of the shorter n period or n * .68. I added the arrows as overlay.

Code:

```
plot Data = close;# Time Series Projection
# Mobius
# V01.2018
# Uses Linear Regression to predict the price direction. Momentum suggests that the path of least resistance is determined by recent price trend. This indicator uses an order of magnitude in differencing a near and longer term projection.
# Use: When both near and long term agree - Probability is in that the trend will maintain current direction for (n * .68) bars.
declare lower;
input n = 5;
def n2 = n * 10;
def c = close;
def LRL = inertia(c, n);
def slope = AbsValue(LRL - LRL[n]) / n;
def SP = LRL + slope * floor(sqrt(n));
def LRL2 = inertia(c, n2);
def slope2 = AbsValue(LRL - LRL[n2]) / n2;
def SP2 = LRL2 + slope2 * floor(sqrt(n2));
plot OSC = (c - SP[1]) / c;
OSC.HideBubble();
OSC.HideTitle();
plot OSC2 = (c - SP2[1]) / c;
OSC2.HideBubble();
OSC2.HideTitle();
plot ZeroLine = 0;
ZeroLine.HideBubble();
ZeroLine.HideTitle();
Addlabel(if (OSC < 0 and OSC2 < 0)
or (OSC > 0 and OSC2 > 0)
then 1
else 0,
"Prob Trend Cont",
if OSC > 0 then color.green else color.red);
addCloud(0, OSC, color.red, color.green);
addCloud(0, OSC2, color.red, color.green);
# End Code
```

Last edited by a moderator: