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

開源腳本

在真正的TradingView精神中,這個腳本的作者以開源的方式發佈,這樣交易員可以理解和驗證它。請向作者致敬!您可以免費使用它,但在出版物中再次使用這段程式碼將受到網站規則的約束。 您可以收藏它以在圖表上使用。

想在圖表上使用此腳本?


Hey, don't forget to follow me!

t.me/+BeKBqrZPK15mN2E8
更多:

免責聲明