Code covered by the BSD License
-
Technical Analysis Tool
GUI for viewing simple technical analysis indicators for a time series.
-
axislocations_set(obj)
tatool helper function to set axes locations to their expected locations
-
axislocations_store(obj)
tatool helper function to store current axes locations and so that
-
bollingerul(data,period,nstd)
Function to calculate the upper and lower bollinger bands for a vector
-
cci(data,period)
Function to calculate the Commodity Channel Index of a data set
-
dema(data,period)
Function to calculate the double exponential moving average of a data set
-
dpo(data,period)
Function to calculate the detrended price oscillator of a data set.
-
ema(data,period)
Function to calculate the exponential moving average of a data set
-
etb(data,period,percent)
Function to calculate the envelopes(trading bands) for a data series
-
getclassfromworkspace(classna...
tatool helper function for getting the name of all variables of a
-
getvarfromworkspace(WS,varnam...
TATOOL helper function to get a variable with the given name from the
-
lri(data,period)
Function to calculate the linear regression indicator of a data set.
-
macd(data,p1,p2,p3)
-
momentum(data,period)
Function to calculate the Momentum of a data set
-
roc(data,period,format)
Function to calculate the Rate-of-Change of a data set
-
rsi(data,period)
Function to calculate the Relative Strength Index of a data set
-
sma(data,period)
Function to calculate the simple moving average of a data set
-
tatool(flag)
This is the entry point function to create a tatool, technical analysis
-
wildersmoothing(data,period)
Function to perform Wilder Smoothing on a data set
-
wma(data,period)
Function to calculate the weighted moving average of a data set
-
ALLFUNCTIONS.m
-
ReadMe.m
-
View all files
from
Technical Analysis Tool
by Phil Goddard
GUI for viewing various simple technical analysis indicators of a time series
|
| etb(data,period,percent)
|
function out = etb(data,period,percent)
% Function to calculate the envelopes(trading bands) for a data series
% where a simple moving average is taken over the specified period and
% then moved up and down by the given percentage - for 5% enter 5 not 0.05
%
% 'data' is the vector to operate on. The first element is assumed to be
% the oldest data.
% 'period' is the number of periods over which to calculate the average.
% (A simple moving average, see SMA, is used.)
% 'percent' is the percentage by which to move the SMA up and down.
%
% Example:
% out = etb(data,period,percent)
%
% Error check
if nargin ~= 3
error([mfilename,' requires 3 inputs.']);
end
[m,n]=size(data);
if ~(m==1 || n==1)
error(['The data input to ',mfilename,' must be a vector.']);
end
if (numel(period) ~= 1) || (mod(period,1)~=0)
error('The period must be a scalar integer.');
end
if (numel(percent) ~= 1) || (percent <=0)
error('The shift percent must be a positive scalar.');
end
if length(data) < period
error('The length of the data must be at least the specified ''period''.');
end
if (n~=1)
data = data(:); % ensure we have a column
end
% calculate the SMA
smavg = sma(data,period);
% then shift it
out = [nan*ones(period-1,2);smavg(period:end)*(1+percent/100) smavg(period:end)*(1-percent/100)];
|
|
Contact us