Predict Future Price
Predict Future Price
// Input Parameters
lookback = input.int(20, minval=5, title="Linear Regression Lookback Period")
forecast_bars = input.int(5, minval=1, maxval=20, title="Number of Bars to Forecast
(1-20)")
vertical_offset = input.float(0.0, title="Vertical Offset for Forecasted Line",
step=0.1)
// EMA Parameters
ema_length = input.int(14, minval=1, title="EMA Length")
// MACD Parameters
fast_length = input.int(12, minval=1, title="MACD Fast Length")
slow_length = input.int(26, minval=1, title="MACD Slow Length")
signal_length = input.int(9, minval=1, title="MACD Signal Length")
// Calculate EMA
ema_value = ta.ema(close, ema_length)
plot(ema_value, color=color.green, title="EMA")
// Calculate MACD
[macd_line, signal_line, hist_line] = ta.macd(close, fast_length, slow_length,
signal_length)
plot(macd_line, color=color.blue, title="MACD Line")
plot(signal_line, color=color.orange, title="Signal Line")
plot(hist_line, color=color.gray, style=plot.style_histogram, title="MACD
Histogram")