Azzera filtri
Azzera filtri

how to backtest trading strategy???

1 visualizzazione (ultimi 30 giorni)
Josh Perry
Josh Perry il 18 Lug 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

Risposte (0)

Categorie

Scopri di più su Financial Toolbox in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by