Scripting Tutorial 6 - Triple Many Moving Averages Forecasting

This script is for a triple moving average indicator where the user can select from different types of moving averages, price sources and lookback periods.

- 3 Moving Averages with variable MA types, periods, price sources and ability to disable each individually
- Crossovers are plotted on the chart with detailed information regarding the crossover (Ex: 50 SMA crossed over 200 SMA )
- Forecasting available for all three MAs. MA values are forecasted 5 values out and plotted as if a continuation to the MA.
- Forecast bias also applies to all forecasting. Bias means we can forecast based on an anticipated bullish , bearish or neutral direction in the market.
- To understand bias, please read the source code, or if you can't read the code just send me a message on here or Twitter . Twitter should be linked on my profile.

This script is meant as an educational script with well-formatted styling, and references for specific functions.
Phát hành các Ghi chú: Added some more code comments to clarify what is happening in the script.
Phát hành các Ghi chú: Added some validations, metadata.
Mã nguồn mở

Với tinh thần của TradingView, tác giả đã xuất bản tập lệnh theo mã nguồn mở, vì thế trader có thể dễ dàng hiểu và tùy chỉnh được. Bạn có thể sử dụng miễn phí, hoặc tùy chỉnh lại mã đã được cấp phép bởi Quy tắc Chung. Bạn có thể sử dụng nó trên biểu đồ.

Bạn muốn sử dụng tập lệnh này trên biểu đồ?
Like and follow!

💻 Website:
📺 YouTube:
🎮 Discord:
🐦 Twitter:
💸 Save $30 on TradingView Paid Plan:

Bình luận

I guess there should be a correction for MA3Source, I guess it should be MA3Source and I guess you should change them all.
If i am incorrect please notify me. Regards and thanks for the development.

MA3Forecast2 = (ma(MA3Type, MA3Source, MA3Period - 2) * (MA3Period - 2) + ((MA1Source * 2) + (Bias * 2))) / MA3Period
+6 Phản hồi
This is for SMA and not for EMA right?
+3 Phản hồi
There are "Bias" in line 117 and line 127, are they the same thing?
or Pine allows the elements in a function have the same Spelling as other Variables?

sorry for the bad expression, I am not very good at English and Coding,
Thank you =)
Phản hồi
Thank you for good script.

I don't see code for volume (i tried too), which i tried as well.

I am actually looking for what is shown in image in this article i.e. show volume besides candles and emas...also wish to add macd in separate pane. I couldn't find any such sample code.
Phản hồi
Is there a reason why i am getting an error when attempting to use an EMA of 5? The program is telling me that i cannot have a value of "0" in the EMA function. It will, however, display a result when i change the value to anything greater than 5. Any thoughts?
Phản hồi
surishashank Andrew_Fineman
@Andrew_Fineman, It is because when you make the 5th forecast in this example it causes the "MAPeriod - 5" part to be 5-5 = 0.
Phản hồi