1Copy the scriptPress Copy script above, or the copy button on the code below.
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
289 lines of Pine Script v5 from Tradingview/bars-move-strategy.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.
Bars%Move Strategy generates buy or sell signals when movement rules are met, overlaid directly on the price chart. Users can customize entry criteria, invert signal logic, restrict trading to specific session hours, and enforce directional trade alternation. Risk management settings include optional take profit targets and stop losses defined by percentage or fixed price. It also features optional visual position tools to display target and stop loss lines on the chart.
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
Buy Signals
bool
true
takeLongs
Buy Movement Bars
int
100
long_minBarsSignal
Movement
string
Percent
long_movementType
long_movementAmount
float
10.00
long_movementAmount
Sell Signals
bool
true
takeShorts
Sell Movement Bars
int
100
short_minBarsSignal
Movement
string
Percent
short_movementType
short_movementAmount
float
-10.00
short_movementAmount
Inverse Signals
bool
true
inverse_settings
Next Trade Cannot Be Same Side
bool
false
long_to_short_lock
use_sess
bool
false
use_sess
Trading Session
session
0900-1600
trading_session
Show all 22 settings
Setting
Type
Default
Variable
Target⠀⠀ ⠀⠀⠀⠀⠀
bool
false
use_tp
tp_amount
float
1.0
tp_amount
tp_type
string
Percent
tp_type
Stop Loss⠀ ⠀⠀⠀⠀
bool
true
use_sl
sl_amount
float
1.00
sl_amount
sl_type
string
Percent
sl_type
Position Tool
string
None
line_showing
Profit
color
color.new(color.green,80)
css_targetline
Loss
color
color.new(color.red,80)
css_stopline
Text
color
color.white
css_toolcolor
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 enters long or short on the price chart when price is on the correct side of a 200-period EMA, MACD agrees, RSI is not at the opposing extreme, ADX exceeds a threshold, volume beats a 20-bar average, and close breaks the recent high or low. A tim
This strategy enters long when price closes above the prior Donchian high and short when it closes below the prior Donchian low, only while flat and inside a Taipei-hour window. It exits on a MACD histogram reversal or through an ATR stop and a percentage take
This strategy tracks an opening session time range to establish directional bias and triggers pullback trades using Stochastic RSI. Once price breaks out of the initial range, it establishes a directional bias and enters when the Stochastic RSI crosses over in
This strategy builds a timed opening range and tracks session high and low on the price chart. It flags bullish and bearish breakouts of that range and uses Fibonacci levels for an entry zone, a default stop, and an optional take-profit extension. Take profit
This strategy trades opening gap continuation on the price chart. It measures the gap between the daily open and the prior daily close, then enters long after a qualifying gap up or short after a qualifying gap down when price stays beyond the open and a trend
A strategy that combines several filters on one chart. Components include an ignition bar marker based on a candle body retracement percentage, fractal detection, three configurable moving averages, an RSI with overbought and oversold levels, a trading range l