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.