Description Usage Arguments Value Examples
View source: R/maCrossoverSignal.R
This function computes a moving average cross-over signal from a price series. The series should be in xts format. The function will return +1 if the shorter moving average of the price series is above the longer moving average and -1 if below. It will return a 0 if the two moving averages are the same.
1 | maCrossoverSignal(x, s = 50, l = 100)
|
x |
an xts time series of prices. |
s |
the number of periods for the shorter moving average (assumed to be in the same periodicity as x. Meaning, if you pass daily data and s = 20, then the shorter moving average will be calculated over 20 days. If you pass monthly data, and s = 20, then the shorter moving average will be calculated over 20 months. |
l |
the number of period for the longer moving average. |
a list containing a time series filled with -1, 0, or +1 signals based on the cross-over patterns of the moving averages, the short moving average series, and the long moving average series.
1 2 3 4 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.