OPEN-SOURCE SCRIPT

Open Close MA's 📈📉

64


📈 Open Close MA’s

This indicator helps you see the relationship between the market’s open and close prices by tracking them with Moving Averages (MA’s).

4 different Moving Averages can be selected: EMA (Exponential), SMA (Simple), HMA (Hull), and SMMA (Smoothed).

For those who aren’t sure which Moving Average is “right for them”… here’s a basic breakdown:
- Smoothed is the slowest (trendy)
- Simple is less slow
- Exponential reacts faster
- Hull is fast, yet smooth, and can be predictive

Keep in mind, the Length of any Moving Average is essential to the timeframe and strategy you are running.


Visually, this is what the indicator does:

• One line follows the average of closing prices of each candle.
• Another line follows the average of opening prices of each candle.
• When the close average is above the open average → the market is leaning bullish ⬆️.
• When the close average is below the open average → the market is leaning bearish ⬇️.

The indicator makes this easy to see by coloring the area between the two lines green (bullish) or orange (bearish). You can also turn on optional buy/sell markers whenever the two lines cross.

NOTE: Depending on the Base Timeframe field, the two lines crossing can occur in rapid succession, and should not (in and of itself) be considered a reason to enter a trade Long or Short.



Customization
• Choose between EMA, SMA, HMA, or SMMA.
• Adjust colors and transparency for bullish/bearish zones.
• Optional signal markers show crossover points.
• Base Timeframe is in minutes (default 5m), increase/decrease to match your timeframe for the most responsive Open/Close Moving Averages along those candles. For longer term trend information, increase beyond your timeframe (example: 30m setting on a 5m chart).



[Technical Breakdown]
• Close MA (c) and Open MA (o) are calculated separately using selected MA type.
• Dynamic length (len_i) scales based on base timeframe input (default 5m), so the smoothing adapts intelligently across different chart timeframes.
• Bull/Bear bias = c > o. The fill between the two lines switches colors accordingly.
• SMMA is implemented as a recursive calculation (similar to TradingView’s RMA, but explicitly coded here).
• Buy/Sell markers are triggered on ta.crossover(c, o) and ta.crossunder(c, o).


⸻ End of Line 📉 ———

免責事項

これらの情報および投稿は、TradingViewが提供または保証する金融、投資、取引、またはその他の種類のアドバイスや推奨を意図したものではなく、またそのようなものでもありません。詳しくは利用規約をご覧ください。