MovAvgStrat

Description

The Moving Average Strategy adds Buy and Sell orders upon crossovers of price with its moving average. By default, the Simple Moving Average (SMA) is used in calculations, nevertheless, you are free to use other types of moving averages: exponential, weighted, Wilder's, or Hull. Two modes of trading are used in this strategy: trend following and reversal. In the trend following mode, the strategy adds a simulated Buy order when the price crosses above its average, and a simulated Sell order when it crosses below. For the reversal mode, conditions are vice versa: a Buy order is added when the price crosses below the average and a Sell order is added when it crosses above.

Input Parameters

Parameter Description
price Defines price used in calculation of the average.
length The number of bars used in calculation of the average.
average type The type of moving average to be used in calculations: simple, exponential, weighted, Wilder's, or Hull.
mode Defines the mode of adding orders: trend following or reversal.

Plots

Avg

 The average plot.

Backtesting is the evaluation of a particular trading strategy using historical data. Results presented are hypothetical, and there is no guarantee that the same strategy implemented today would produce similar results.

Technical analysis is not recommended as a sole means of investment research.

For educational purposes only. Not a recommendation of a specific security or investment strategy.

You may also like
PairTradingLong
The Pair Trading Long strategy is part of Domenico D'Errico's pair trading system. By design, ...
MomentumLE
The MomentumLE strategy generates a Long Entry signal when Momentum is rising. This strategy ...