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.
版本注释
⋅
Per Tone: 1. Make the lines one level Thicker 2. Make the colors: Short - Orange, Mid - Purple, Long - Blue
版本注释
⋅
Bug fix on forecasts
Removed alternate MAs types until I can support properly
Very interesting indicator, Thanks for sharing.
Have u ever thought to add on the %of the accuracy of your forecast?
It could be interesting to add
- 95% probability forecast
- 75% probability forecast
- 50% probability forecast
considering different weights.
walien
⋅
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.
yatrader2
⋅
@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.
totoroha
⋅
can you make one for EMA?
bogi111
⋅
Using a number under 4 for the short term MA gives you an error
bogi111
⋅
@bogi111, Looks like it has to do with the linreg calculations which uses 3
thesean
⋅
Can you please explain what linear progression is and what changing the candle # does?
yatrader2
⋅
@thesean,
Linear regression is a way to find a best fit line 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.