A long-only strategy based on a trailing stop approach, using a slow SMA, medium and fast EMAs, a pin bar test, and optional stochastic and money flow index filters that can read other timeframes.
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
Exits use a trailing stop plus a hard stop expressed in pips. Inputs include stop distances, indicator periods, filter levels and Pineconnector alert fields for MT4 or MT5. It runs on every tick, so signals and fills can change on the live bar.
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
Stop Loss Trail Points (Pips)
int
150
slPoints
Stop Loss Trail Offset (Pips)
int
1
slOffset
Hard Stop Loss (Pips)
int
100
slHardPoints
Slow SMA (Period)
int
120
sma_slow
Medm EMA (Period)
int
72
ema_medm
Fast EMA (Period)
int
8
ema_fast
Draw smth on chart?
bool
false
plot_everything
Pinbar confirmation value
float
0.3
pinbarConfirmationValue
Use Stochastic as Filter (OB/OS)?
bool
false
useStochasticAsFilter
Length for Main Stochastic
int
14
len
SmoothK for Main Stochastic
int
3
smoothK
SmoothD for Main Stochastic
int
3
smoothD
Show all 28 settings
Setting
Type
Default
Variable
Upper Line Value? (shorts - above line)
int
30
upLine
Lower Line Value? (longs - below line)
int
50
lowLine
Use Current Chart Resolution?
bool
true
useCurrentRes
Use Different Timeframe? Uncheck Box Above
timeframe
15
resCustom
Use Different Timeframe MFI? Uncheck Box Above
timeframe
35
resCustomMFI
Use MFI as 2nd Filter? (current timeframe)
bool
true
useMFI
Length
int
8
mfiLength
OverSold (longs - below line)
int
40
mfiOversold
OverBought (shorts - above line)
int
80
mfiOverbought
Pineconnector License ID
string
12345
pineconnectorLicenseID
Symbol for close alert (MT4/MT5)
string
EURUSD.i
pineconnectorInputSymbol
Volume (lots size)
float
0.4
pineconnectorVolume
Percent K Length
int
30
smi_k
Percent D Length
int
11
smi_d
Overbought
int
20
smi_ob
Oversold
int
-40
smi_os
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 price action pin bar patterns aligned with moving average trend alignment on the main price chart. It defines uptrends or downtrends using a fan arrangement of three moving averages (6 EMA, 18 EMA, and 50 SMA). Entry conditions require a b
Mean Reversion Strategy is an overlay strategy that identifies pullbacks using a long-term EMA, RSI, and candlestick patterns. It generates long signals when a bullish engulfing candle forms below the EMA while RSI is oversold, and short signals when a bearish
ESU2023-10M - V1 is an intraday trend-reversal strategy designed for index futures contracts on the price chart. It calculates a 3-period moving average of candle highs and lows alongside specific three-bar price action patterns to detect short-term swing high
This strategy trades the three-candle strike pattern filtered by trend direction and time sessions. It calculates market regime using linear regression and exponential or smoothed moving averages to distinguish between ranging and trending conditions. Risk man
This strategy tracks consecutive bullish and bearish candlestick closes relative to the preceding bar. It enters a long position when price closes higher for a specified number of consecutive bars, and enters a short position when price closes lower for a desi
This strategy executes trades based on candlestick engulfing patterns aligned with a 200-period exponential moving average trend filter. It enters long positions when a bullish engulfing candle follows three consecutive bearish candles while price trades above