add_swing_high_low: Swing high swing low

Description Usage Arguments Value References Examples

View source: R/swing_points.R

Description

This indicator adds the swing high and swing low points on a chartSeries.

The indicator checks historical candles to detect whether there was a swing point. This will work by inputting a number to select the range of historical candles to check to see if there is a swing point in the selected trading period. If a candle has the lowest low or highest high in the selected range, then we know it was a swing point.

Usage

1

Arguments

x

an xts object that contains OHLC data

n

Number of periods. Default is 7.

Value

Adds swing points to a chartSeries

References

swing high: https://www.investopedia.com/terms/s/swinghigh.asp swing low: https://www.investopedia.com/terms/s/swinglow.asp

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
library(quantmod)
ADM <- getSymbols("ADM", 
                  from = "2018-01-01",
                  to = "2018-07-01",
                  auto.assign = FALSE)
chartSeries(ADM)
add_swing_high_low(ADM, n = 1)

## End(Not run)

pverspeelt/Quantfunctions documentation built on Oct. 10, 2021, 1:01 p.m.