OPEN-SOURCE SCRIPT

Mason’s Line Indicator

Updated
The Macon Strategy is an idea conceived by Didier Darcet, co-founder of Gavekal Intelligence Software. Inspired by the Water Level, an instrument used by masons to check the horizontality or verticality of a wall. This method aims to measure the psychology of financial markets and determine if the market is balanced or tilting towards an unfavorable side, focusing on the behavioral risk of markets rather than economic or political factors.

The strategy examines the satisfaction and frustration of investors based on the distance between the low and high points of the market over a period of one year. Investor satisfaction is influenced by the current price of the index and the path taken to reach that price. The distance to the low point provides satisfaction, while the distance to the high point generates frustration. The balance between the two dictates investors’ desire to hold or sell their positions.

To refine the strategy, it is important to consider the opinion of a group of investors rather than just one individual. The members of a hypothetical investor club invest successively throughout the past year. The overall satisfaction of the market on a given day is a democratic expression of all participants.

If the overall satisfaction is below 50%, investors are frustrated and sell their positions. If it is above, they are satisfied and hold their positions. The position of the group of investors relative to the high and low points represents the position of the air bubble in the water level. Market performance is measured day by day based on participant satisfaction or dissatisfaction.

In conclusion, memory, emotions, and decision-making ability are closely linked, and their interaction influences investment decisions. The Macon Strategy highlights the importance of the behavioral dimension in understanding financial market dynamics. By studying investor behavior through this strategy, it is possible to better anticipate market trends and make more informed investment decisions.


Presentation of the Mason’s Line Indicator:

The main strategy of this indicator is to measure the average satisfaction of investors based on the position of an imaginary air bubble in a tube delimited by the market’s highs and lows over a given period. After calculating the satisfaction level, it is then normalized between 0 and 1, and a moving average can be used to visualize trends.

Key features:

  • Calculation of highs and lows over a user-defined period.
  • Determination of the position of the air bubble in the tube based on the closing price.
  • Calculation of the average satisfaction of investors over a selected period.
  • Normalization of the average satisfaction between 0 and 1.
  • Visualization of normalized or non-normalized average satisfaction levels, as well as their corresponding moving averages.


User parameters:

  • Period for min and max (days): Sets the period over which highs and lows will be calculated (1 to 365 days).
  • Period for average satisfaction (days): Determines the period over which the average satisfaction of investors will be calculated (1 to 365 days).
  • Period for SMA: Sets the period of the simple moving average used to smooth the data (1 to 1000 days).
  • Bubble_value: Adjustment of the air bubble value, ranging from 0 to 1, in increments of 0.025.
  • Normalized average satisfaction: Option to choose whether to display the normalized or non-normalized average satisfaction.




Please note that the Mason’s Line Indicator is not a guarantee of future market performance and should be used in conjunction with proper risk management. Always ensure that you have a thorough understanding of the indicator’s methodology and its limitations before making any investment decisions. Additionally, past performance is not indicative of future results.




Release Notes
This version added a new input variable “smooth_normalized” which allows smoothing the normalized value using a period multiplier. This variable is used to calculate the range of minimum and maximum satisfaction values by multiplying the user-inputted satisfaction period by the value of “smooth_normalized”.
The variable “smooth_normalized” allows for smoothing the normalization of the average satisfaction over a period defined by the user. The value of this variable is used to determine the period over which the satisfaction normalization is smoothed before calculating the minimum and maximum values. The default value is set to 2, which means twice the period. For a chart display of 1 day, the normalization will therefore be carried out over a period of 2 years.

Additionally, the new code also modified the indicator line that plots the normalized value line to change the line style to “style_dashed” and thicken the line with “linewidth=2”.

Update :
  • Added a new input variable “smooth_normalized” which allows smoothing the normalized value using a period multiplier.
  • The “min_satisfaction” and “max_satisfaction” variables have been modified to use the “smooth_normalized” variable to calculate the range of minimum and maximum satisfaction values.
  • Modified the indicator line that plots the normalized value line to change the line style to “style_dashed” and thicken the line with “linewidth=2”.
  • The color of the “bubble value” line has been changed.




Release Notes
Update of the default value of smooth_normalized variable to a value of 2.
Release Notes
Update of the code formatting.
emotionemotionalequilibriummoving_averageOscillatorspsychologyriskriskmanagmentsentimentsentimentalanalysisstatisticstendance

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?

Disclaimer