Skip to content

Refactor addTA functions in addTA.R to follow skeleton_structure #111

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

erichung0404
Copy link

addTA functions in addTA.R file all have their own "chartTA" function to add technical indicators to the current chart. For the reason described in #108, those original chart* functions will not be called anymore since new chartTA functions are given based on skeleton_TA structure (see #96). In addTA.R file, there are:
addADX, addATR, addBBands, addCCI, addDEMA, addDPO, addEnvelope, addEVWMA, addExpiry,
addMACD, addMomentum, addPoints, addROI, addRSI, addSAR, addShading, addSMA, addTRIX,
addWMA, addEMA, addLines and addZLEMA functions.

Refactor addADX to use skeleton_TA structure. New chartADX is given
to create Directional Movement Index indicator based on skeleton_TA
structure.
Refactor addATR to use skeleton_TA structure. New chartATR is given to
create Average True Range indicator based on skeleton_TA structure.
Refactor addBBands to use skeleton_TA structure. New chartBBands
function is given to create Bollinger Bands indicator based on
skeleton_TA structure.
Refactor addCCI to use skeleton_TA structure. New chartCCI function is
given to create Commodity Channel Index indicator based on skeleton_TA
structure.
Refactor addDEMA to use skeleton_TA structure. New chart EMV function is
given to create various Moving Averages of a series based on skeleton_TA
structure.
Refactor addDPO to use skeleton_TA structure. New chartDPO function is
given inside addDPO to create Detrended Price Oscillator indicator based
on skeleton_TA structure.
Refactor addEnvelope to use skeleton_TA structure. New chartEnvelope
function is given to create technical indicators to the chart based
on skeleton_TA structure.
Refactor addEVWMA to use skeleton_TA structure. New chartEVWMA is
given to create various weighted moving averages of a series based on
skeleton_TA structure.
Refactor addExpiry to use skeleton_TA structure. New chartExpiry function
is given to add options or futures expiration vertical bars to price
chart.
Refactor addMACD to use skeleton_TA structure. New chartMACD function
is given to create MACD indicator in a new frame based on skeleton_TA
structure.
Refactor addMomentum to use skeleton_TA structure. New chartMomentum
function is given to create Momentum indicator based on skeleton_TA.

Add 'with.col' argument to accept any arguments for x, not just Cl, which
is required in the original code.
Refactor addPoints to use skeleton_TA structure. New chartPoints function
is given to add points to the time series chart based on skeleton_TA
structure.
Refactor addROC to use skeleton_TA structure. New chartROC is given
to add rate of price series to the price chart based on skeleton_TA
structure.
New chartRSI is given to create Relative Strength Index indicator based
on skeleton_TA structure.
New chartSAR function is given to create Stop-And-Reverse indicator based
on skeleton_TA structure.
New chartShading function is given to add shading area to the price
series.
New chartSMA function is given to create moving average indicator based
on skeleton_TA structure.
New chartTRIX function is given to create the TRIX indicator based on
skeleton_TA structure.
New addWMA function is given to create Weighted Moving Average indicator
based on skeleton_TA structure.
New chartEMA function is given to add Exponential Moving Average indicator
to the price chart based on skeleton_TA structure.
New chartLines function is given to add lines to the ith panel when
overlay=TRUE or chart on a new frame based on skeleton_TA structure.
New chartZLEMA function is given to add various moving averages indicator
to the ith panel when overlay=TRUE or create a new frame based on
skeleton_TA structure.
Function y_grid_lines is not exported and is in plot_object$Env. chart*
functions called in add* are passed to "lenv" environment so y_grid_lines
cannot be found.

y_grid_lines function is defined in chart* by
y_grid_lines <- plot_object$Env$y_grid_lines.

For add*MA functions, x.tmp should not be passed by x.tmp[xsubset] because
when zoomChart is called, series used to calculate moving averages will
change with the subset period if we pass x.tmp[xsubset] to x.tmp. Moving
avrage indicators are passed to ma by ma <- *MA(x.tmp, ...)[xsubset] so
x.tmp should always be the initial series and should not change with the
subset period.
@erichung0404 erichung0404 deleted the refactor_add_ta_chart branch August 12, 2016 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant