Select Page

EMA Slope Trend Follower Strategy for TradingView

APIBridge, TradingView

The strategy based on a medium-term EMA identifies a trend depending on the medium-term EMA, and then creates a position in the direction of the trend based on a fast and slow EMA.

Strategy Logic

Long Entry: When EMA fast > EMA slow, send LE

Long Exit: Either when SL or Target is hit. If SL/TGT is not hit, and EMA fast < EMA slow, send LX and SE

Short Entry: When EMA fast < EMA slow, send SE

Short Exit: Either when SL or Target is hit. If SL/TGT is not hit, When EMA fast > EMA slow, send SX and LE

EMA Slope Trend Follower Strategy Parameters for TradingView Charts

Source MA Type: Choose whether to use EMA or SMA

Source MA Length: Medium term time frame MA to identify slope

Fast Slope MA Length: Length of fast MA to calculate over the slope

Slow Slope MA Length: Length of slow MA to calculate over the slope

Trend Filter: When the price is above EMA200, the strategy opens only long positions. If price < EMA200, only shorts allowed. If the slope gives a long signal and price is below EMA200, for example, the eventual short position is closed, but the long entry is postponed to the moment when both conditions (slope uptrending and price > EMA200) are met.

Volatility Filter: When the standard deviation of the last 20 candles is below its 50 samples moving average, no positions are opened, as market is going sideways. The purpose of this filter is to prevent false positives (positions which open and close in a matter of candles due to false signals in sideways market).

Quantity: This is used to specify the trade quantity 

Custom Stop Loss in Points: Movement in chart price against the momentum which will trigger exit

Custom Target in Points: Movement in chart price against the momentum which will trigger exit

TradingView Settings

Step 1: Download the PineScript Algo

Step 2: Open desired chart in TradingView with normal candlestick. Select desired timeframe of the chart.

Go to the Pine Editor section, remove the default code, paste the downloaded code, save the file and add to chart.

Step 3: Once Strategy is applied to the chart, click on settings to optimize parameters for your own trading

Step 4: Setting Up Alert

Before setting up an alert make sure that You have selected the desired script, timeframe, strategy settings, API bridge is configured and running. Click in settings add alert and paste {{strategy.order.comment}} in the message box.

Important: do not change any settings during live trading.

NOTE: The pine script works both with webhook alerts (TV Pro plan) and normal popup alerts (TV free plan).