For loop to multiple columns

2 visualizaciones (últimos 30 días)
david crowley
david crowley el 27 de Abr. de 2021
I have the following block of code:
%RSI Calculation
n = [14:2:18];
for i = 1:n
gainC = diff(ABC).*((diff(ABC))> 0);
lossC = -(diff(ABC)).*((diff(ABC)) < 0);
avg_gainC = movmean(gainC,[i-1 0],'omitnan');
avg_lossC = movmean(lossC,[i-1 0],'omitnan');
RS = (avg_gainC ./ avg_lossC);
ABC_RSI = 100 - (100 ./ (1+RS));
end
I need to know how I can create a table 'ABC_RSI' with the columns 14w_RSI, 16w_RSI, 18w_RSI and populated using the formula. Can someone please help?

Respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by