This indicator uses a multi-timeframe approach to forecast future price levels. It does so by calculating a series of forecast points based on 12 preset pairs of timeframes. For each pair, the indicator retrieves the open price from two different resolutions—a “lower” and a “higher” timeframe—and uses their difference (with the order intentionally flipped) to project a forecasted price. The resulting forecast points are then connected by blue line segments to create a continuous forecast polyline.
How It Works
Defining Timeframe Pairs:
The script predefines 12 pairs of timeframes. For example:
Pair 1: Lower timeframe = 10 minutes; Higher timeframe = 100 minutes
Pair 2: Lower timeframe = 20 minutes; Higher timeframe = 110 minutes
… and so on, up to Pair 12 (with lower timeframe = 120 minutes and higher timeframe = 480 minutes).
Retrieving Prices Across Timeframes:
For each pair, the indicator uses the request.security function to retrieve the open prices for both the lower and higher timeframe. These values are obtained using lookahead=barmerge.lookahead_on so that the price data is aligned properly on the current chart.
Forecast Calculation (with a Flipped Difference):
Traditionally, one might expect to subtract the higher timeframe’s open from the lower timeframe’s open. However, in this indicator the calculation is flipped:
forecast
=
current close
+
(
higher timeframe open
−
lower timeframe open
)
forecast=current close+(higher timeframe open−lower timeframe open)
This means that for each pair, the difference is added to the current close price to produce a forecast value.
Determining the X-Axis Offset:
The indicator calculates an offset (in bars) for each forecast point. This offset is based on the ratio of the lower timeframe’s duration (converted to seconds) to the current chart’s timeframe (also in seconds). The offset determines how far in the future (in terms of bar index) each forecast point should be placed.
Plotting the Forecast Polyline:
Forecast Points:
Point 0: Represents the current bar’s close.
Points 1–12: Each is plotted at an x-coordinate shifted by its computed offset and at a y-coordinate given by the forecast value.
Line Segments:
The script creates persistent line objects (using var line) to draw segments connecting these points. On the last bar, each segment is updated so that the polyline connects from the current price (Point 0) through each forecasted point (Points 1–12) in sequence.
Visuals:
All line segments are drawn in blue with a width of 2.
Special Note on Calculation
Important: In the calculation of the forecast values, the usual subtraction order (lower timeframe minus higher timeframe) has been intentionally flipped. In this script, the forecast is computed as:
forecast
=
current close
+
(
higher timeframe open
−
lower timeframe open
)
forecast=current close+(higher timeframe open−lower timeframe open)
This reversed calculation is a deliberate design choice in this indicator’s methodology.
Usage and Disclaimer
Purpose: This indicator is intended for use as an analytical tool to forecast potential future price levels based on multi-timeframe dynamics. It is not a trading signal generator and should not be used as the sole basis for any trading decisions.
Educational Use: The script is provided for educational and informational purposes only. Users should perform their own analysis and testing before applying any forecasts to live trading.
No Warranty: The creator assumes no responsibility for losses incurred by using this indicator.