- Product type
- Trading strategy
- Platforms
- TV
- Market / symbol
- Gold, FX majors, Indices, Crypto
- Experience level
- Intermediate
- Delivery
- File download from your dashboard
- Last update
- November 30, 2026
- Broker
- Any broker
- Product type
- Trading strategy
- Platforms
- TV
- Market / symbol
- Gold, FX majors, Indices, Crypto
- Experience level
- Intermediate
- Delivery
- File download from your dashboard
- Last update
- November 30, 2026
- Broker
- Any broker
Overview
This script is a template, not a system that promises profit. Its purpose is to let you see a common idea, entering on a two-EMA cross in the direction of the bigger trend, with fully defined rules in the Strategy Tester, then change it and measure the effect.
Everything is readable in the code: entries on the fast/slow EMA cross, a trend EMA filter, an ATR-multiple stop, an R-multiple target and a size based on a percent of equity at risk. A session and weekday filter lets you test, for example, London and New York hours only.
We publish no backtest results for it. Results differ for every symbol and timeframe, and a good backtest does not guarantee the future. Before reading any result, set commission and slippage in Properties to match your broker. Trading carries real risk.
- Fast/slow EMA cross entries with an optional trend EMA filter
- ATR stop and R-multiple target, with optional exit on the opposite cross
- Size from percent of equity at risk, with a cap on position value
- Session hours and weekday filter, with optional close outside the session
- EMAs, stop and target drawn on the chart
Made by
This tool is written by the TradeKit team. The source code is open and included in the download. It is free to use.
Strategy logic
Entries
- Long: the fast EMA crosses above the slow EMA, the close is above the trend EMA (if the filter is on), the bar is inside the session and an allowed day, and no position is open.
- Short is the mirror. Signals are made on the bar close and orders fill at the next bar’s open.
Stop and target
- Stop distance = ATR × multiplier, measured from the signal bar’s close.
- Target = that distance × the R multiple. At 0 there is no fixed target.
- With exit on opposite cross on, the trade also closes when the EMAs cross the other way.
Size
- Size = (equity × risk %) ÷ (stop distance ×
syminfo.pointvalue). - Size is capped so position value never exceeds “max exposure × equity”, and rounded down to the quantity step if you set one.
- If the strategy’s account currency differs from the symbol’s, TradingView’s currency conversion affects the result.
Specifications
Requirements
- TradingView, the free plan is enough; results appear in the Strategy Tester tab
- Set commission and slippage yourself in Properties; the defaults are zero
- For forex, set Quantity step to match TradingView’s size units
- For study and backtesting, not for automated live trading
- Platforms
- TV
- Delivery
- Use case
- Swing، Trend following
- Market
- Gold، FX majors، Indices، Crypto
- Experience level
- Intermediate
Compatible brokers
Which brokers this product works with, and which it works best with.
No broker restriction: it works with any broker that offers the product's platform.
The broker choice is yours; TradeKit is not a broker. Check account terms before depositing. All brokers
Input parameters
| Parameter | Default | Description |
|---|---|---|
Fast EMAFast EMA length |
20 |
Fast EMA length |
Slow EMASlow EMA length; entries come from the fast EMA crossing it |
50 |
Slow EMA length; entries come from the fast EMA crossing it |
Use trend filter EMALongs only above the trend EMA, shorts only below it |
true |
Longs only above the trend EMA, shorts only below it |
Trend filter EMATrend filter EMA length |
200 |
Trend filter EMA length |
DirectionTrade direction: both, long only or short only |
Long and short |
Trade direction: both, long only or short only |
Risk per trade (% of equity)Percent of equity risked per trade |
1.0 |
Percent of equity risked per trade |
Stop distance (x ATR)Stop distance from entry, in ATR multiples |
2.0 |
Stop distance from entry, in ATR multiples |
Target (R multiple)Target as a multiple of the stop distance (0 = no target) |
2.0 |
Target as a multiple of the stop distance (0 = no target) |
Exit on opposite crossExit when the EMAs cross the other way |
true |
Exit when the EMAs cross the other way |
Max exposure (x equity)Caps position value relative to equity, so a tight stop cannot create a huge position |
1.0 |
Caps position value relative to equity, so a tight stop cannot create a huge position |
Quantity stepRound the order size down to this step (0 = no rounding) |
0.0 |
Round the order size down to this step (0 = no rounding) |
Trade only inside sessionEnter only inside the chosen session hours |
false |
Enter only inside the chosen session hours |
Install guide
- Unzip the download. It contains
EMATrendStrategy.pineand a short readme. - Open
EMATrendStrategy.pinein a text editor such as Notepad and copy all of it. - In TradingView open a chart and click the Pine Editor tab at the bottom of the screen.
- Create a new blank strategy, select all of the default code and paste over it.
- Click Add to chart.
- Click Save to keep it in your scripts, so you can add it later from the Indicators menu.
Works on the free TradingView plan; your plan’s limit on indicators per chart still applies.
Changelog
-
v1.0.0 TV New November 30, 2026
- Published on TradeKit
Buyer reviews
No reviews yet.
Only verified buyers can review. Reviews are moderated before publishing.
Only verified buyers can review. Reviews are moderated before publishing.
Sign in to write a reviewFAQ
Is this strategy profitable?
Why does the backtest differ from live trading?
Why are no trades opened?
What is Max exposure for?
Can I connect it to a bot?
Related products
More Strategies and tools from the same family
Risk warning