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
125 lines of Pine Script v5 from Tradingview/ema-crossover-scott-strategy.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.
EMA Crossover Scott Strategy determines market direction by tracking recent highest highs and lowest lows over a customizable swing period. Buy signals occur when price crosses above the trailing swing line, while sell signals trigger on a cross under. It includes trade management options with fixed profit targets, hard stop losses, trailing stops, and an optional session time filter.
Dynamic swing trailing line breakout signals
Multi-moving-average overlay with three SMAs and one EMA
Customizable profit target, stop loss, and trailing stop
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
bool
false
useTradingHours
Trading Time
session
0930-1555
trading_time
Long Trades
bool
true
long_trades
Short Trades
bool
true
short_trades
Profit Target
bool
true
use_profit_target
float
5.00
pt_amount
Stop
bool
true
use_stop
float
4.00
stop_amount
Trailing Stop
bool
true
use_trailing_stop
float
2.50
trailing_stop_amount
SMA1
int
9
smaInput1
SMA2
int
50
smaInput2
Show all 17 settings
Setting
Type
Default
Variable
SMA3
int
180
smaInput3
EMA1
int
20
emaInput1
BUY/SELL Swing
int
3
no
BUY/SELL Bar Color
bool
false
Barcolor
BUY/SELL Background Color
bool
false
Bgcolor
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 trades Nikkei 225 futures during a configurable overnight session, defaulting to 19:00–03:00 ET. It builds long and short trend conditions from an 8/21 EMA pair and a 200-period SMA, with RSI, momentum, an ATR-scaled breakout range, and a volume
PineFlow v6 — ORB Risk Strategy executes opening range breakout trades filtered by trend and momentum indicators. It defines an initial opening range and trades breakouts during the active trading session when aligned with fast and slow EMAs, ADX momentum, and
This strategy identifies breakouts from session highs and lows on the price chart. It tracks the current session high and low for the configured time window in the specified timezone. Price crosses above the prior session high with an upward EMA trend confirm
This strategy plots running pivot highs as red R circles and pivot lows as blue S circles directly on the price chart. It computes an EMA 3 and a Cto trend line from close prices, then generates long signals on upward EMA-Cto crossovers combined with price pos
This strategy executes trades based on crossovers between a 12-period and a 26-period exponential moving average (EMA). Long positions can be filtered by pivot resistance breakouts and RSI boundary ranges. For trade management, it provides two configurable par
This strategy trades long breakouts of a fast and a slow moving average on the price chart. It opens a long position when price crosses above either average, using a percentage of equity as size. It reduces the position by a set share when the high reaches the