Triple MA Forecast

2968 11
This script calculates 3 lengths of MAs (short, med, long, defaulted to Tone's preferred weekly lengths) using either the SMA , EMA or WMA and forecasts where the MAs will be in future periods (buy removing the oldest periods and adding future prices based on either current price "flat" or a 3 period liner regressions "linreg".

This was made for Tone Vays, because he is constantly trying to measure 30 bars back to see how the MA will change.
Sep 25
Release Notes: Per Tone:
1. Make the lines one level Thicker
2. Make the colors: Short - Orange, Mid - Purple, Long - Blue
Sep 26
Release Notes:
  • Bug fix on forecasts
  • Removed alternate MAs types until I can support properly
  • allowed options for live candles (or not)
  • Made LR period user setable.
Remove from Favorite Scripts Add to Favorite Scripts
This is awesome! Any thoughts on having it forecast a variable period? I tried to embed you plot in a for loop but it appears that Tradingview wouldn't allow it. :(
great work! really appreciate the script, was looking for it for some time :) bless you!
Thank you for this script!
Excellent, thank you!!

Two questions I have:
1) you say 'using either the SMA , EMA or WMA' and then updated with 'Removed alternate MAs' - so what is the current? Is it SMA? It is currently called just MA which leaves it a bit vague, but looks like SMA.
2) may I suggest adding 2 extra MA lines? It might sound too much but fact is that it is much easier to enable/disable lines than resetting it (a checkbox to turn on/off the lines that are already set in length and style); it would also be interesting to have the type of MA set by line, when you reach the point to enable other MAs again.
@walien, It is currently only SMA, sorry for the ambiguity. I'll add back the others when I get some time, but because of the way pinescript works it is a hassle to compute the forecasts for non SMAs.
Can you please explain what linear progression is and what changing the candle # does?
Linear regression is a way to find a best fit line https://en.wikipedia.org/wiki/Linear_regression
Include current unclosed current candle, is a toggle that sets whether the current incomplete candle is included in the MA and if you project 3 periods beyond the incomplete period, or 3 periods beyond the last closed candle.
+2 Reply
Great script! There is a bug on line 26 however: The variable used in the multiplier as well as the divisor should be '_len' not 'len'.
yatrader2 Nathan_the_Wise
@Nathan_the_Wise, I believe this has been corrected in latest update. Please let me know if there is an issue I have missed.
Using a number under 4 for the short term MA gives you an error
Home Stock Screener Forex Screener Crypto Screener Economic Calendar Shows How It Works Chart Features Pricing House Rules Moderators Website & Broker Solutions Widgets Charting Solutions Lightweight Charting Library Help Center Refer a friend Feature Request Blog & News FAQ Wiki Twitter
Profile Profile Settings Account and Billing Refer a friend My Support Tickets Help Center Ideas Published Followers Following Private Messages Chat Sign Out