OPEN-SOURCE SCRIPT

MAD Ratio with Buy/Sell Signals

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.
Trend Analysis

オープンソーススクリプト

TradingViewの精神に則り、このスクリプトの作者は、トレーダーが理解し検証できるようにオープンソースで公開しています。作者に敬意を表します!無料で使用することができますが、このコードを投稿で再利用するには、ハウスルールに準拠する必要があります。 お気に入りに登録してチャート上でご利用頂けます。

チャートでこのスクリプトを利用したいですか?


他のメディア:

免責事項