The Basics of Investing and Trading | Explained and analyzed.

Technical Indicators and Algorithmic Trading

1.1       Study 3 : Effectiveness of Technical Indicators in Algorithmic Trading

1.1.1       Objective

Objective: To simulate algorithmic trading using  strategies based on Technical Indicators, on Historic Stock Market Price Data and to compare the profits/losses made using each strategy

1.1.2       Method:

  • The Strategies are listed.
  • The strategies are back-tested using historical price data of a stock that has had a bear run.
  • The profits/losses are compared.
  • The strategy with the highest profit is picked as the best strategy.

1.1.3       Strategy 1

  • Buy at every EMA 26-Price intersection as EMA curve is Crossed by Price Curve from below
  • Sell at every EMA 26-Price intersection as EMA curve is Crossed by Price Curve from above

1.1.3.1  Results –Strategy 1

Initial Capital = 1,000,000 US $

Time Period = 11 months

Stock: Merrill Lynch (MER)

Profit = 122,109$

Portfolio Initialized,Year High set to, 0

Amount set to  1e+006

Number set to  0

Falling Signal Detected at Price = 90.44

Rising Signal Detected at Price = 92.18

Bought Shares at91.824  Number = 10890.4

Falling Signal Detected at Price = 92.88

Sold Shares at93.288  ,Number = 0  ,Amount = 1.01594e+006

Rising Signal Detected at Price = 93.13

Bought Shares at92.89  Number = 10937.1

Falling Signal Detected at Price = 92.69

Sold Shares at92.943  ,Number = 0  ,Amount = 1.01652e+006

Rising Signal Detected at Price = 93.23

Bought Shares at92.933  Number = 10938.2

Falling Signal Detected at Price = 91.34

Sold Shares at92.888  ,Number = 0  ,Amount = 1.01603e+006

Rising Signal Detected at Price = 84.22

Bought Shares at83.7385  Number = 12133.4

Falling Signal Detected at Price = 82.78

Sold Shares at83.794  ,Number = 0  ,Amount = 1.0167e+006

Rising Signal Detected at Price = 84.23

Bought Shares at83.0645  Number = 12239.9

Falling Signal Detected at Price = 91.01

Sold Shares at91.01  ,Number = 0  ,Amount = 1.11396e+006

Rising Signal Detected at Price = 85.67

Bought Shares at85.468  Number = 13033.6

Falling Signal Detected at Price = 85.34

Sold Shares at85.5155  ,Number = 0  ,Amount = 1.11458e+006

Rising Signal Detected at Price = 76.03

Bought Shares at75.733  Number = 14717.2

Falling Signal Detected at Price = 75.48

Sold Shares at75.7275  ,Number = 0  ,Amount = 1.11449e+006

Rising Signal Detected at Price = 75.76

Bought Shares at75.732  Number = 14716.3

Falling Signal Detected at Price = 74.49

Sold Shares at75.6965  ,Number = 0  ,Amount = 1.11397e+006

Rising Signal Detected at Price = 75.02

Bought Shares at74.849  Number = 14882.9

Falling Signal Detected at Price = 73.6

Sold Shares at74.736  ,Number = 0  ,Amount = 1.11229e+006

Rising Signal Detected at Price = 74.74

Bought Shares at74.089  Number = 15012.9

Falling Signal Detected at Price = 72.46

Sold Shares at74.071  ,Number = 0  ,Amount = 1.11202e+006

Rising Signal Detected at Price = 75.42

Bought Shares at74.088  Number = 15009.5

Falling Signal Detected at Price = 73.29

Sold Shares at74.278  ,Number = 0  ,Amount = 1.11487e+006

Rising Signal Detected at Price = 73.48

Bought Shares at73.48  Number = 15172.5

Falling Signal Detected at Price = 73.72

Sold Shares at73.847  ,Number = 0  ,Amount = 1.12044e+006

Rising Signal Detected at Price = 73.95

Bought Shres at73.95  Number = 15151.3

Falling Signal Detected at Price = 73.21

Sold Shares at74.079  ,Number = 0  ,Amount = 1.1224e+006

Long only Profit = 122395

The Buy and Hold Profit = -421722

——————

Short Only profit = 0

Latest Price = 53.19

No.of Outstanding shares = 0 And if covered at current priceAddl Profit = 0

Total Short Selling Profit = 0

———————-

Total Profit, Short and long = 122395

Total Commission = 285.74

Nett Profit after Commissions = 122109

1.1.4       Strategy 2

1.1.4.1  Description of Strategy:

  • Buy at every EMA 26-Price intersection as EMA curve is Crossed by Price Curve from below
  • Sell at every EMA 26-Price intersection as EMA curve is Crossed by Price Curve from above
  • Short- Sell at every EMA 26-Price intersection as EMA curve is Crossed by Price Curve from abov
  • Buy to cover at every EMA 26-Price intersection as EMA curve is Crossed by Price Curve from below

1.1.4.2  Results using Strategy 2

Initial Capital = 1,000,000 US $

Time Period = 11 months

Stock: Merrill Lynch (MER)

Profit = 1,032,000 US $

Portfolio Initialized,Year High set to, 0

Amount set to  1e+006

Number set to  0

Rising Signal Detected at Price = 37.28

Bought Shares at37.052  Number = 26989.1

Falling Signal Detected at Price = 37.39

Sold Shares at38.1925  ,Number = 0  ,Amount = 1.03078e+006

Short Sold Shares at38.1925  ,Number = 26183.2 ,Amount = 0

Rising Signal Detected at Price = 33.38

Bought Shares at31.8695  Number = 32343.8

Covered Shares at31.8695 ,Number = 0 ,Short Money  = 1e+006

Profit from this pair of trades = 165556

Falling Signal Detected at Price = 38.19

Sold Shares at38.357  ,Number = 0  ,Amount = 1.24061e+006

Short Sold Shares at38.357  ,Number = 26070.9 ,Amount = 0

Rising Signal Detected at Price = 38.55

Bought Shares at38.4125  Number = 32297.1

Covered Shares at38.4125 ,Number = 0 ,Short Money  = 1e+006

Profit from this pair of trades = -1446.9

Falling Signal Detected at Price = 38.27

Sold Shares at38.413  ,Number = 0  ,Amount = 1.24063e+006

Short Sold Shares at38.413  ,Number = 26032.9 ,Amount = 0

Rising Signal Detected at Price = 39.51

Bought Shares at38.456  Number = 32261

Covered Shares at38.456 ,Number = 0 ,Short Money  = 1e+006

Profit from this pair of trades = -1119.5

Falling Signal Detected at Price = 48.37

Sold Shares at48.513  ,Number = 0  ,Amount = 1.56508e+006

Short Sold Shares at48.513  ,Number = 20613 ,Amount = 0

Rising Signal Detected at Price = 48.84

Bought Shares at48.477  Number = 32284.9

Covered Shares at48.477 ,Number = 0 ,Short Money  = 1e+006

Profit from this pair of trades = 742.063

Falling Signal Detected at Price = 48.46

Sold Shares at48.498  ,Number = 0  ,Amount = 1.56575e+006

Short Sold Shares at48.498  ,Number = 20619.4 ,Amount = 0

Rising Signal Detected at Price = 49.73

Bought Shares at48.5235  Number = 32268

Covered Shares at48.5235 ,Number = 0 ,Short Money  = 1e+006

Profit from this pair of trades = -525.75

Falling Signal Detected at Price = 49.31

Sold Shares at49.3515  ,Number = 0  ,Amount = 1.59247e+006

Short Sold Shares at49.3515  ,Number = 20262.8 ,Amount = 0

Rising Signal Detected at Price = 49.75

Bought Shares at49.36  Number = 32262.4

Covered Shares at49.36 ,Number = 0 ,Short Money  = 1e+006

Profit from this pair of trades = -172.25

Falling Signal Detected at Price = 49.76

Sold Shares at50.2815  ,Number = 0  ,Amount = 1.6222e+006

Short Sold Shares at50.2815  ,Number = 19888 ,Amount = 0

Rising Signal Detected at Price = 51.05

Bought Shares at50.258  Number = 32277.

Covered Shares at50.258 ,Number = 0 ,Short Money  = 1e+006

Profit from this pair of trades = 467.313

Falling Signal Detected at Price = 50.81

Sold Shares at51.4135  ,Number = 0  ,Amount = 1.6595e+006

Short Sold Shares at51.4135  ,Number = 19450.1 ,Amount = 0

Rising Signal Detected at Price = 51.57

Bought Shares at51.418  Number = 32274.7

Covered Shares at51.418 ,Number = 0 ,Short Money  = 1e+006

Profit from this pair of trades = -87.5

Falling Signal Detected at Price = 50.51

Sold Shares at51.358  ,Number = 0  ,Amount = 1.65756e+006

Short Sold Shares at51.358  ,Number = 19471.2 ,Amount = 0

Rising Signal Detected at Price = 52.01

Bought Shares at51.41  Number = 32242

Covered Shares at51.41 ,Number = 0 ,Short Money  = 1e+006

Profit from this pair of trades = -1012.56

Falling Signal Detected at Price = 52.61

Sold Shares at53.22  ,Number = 0  ,Amount = 1.71592e+006

Short Sold Shares at53.22  ,Number = 18789.9 ,Amount = 0

Rising Signal Detected at Price = 54.49

Bought Shares at53.14  Number = 32290.5

Covered Shares at53.14 ,Number = 0 ,Short Money  = 1e+006

Profit from this pair of trades = 1503.19

Falling Signal Detected at Price = 53.43

Sold Shares at54.743  ,Number = 0  ,Amount = 1.76768e+006

Short Sold Shares at54.743  ,Number = 18267.2 ,Amount = 0

Rising Signal Detected at Price = 54.23

Bought Shares at53.771  Number = 32874.3

Covered Shares at53.771 ,Number = 0 ,Short Money  = 1e+006

Profit from this pair of trades = 17755.7

Falling Signal Detected at Price = 53.81

Sold Shares at53.81  ,Number = 0  ,Amount = 1.76896e+006

Short Sold Shares at53.81  ,Number = 18583.9 ,Amount = 0

Rising Signal Detected at Price = 53.38

Bought Shares at53.282  Number = 33200

Covered Shares at53.282 ,Number = 0 ,Short Money  = 1e+006

Profit from this pair of trades = 9812.25

Long only Profit = 842269

The Buy and Hold Profit = 498110

——————

Short Only profit = 191472

Latest Price = 55.49

No.of Outstanding shares = 0 And if covered at current priceAddl Profit = 0

Total Short Selling Profit = 191472

———————-

Total Profit, Short and long = 1.03374e+006

Total Commission = 538.51

Nett Profit after Commissions = 1.0332e+006

1.1.5       Strategy 3:

1.1.5.1  Description of Strategy:

  • Buy when RSI <30
  • Sell when RSI >70

An RSI value of >70 indicates an overbought condition. Similarly, an RSI value of <30 indicates an oversold condition. Thus, by selling when the stock is overbought and buying when the security is oversold, we can hope to make a profit.

1.1.5.2  Results using Strategy 3

Initial Capital = 1,000,000 US $

Time Period = 11 months

Stock: Merrill Lynch (MER)

Profit = = -159,766

Results for Merrill Lynch (MER) from 2nd Jan 2007 – 1st November 2007

Portfolio Initialized,Year High set to, 0

Amount set to  1e+006

Number set to  0

RSI = 0

Bought Shares at90.44  Number = 11057.1

RSI = 0

RSI = 56.7359

RSI = 51.7481

RSI = 63.0306

Sold Shares at92.8  ,Number = 0  ,Amount = 1.02609e+006

Short Sold Shares at92.8  ,Number = 10775.9 ,Amount = 0

RSI = 75.4367

RSI = 78.5844

RSI = 76.2707

RSI = 75.5204

RSI = 58.395

RSI = 61.5351

RSI = 65.2873

RSI = 55.5088

RSI = 66.3841

RSI = 51.3111

RSI = 47.7998

RSI = 38.9173

RSI = 40.949

RSI = 45.2636

RSI = 51.1224

RSI = 52.1819

RSI = 51.0899

RSI = 48.6799

RSI = 51.576

RSI = 50.605

RSI = 41.9711

RSI = 37.0495

RSI = 42.51

RSI = 49.969

RSI = 49.0404

RSI = 45.396

RSI = 45.1243

RSI = 42.9942

RSI = 39.6947

RSI = 31.2917

RSI = 25.6456

Bought Shares at85.47  Number = 12005.3

Covered Shares at85.47 ,Number = 0 ,Short Money  = 1e+006

Profit from this pair of trades = 78987.1

RSI = 20.2627

RSI = 21.6546

RSI = 22.0074

RSI = 19.5366

RSI = 16.7281

RSI = 27.649

RSI = 28.1819

RSI = 33.1149

RSI = 32.4309

RSI = 35.0777

RSI = 27.0798

RSI = 26.1908

RSI = 30.6277

RSI = 30.0967

RSI = 37.0715

RSI = 40.2475

RSI = 51.8001

RSI = 50.647

RSI = 52.6941

RSI = 52.582

RSI = 46.5529

RSI = 41.5861

RSI = 39.4657

RSI = 40.1166

RSI = 44.8156

RSI = 53.9954

RSI = 53.7345

RSI = 56.1224

RSI = 58.3185

RSI = 57.8652

RSI = 54.3518

RSI = 54.1672

RSI = 55.8663

RSI = 64.9003

Sold Shares at87.79  ,Number = 0  ,Amount = 1.05395e+006

Short Sold Shares at87.79  ,Number = 11390.8 ,Amount = 0

RSI = 66.8287

RSI = 69.173

RSI = 66.1757

RSI = 70.9145

RSI = 68.0133

RSI = 64.928

RSI = 67.0253

RSI = 63.4796

RSI = 58.856

RSI = 59.2926

RSI = 60.5

RSI = 62.8082

RSI = 66.4918

RSI = 68.8375

RSI = 66.9073

RSI = 60.0136

RSI = 64.3743

RSI = 56.2683

RSI = 64.3311

RSI = 58.9401

RSI = 55.4745

RSI = 58.4828

RSI = 57.2162

RSI = 63.399

RSI = 61.7194

RSI = 62.2906

RSI = 61.2488

RSI = 54.9767

RSI = 51.4223

RSI = 56.5948

RSI = 55.6942

RSI = 54.4974

RSI = 56.9311

RSI = 49.9722

RSI = 49.1551

RSI = 42.8362

RSI = 33.0215

RSI = 40.3528

RSI = 40.908

RSI = 36.1

RSI = 46.6249

RSI = 47.9006

RSI = 48.2542

RSI = 47.4048

RSI = 47.586

RSI = 39.0815

RSI = 37.8937

RSI = 30.535

RSI = 29.4502

Bought Shares at83.14  Number = 12676.8

Covered Shares at83.14 ,Number = 0 ,Short Money  = 1e+006

Profit from this pair of trades = 52967.3

RSI = 32.057

RSI = 40.5748

RSI = 39.8694

RSI = 33.292

RSI = 33.1213

RSI = 39.3141

RSI = 36.75

RSI = 40.3451

RSI = 43.4555

RSI = 34.9316

RSI = 37.9644

RSI = 47.3383

RSI = 50.6706

RSI = 53.3236

RSI = 49.3325

RSI = 41.3841

RSI = 39.6707

RSI = 33.8941

RSI = 33.9337

RSI = 28.5682

RSI = 32.4528

RSI = 28.6724

RSI = 27.7059

RSI = 33.3904

RSI = 29.1041

RSI = 27.8582

RSI = 27.0759

RSI = 23.5353

RSI = 39.0501

RSI = 40.9042

RSI = 48.6994

RSI = 41.7302

RSI = 40.7147

RSI = 39.6358

RSI = 35.7862

RSI = 32.0954

RSI = 38.3582

RSI = 49.5969

RSI = 47.4341

RSI = 49.9378

RSI = 50.6362

RSI = 49.3959

RSI = 50.0683

RSI = 47.0085

RSI = 40.9069

RSI = 43.92

RSI = 41.9662

RSI = 46.1914

RSI = 50.5645

RSI = 47.1294

RSI = 46.481

RSI = 45.1395

RSI = 43.7016

RSI = 45.2866

RSI = 44.9167

RSI = 51.9867

RSI = 50.4089

RSI = 45.0182

RSI = 53.835

RSI = 55.451

RSI = 51.8469

RSI = 50.0889

RSI = 46.9517

RSI = 42.6267

RSI = 41.67

RSI = 41.0891

RSI = 40.3371

RSI = 50.1202

RSI = 55.4419

RSI = 56.5075

RSI = 52.1062

RSI = 57.6424

RSI = 49.3232

RSI = 50.0285

RSI = 51.8838

RSI = 53.2808

RSI = 52.569

RSI = 46.9372

RSI = 41.4709

RSI = 41.0124

RSI = 36.76

RSI = 28.8583

RSI = 29.7618

RSI = 32.58

RSI = 25.8017

RSI = 22.7573

RSI = 39.8983

RSI = 43.3639

RSI = 39.883

RSI = 42.0815

RSI = 35.4593

RSI = 29.1157

RSI = 27.5954

Long only Profit = -291622

The Buy and Hold Profit = -392477

——————

Short Only profit = 131954

No.of Outstanding shares = 0 And if covered at current priceAddl Profit = 0

Total Short Selling Profit = 131954

———————-

Total Profit, Short and long = -159667

Total Commission = 98.91

Nett Profit after Commissions = -159766

1.2       Conclusion:

  1. Strategy 1 did well with a rate of return of about 12%
  2. Strategy 2 did exceedingly well with a rate of return of 103% over 7 months
  3. Strategy 3 made a loss of about 16% over 7 months and performed poorly

Therefore, it appears that Strategy 2 is the best strategy among the 3 strategies considered.

No comments yet.

Leave a comment!

You must be logged in to post a comment.

Find it!

Theme Design by devolux.org