OPEN-SOURCE SCRIPT

250710 Momentum Buy Trigger

50
What It Does (Step by Step)

Sets Up a Moving Average
Calculates a 200-period Simple Moving Average (SMA) of the closing price.
You can change the period by adjusting the maPeriod input.
Calculates Momentum with MACD Histogram
Uses MACD (Moving Average Convergence Divergence) with standard settings:
Fast EMA: 12
Slow EMA: 26
Signal Line: 9

Subtracts the signal line from the MACD line to get the MACD histogram (a momentum indicator).

Defines a Buy Signal
The script checks two conditions:

Price is below the 200-period SMA → suggesting the asset is undervalued.

MACD histogram is rising (i.e., current value is greater than the previous bar) → suggesting bullish momentum is starting.

If both are true on the same bar, a "Buy" signal is generated.

免責聲明

這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。