Trend following strategies?


Posted by: Invos Research
Published on: January 16, 2023
Trend following strategies?

Trend following strategies are a type of trading strategy that aims to identify the direction of the trend in the market and enter trades in the same direction. The idea behind trend following strategies is that markets tend to trend in one direction for extended periods of time and by identifying and following these trends, traders can potentially profit. These strategies use indicators, such as moving averages, MACD, ADX, or trendlines, to identify the direction of the trend. Once a trend is identified, the strategy will enter trades in the treding direction and hold the position until the trend changes or the trade reaches its profit objective. These strategies are commonly used in forex, stocks, and other markets that have a tendency to trend.

An example of a trend following strategy using moving averages in Pine Script:

// Define strategy
strategy("Moving Average Trend Following", overlay=true)
// Define variables
var fastMA = input(8, minval=1)
var slowMA = input(21, minval=1)
var fastMAValue = sma(close, fastMA)
var slowMAValue = sma(close, slowMA)
// Buy rule
if crossover(fastMAValue, slowMAValue)
    strategy.entry("Buy", strategy.long)
// Sell rule
if crossunder(fastMAValue, slowMAValue)
    strategy.entry("Sell", strategy.short)
// Plot the indicators on the chart
plot(fastMAValue, color=green, linewidth=2)
plot(slowMAValue, color=red, linewidth=2)
 
This strategy uses two moving averages, a fast moving average and a slow moving average, to identify the direction of the trend. The strategy starts by defining the strategy with the strategy() function and setting the overlay parameter to true, which means that the strategy will be plotted on top of the price chart.

Content by: Invostock.com