Quantitative finance collector
C++ Matlab VBA/Excel Java Mathematica R/Splus Net Code Site Other
Oct 27

Quantitative trading strategies

Posted by abiao at 21:54 | Code » Matlab | Comments(1) | Reads(31975)
Spent several days reading a book named Quantitative Trading Strategies: Harnessing the Power of Quantitative Techniques to Create a Winning Trading Program, Quantitative Trading Strategies: Harnessing the Power of Quantitative Techniques to Create a Winning Trading Program, compared with the book Quantitative Trading: How to Build Your Own Algorithmic Trading Business I read & shared at my earlier post Matlab trading code, this one is in more detail and more practical. For me, Quantitative trading is a good introductory book showing starters what algo trading is and how to begin and what to prepare in order to be an independent quant trader, while Quantitative trading strategies explains what a good trading strategy is, how to test a trategy a trader has, what's more, the author is kind enough to disclosure dozens of strategies he created. Whether those trading strategies still work or not is another issue, but at least readers are able to have a rough picture in mind the pros and cons of each strategy, the possible way to modify them for our own use after reading it.

Anyway, it is your turn to compare them.  I write M files of several selected quantitative trading strategies from the book I have played, be aware although I wrote carefully, i dont gurantee the correct of them, and i didn't optimize the code, either, sorry.

Moving Average: long when x day moving average crosses above y day moving average, short when x day moving average crosses below y day moving average
[lead,lag]= movavg(price,x,y,'e');
lead = [zeros(x-1,1); lead]; %to avoid dimension mismatch
lag = [zeros(y-1,1); lag];

Volatility Breakouts:
m = size(price,1);
for i = 2:m
    %put here the way to calculate variance C
    UpperTrigger = price(i-1)+multiplier*sqrt(C);
    LowerTrigger = price(i-1)-multiplier*sqrt(C);
    if price(i)>=UpperTrigger pos(i) = 1;
    elseif price(i)<=LowerTrigger pos(i) = -1;

stochastic indicator:
stosc = stochosc(highp, lowp, closep, kperiod, dperiod); %embedded Matlab function
m = size(highp,1);
inx1 = find(stosc(:,1)>=30);
inx2 = find(stosc(:,1)>=stosc(:,2));
pos(intersect(inx1,inx2)) = 1;
inx1 = find(stosc(:,1)<=80);
inx2 = find(stosc(:,1)<=stosc(:,2));
pos(intersect(inx1,inx2)) = -1;

Divergence Index:
%divergence index strategy, m is long momentum period, n is for short
longmom = tsmom(price,m);
shortmom = tsmom(price,n);
mm = size(price,1);
DI = longmom.*shortmom./var(diff(price));
inx1 = find(DI<-8);
inx2 = find(longmom<0);
inx3 = find(longmom>0);

Moving Average Confluence Method:
% p - *price* data
% N - number of points to generate signal
macs = zeros(size(p,1),20);
for i=1:20
    [lead,lag]= movavg(p,i,j,'e');
    lead = [nan(i-1,1); lead]; %to avoid dimension mismatch
    lag = [nan(j-1,1); lag];
    macs(lead>lag,i) = 5;
macssum = sum(macs,2);
macssum(1:80) = 50; %first 80 observations with zero position

There are other strategies left to you to backtest the effectiveness of technical analysis, for example, Kestner’s Moving Average System, Second Order Breakout, MACD Histogram Retracement, Normalized Envelope Indicator, etc. Have fun.

Tags: ,
Really easy to browse through and also it is stuffed with loads of info. It is all totally on point. Will you want to evaluate my blog site?
archery king cheats
Pages: 1/1 First page 1 Final page
Add a comment
Enable HTML
Enable UBB
Enable Emots
Nickname   Password   Optional
Site URI   Email   [Register]