Borrar filtros
Borrar filtros

how to backtest trading strategy???

1 visualización (últimos 30 días)
Josh Perry
Josh Perry el 18 de Jul. de 2015
Suppose I have a very simple m file such as:
if true
% code
c=yahoo; d = fetch(c,'xom','Close',now-300,now-1,'d');
fetch(c,'xom','Close',now,now-1,'d');
sd=std(d(:,2));
ma = tsmovavg(d(:,2),'s',90,1);
price = w(1,2);
price
if price<ma-2*sd;
outcome='long';
elseif price>ma+2*sd;
outcome='short';
else outcome='exit';
outcome
close(c)
end
which is obviously messed up. How to I backtest such a trading strategy? Can I do something like this using only matlab or do I have to use MT4 or bloomberg or ...? I need help with this VERY BADLY. Thanks

Respuestas (0)

Categorías

Más información sobre Financial Toolbox 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