필터 지우기
필터 지우기

Setting Arguments using VarFun & RSIndex

조회 수: 2 (최근 30일)
david crowley
david crowley 2021년 4월 3일
답변: Kartik Saxena 2024년 2월 23일
Due to the layout of my timetable data, I am required to use the following code when trying to calculate the rsindex():
%Set RSI lookback period
n = 5;
%calculate indicator
func = @rsindex;
RSI = varfun(func,Close);
RSI.Properties.VariableNames = codes;
Is there a way (what is the syntax) to set the WindowSize to 'n' when using varfun() to call rsindex()?

답변 (1개)

Kartik Saxena
Kartik Saxena 2024년 2월 23일
Hi,
Refer to the following code snippet to get an idea of how to do s:
% Set RSI lookback period
n = 5;
% Define the rsindex function
rsindex = @(x) rsi(x, n); % replace 'rsi' with the actual implementation of the rsindex function
% Calculate indicator using varfun with WindowSize set to n
RSI = varfun(@(x) rsindex(x), Close);
RSI.Properties.VariableNames = codes;
Change the functions and arguments as per your requirements.

카테고리

Help CenterFile Exchange에서 Argument Definitions에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by