A long-only strategy that combines a market breadth index, the percentage of stocks above their 50-day average, with a long moving average of 225 periods.
1Copy the scriptPress Copy script above. It reads the file straight from GitHub.
2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
3Paste over the templateCreate a new strategy, select all of the template text and paste. Press Save and give it a name.
4Add it to the chartPress Add to chart. The trades and results appear in the Strategy Tester tab; adjust the settings with the gear icon.
Source Code
The code stays on GitHub. The author has not published this script under an open licence, so ForexR does not show its code. Copy script reads the file straight from GitHub into your clipboard, so you can still try it on your own chart. Ask the author before reusing the code anywhere else.
Overview
When price is above the average, it buys if breadth drops below 25. In bear mode, which is off by default, it buys after breadth rises back above 10. Entries need a slippage margin around the average, and it exits when price falls below the average. Backgrounds mark low breadth. There is no stop loss.
Breadth index from a configurable symbol
Different breadth floors above and below the average
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
50日宽度指标
string
NDFI
ndfi_symbol
宽度下限(牛市)
float
25.0
ndfi_lower_limit_above_ma
宽度下限(熊市)
float
10.0
ndfi_lower_limit_below_ma
均线类型
enum
ma_type.sma
selected_ma_type
均线长度
int
225
ma_length
滑点(%)
float
1
slide_pct
牛抄
bool
true
buy_above_ma
熊右抄
bool
false
buy_under_ma
Date
time
timestamp("1 Feb 2018 00:00 +0800")
start_date
Date
time
timestamp("31 Dec 2099 00:00 +0800")
end_date
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.
This strategy plots Bollinger Bands on the price chart with adjustable length, standard deviation, and offset. It defines buy and sell zones using candle size percentage and body size thresholds. Long positions enter when the lower zone is breached without con
The Mean Reversion Strategy Template calculates a baseline mean using SMA, EMA, or VWAP alongside upper and lower deviation bands based on standard deviation, ATR, or percentage offsets. It generates long and short entries when price touches, bounces from, or
This strategy draws on the price chart and combines Stochastic RSI, the Money Flow Index, and an exponential moving average to open long or short trades. Longs use the lower oscillator thresholds and shorts use the upper ones, with direction limited to longs,
This strategy generates buy and sell signals based on Bollinger Band crossovers combined with a simple moving average trend filter. It enters a long position when price crosses above the lower band while trading above the SMA filter line, and enters a short po
This strategy identifies long entry opportunities based on short-term price pullbacks below a major trend filter. It enters long when three consecutive lower closes occur below the 200-period simple moving average, followed by the current bar closing back abov
This strategy combines multi-timeframe RSI analysis with exponential moving average filters to execute trades on price bounces. It evaluates daily and weekly RSI levels alongside pip-distance thresholds between fast, slow, and long-term EMAs. Position entries