This code creates an indicator that generates Buy and Sell signals based on the Moving Average Distance (MAD) Ratio and the crossover/crossunder of two Simple Moving Averages (SMA). Here's a breakdown of what it does:
What the Indicator Shows: Moving Averages:
21-day SMA (shortMA): Plotted in blue. 200-day SMA (longMA): Plotted in red. These lines visually represent short-term and long-term trends in price. Horizontal Reference Line:
A gray horizontal line at Ratio = 1 marks when the 21-day SMA and 200-day SMA are equal. This is the neutral point for the MAD ratio. Buy and Sell Signals:
Buy Signal (Green Label):
Triggered when: MAD Ratio > 1 (shortMA is greater than longMA, indicating upward momentum). The 21-day SMA crosses above the 200-day SMA. Displays a green "BUY" label below the price chart. Sell Signal (Red Label):
Triggered when: MAD Ratio < 1 (shortMA is less than longMA, indicating downward momentum). The 21-day SMA crosses below the 200-day SMA. Displays a red "SELL" label above the price chart.
진정한 TradingView 정신에 따라, 이 스크립트의 저자는 트레이더들이 이해하고 검증할 수 있도록 오픈 소스로 공개했습니다. 저자에게 박수를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 출판물에서 이 코드를 재사용하는 것은 하우스 룰에 의해 관리됩니다. 님은 즐겨찾기로 이 스크립트를 차트에서 쓸 수 있습니다.