OPEN-SOURCE SCRIPT

Market Conditions 3W\3M [by Oberlunar]

This script represents my preliminary reasoning for evaluating market conditions. I wanted to automate a process that I usually apply manually, starting with the analysis of macro trends across multiple timeframes—monthly, weekly, and daily—to gain a clear understanding of the market's dominant direction and use it as a foundation for making operational decisions.

When I analyze the market, my first step is to determine whether there is a clear trend or if the market is in a sideways phase. To do this, I focus on historical data points. For the monthly and weekly timeframes, I look at the highs, lows, and medians of the last three periods. I then calculate linear regression trendlines for each timeframe to quantify the strength and direction of the trend. The slope of the trendline is particularly important to me, as it reveals whether the market is bullish, bearish, or neutral. I’ve set a specific threshold to filter out minor fluctuations, ensuring that only meaningful movements are classified as trends.

Once I’ve identified the trends for the monthly and weekly timeframes, I combine them to assess the overall market condition. If both timeframes indicate a bullish trend, I interpret this as a strong signal for a positive macro environment. Similarly, if both are bearish, it suggests a downtrend. However, if the trends diverge or the slope is too weak, I consider the market to be uncertain or sideways, and I avoid long-term operations.

For shorter-term decisions, like scalping or daily trading, I refine my analysis further. Here, I integrate daily conditions, focusing on specific criteria that align with my strategy. For example, I use the relationship between the 21-period and 200-period moving averages as a key filter. If the 21-period moving average is above the 200-period, and the daily close is higher than both the open and the 21-period moving average, I consider it a bullish confirmation. The opposite applies for bearish conditions. These additional filters ensure that my short-term decisions align with the broader market structure and trend dynamics.

The script then presents all this information in a table. It shows the slope and intercept of the trendlines for each timeframe, the classified market condition (bullish, bearish, or sideways), and the combined signals for both macro trends and short-term strategies. This structured output helps me translate my reasoning into actionable insights.
Moving Averagesmultitimeframeregressions

Script de código abierto

Siguiendo fielmente el espíritu de TradingView, el autor de este script lo ha publicado en código abierto, permitiendo que otros traders puedan entenderlo y verificarlo. ¡Olé por el autor! Puede utilizarlo de forma gratuita, pero tenga en cuenta que la reutilización de este código en la publicación se rige por las Normas internas. Puede añadir este script a sus favoritos y usarlo en un gráfico.

¿Quiere utilizar este script en un gráfico?


Hey, don't forget to follow me!

t.me/+BeKBqrZPK15mN2E8
También en:

Exención de responsabilidad