
Simple moving average code for forecasting stock prices
5 ビュー (過去 30 日間)
古いコメントを表示
Megawaty Lestari
2019 年 4 月 17 日
コメント済み: Clay Swackhamer
2019 年 4 月 21 日
I need code for predicting stock prices in future using simple moving average calculation
0 件のコメント
採用された回答
Clay Swackhamer
2019 年 4 月 17 日
Hi Megawaty,
Here is an idea:
time = 1:1:100' %100 trading days
stockPrice = rand(100,1)+3 %closing price in dollars on each day
movingAve = movmean(stockPrice,5) %moving average for weekly intervals
plot(time, stockPrice)
hold on
plot(time, movingAve)
legend('Price every day', 'Moving average price every week')
ylim([0 6])
ylabel('Price, $')
xlabel('Trading day')

3 件のコメント
Clay Swackhamer
2019 年 4 月 21 日
Hi Megawaty,
In this case "MachineLearningModellingNewUpdate" is a function, and the error "Undefined function or variable 'MachineLearningModellingNewUpdate'" tells us that Matlab does not know where this function can be found. Do you know where to get this function, or alternatively what it is supposed to do so that you could write it on your own?
Clay
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Financial Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
