Oct
27

## Quantitative trading strategies

Spent several days reading a book named

Anyway, it is your turn to compare them. I write M files of several selected

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.

Hot posts:

15 Incredibly Stupid Ways People Made Their Millions

Online stock practice

Ino.com: Don't Join Marketclub until You Read This MarketClub Reviews

World Changing Mathematical Discoveries

Value at Risk xls

Random posts:

Elliott Wave Analysis

Pricing American Options

Statistical Arbitrage in the U.S. Equities Market

China is the New Dot.Com Hong Kong Security Chief Warns

Fast Greeks by Simulation in Forward Libor Models

**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 averagepos=zeros(size(price,1),1);

[lead,lag]= movavg(price,x,y,'e');

lead = [zeros(x-1,1); lead]; %to avoid dimension mismatch

lag = [zeros(y-1,1); lag];

pos(lead>lag)=1;

pos(lag>lead)=-1;

[lead,lag]= movavg(price,x,y,'e');

lead = [zeros(x-1,1); lead]; %to avoid dimension mismatch

lag = [zeros(y-1,1); lag];

pos(lead>lag)=1;

pos(lag>lead)=-1;

**Volatility Breakouts**:m = size(price,1);

pos=zeros(m,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;

end

end

pos=zeros(m,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;

end

end

**stochastic indicator**:stosc = stochosc(highp, lowp, closep, kperiod, dperiod); %embedded Matlab function

m = size(highp,1);

pos=zeros(m,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;

m = size(highp,1);

pos=zeros(m,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);

pos=zeros(mm,1);

DI = longmom.*shortmom./var(diff(price));

inx1 = find(DI<-8);

inx2 = find(longmom<0);

inx3 = find(longmom>0);

pos(intersect(inx1,inx2))=-1;

pos(intersect(inx1,inx3))=1;

longmom = tsmom(price,m);

shortmom = tsmom(price,n);

mm = size(price,1);

pos=zeros(mm,1);

DI = longmom.*shortmom./var(diff(price));

inx1 = find(DI<-8);

inx2 = find(longmom<0);

inx3 = find(longmom>0);

pos(intersect(inx1,inx2))=-1;

pos(intersect(inx1,inx3))=1;

**Moving Average Confluence Method**:% p - *price* data

% N - number of points to generate signal

pos=zeros(size(p,1),1);

macs = zeros(size(p,1),20);

for i=1:20

j=i*4;

[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;

end

macssum = sum(macs,2);

macssum(1:80) = 50; %first 80 observations with zero position

pos(macssum>=N)=1;

pos(macssum<=(100-N))=-1;

% N - number of points to generate signal

pos=zeros(size(p,1),1);

macs = zeros(size(p,1),20);

for i=1:20

j=i*4;

[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;

end

macssum = sum(macs,2);

macssum(1:80) = 50; %first 80 observations with zero position

pos(macssum>=N)=1;

pos(macssum<=(100-N))=-1;

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.

**People viewing this post also viewed:**

Hot posts:

Random posts: