TrendFollowingStrat

The Trend Following strategy is a moving average-based trading system. It adds simulated order of all kinds based on price action in relation to its moving average.

The following conditions are used for order simulation (default percentage values may be optimized via input parameters):

  • Long Entry. Added when the close price rises 3% above its moving average.
  • Long Exit. Added when the close price falls 4% below the moving average.
  • Short Entry. Added when the close price falls 3% below the moving average.
  • Short Exit. Added when the close price rises 4% above its movving average.

Note that stop-losses and profit targets can be used for performance enhancement. In this regard, consider adding StopLossLX, StopLossSX, ProfitTargetLX, and ProfitTargetSX strategies.

Input Parameters

length The period to be used in the calculation of the moving average.
average type The type of moving average to be used in calculations: simple, exponential, weighted, Wilder's, or Hull.
entry percent level The percentage value used for entry orders.
exit percent level The percentage used for exit orders.

Further Reading

1. "Does Fully Automated Trading Software Work?" by James Breen. Technical Analysis of Stocks & Commodities, November 2016.