Repaints Time Series Projection Trend for ThinkorSwim

Repaints

J007RMC

Well-known member
2019 Donor
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:
# 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:
Its based on linear regression Ill repost the info I have here
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.
 
@J007RMC Let me make sure I understand this correctly. So Osc looks for the current trend in a short period using linear regression of the price. So on a daily chart a few days. While OSC2 is the same as OSC except that it is a longer length and uses the slope of the linear regression, used in OSC. If both are above 0 then a positive trend and if both below zero then its a negative trend. Also not a momentum oscillator. Did i misinterpret anything?
 
I came across a scan recently that had a custom study that was a single line of code: TimeSeriesForecast("price" = hl2)

Can someone explain what effect this study is having in simple terms? My google search had me in the weeds pretty quick.

The TOS definition is:
The Time Series Forecast study is a technical indicator displaying the statistical trend based on linear regression analysis using the least squares method. Time Series Forecast partially eliminates time lagging effect occurring in Moving Average studies as linear regression value is as close as possible to the values being averaged.

This indicator can be used for predicting future price movements (see the bar plus input description). Note that this type of prediction is purely mathematical as all calculations are based on least squares averaging of previous values.
 
I came across a scan recently that had a custom study that was a single line of code: TimeSeriesForecast("price" = hl2)

Can someone explain what effect this study is having in simple terms? My google search had me in the weeds pretty quick.

The TOS definition is:
The Time Series Forecast study is a technical indicator displaying the statistical trend based on linear regression analysis using the least squares method. Time Series Forecast partially eliminates time lagging effect occurring in Moving Average studies as linear regression value is as close as possible to the values being averaged.

This indicator can be used for predicting future price movements (see the bar plus input description). Note that this type of prediction is purely mathematical as all calculations are based on least squares averaging of previous values.
https://usethinkscript.com/threads/time-series-projection-trend-for-thinkorswim.1561/
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
442 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top