Developing a MIN/MAX indicator.
Mostrar comentarios más antiguos
Okay, so I'm attempting to make a min/max indicator.It shows the min & max value over certain periods.
I'm using data from http://www.mathworks.com/matlabcentral/fileexchange/29489-algorithmic-trading-with-matlab-2010s as practice.

i.e. (Obviously this example is offset slightly. Ignore that.)
So far this is what I've come up with(focusing just on the max):
importfile('BundDaily.xls')
period = 14;
maxp = floor(length(High) / period);
startscale = 1;
endscale = 14;
fp = max(High(startscale:endscale,:));
for i=startscale:endscale:maxp
B(i) = fp;
startscale = (startscale + period);
endscale = (endscale + period);
plot(B, 'r') , hold on
end
This is the result:

Methinks the problem is either:
- How I'm using the max function.
- Problem with the for loop.
- Perhaps I need to somehow use a movavg?
- All of the above!? haha
I'm new to Matlab(clearly) so any help would be much appreciated. Thank-you in advance!
3 comentarios
Oleg Komarov
el 9 de Sept. de 2012
What is High?
Seth
el 9 de Sept. de 2012
Oleg Komarov
el 9 de Sept. de 2012
I added the missing line of code: importfile('BundDaily.xls').
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Financial Toolbox en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!