Changing the 2 SMA parameters


In the previous posts, we used the 50 days for the shortTerm SMA, and 199 for the long term SMA.
Let’s change these parameters randomly (a more rigorous optimization would be better, I admit) and plot the results:

nShortTermMA = 22;
nLongTermMA = 189;

winLoseRatios Arithmetic Mean: 54.23%, stdev: 4.27%, avgBarGainPercent mean: 0.19%, stdev: 0.27%, projCAGR: 10.09%***p_test: 315

nShortTermMA = 20;
nLongTermMA = 180;

winLoseRatios Arithmetic Mean: 54.07%, stdev: 4.63%, avgBarGainPercent mean: 0.19%, stdev: 0.30%, projCAGR: 10.47%***p_test: 310

nShortTermMA = 35;
nLongTermMA = 180;
winLoseRatios Arithmetic Mean: 54.09%, stdev: 4.49%, avgBarGainPercent mean: 0.17%, stdev: 0.28%, projCAGR: 9.25%***p_test: 304

nShortTermMA = 35;
nLongTermMA = 210;
winLoseRatios Arithmetic Mean: 54.09%, stdev: 3.82%, avgBarGainPercent mean: 0.17%, stdev: 0.27%, projCAGR: 9.15%***p_test: 310

nShortTermMA = 19;
nLongTermMA = 171;
winLoseRatios Arithmetic Mean: 52.83%, stdev: 4.21%, avgBarGainPercent mean: 0.11%, stdev: 0.29%, projCAGR: 5.64%***p_test: 316

nShortTermMA = 5;
nLongTermMA = 50;
winLoseRatios Arithmetic Mean: 54.07%, stdev: 3.58%, avgBarGainPercent mean: 0.17%, stdev: 0.25%, projCAGR: 9.19%***p_test: 165

nShortTermMA = 30;
nLongTermMA = 199;
winLoseRatios Arithmetic Mean: 54.38%, stdev: 4.12%, avgBarGainPercent mean: 0.16%, stdev: 0.29%, projCAGR: 8.45%***p_test: 342

nShortTermMA = 25;
nLongTermMA = 180;
winLoseRatios Arithmetic Mean: 53.70%, stdev: 4.13%, avgBarGainPercent mean: 0.12%, stdev: 0.27%, projCAGR: 6.63%***p_test: 106

nShortTermMA = 10;
nLongTermMA = 40;
winLoseRatios Arithmetic Mean: 53.25%, stdev: 4.32%, avgBarGainPercent mean: 0.09%, stdev: 0.27%, projCAGR: 5.02%***p_test: 106

nShortTermMA = 20;
nLongTermMA = 220;
winLoseRatios Arithmetic Mean: 53.66%, stdev: 4.23%, avgBarGainPercent mean: 0.08%, stdev: 0.27%, projCAGR: 4.17%***p_test: 120

nShortTermMA = 7;
nLongTermMA = 55;
winLoseRatios Arithmetic Mean: 53.46%, stdev: 4.07%, avgBarGainPercent mean: 0.07%, stdev: 0.25%, projCAGR: 3.96%***p_test: 127

nShortTermMA = 60;
nLongTermMA = 150;
winLoseRatios Arithmetic Mean: 52.88%, stdev: 4.48%, avgBarGainPercent mean: 0.06%, stdev: 0.27%, projCAGR: 3.19%***p_test: 82

nShortTermMA = 20;
nLongTermMA = 150;
winLoseRatios Arithmetic Mean: 53.50%, stdev: 4.12%, avgBarGainPercent mean: 0.06%, stdev: 0.28%, projCAGR: 3.15%***p_test: 102

One thing bothers me a little that adding a second shortTerm SMA doesn’t improve the results too much (if any) compared to the case when we used only 1 longterm SMA input. (see previous post). Therefore, as using the shortTerm MA doesn’t give additional benefit, in the future I will consider replacing the shortTerm SMA input with another input that may be more beneficiary.
Like the SMA(VIX, 10 days), or SMA(VIX, 20days) difference from SMA(VIX, 50days), or as a fundamental input: the FED interest rate.

As another conclusion, in the future, I would like to use
nShortTermMA = 20;
nLongTermMA = 180;
if I want to use nice round numbers, or better I would use
nShortTermMA = 22;
nLongTermMA = 189;
just for having non-nice numbers as parameters. For me, the round 180 is as nice as the 189.

Note that so far this is our best result. With SMA(20)/SMA(180), the NN achieved 54.07% weekly directional prediction accuracy
and estimated 10.47% CAGR


4 Responses to “Changing the 2 SMA parameters”

  1. 1 Jack

    Are you asking the right questions? Training an ANN on a continuous signal should form a function approximator, but there needs to be a function to be approximated, and there needs to be a relationship between the inputs and the targets. In an ANN classifier (direction, up or down), you form a probability estimator, but it also requires a valid question and data that is relevant to the question. In asking the question about weekly direction, do the answers account for the intraday ranges, or does your sample population have a sufficient data or number of cases to train the NN to filter out that noise in the signal? Look carefully at the indicators. SMA and EMA only account for averages of specific points in time (end of day) but say nothing about intraday ranges.

    • Hi Jack,
      You are right that there needs to be a meaningful relationship between the inputs and the targets. This is crucial.
      And to be honest, I am not sure there is in my case; I just hope that heuristics like
      ‘above SMA(200), the market is in bull mode, therefore the weekly gains are more probable than losses’ work.
      I consider using fundamental input instead of (beside) the past price data.
      But unfortunately, I read an article weeks ago that the LI (Leading Economic Index) that is believed to be leading the market in reality it lags the SPY returns. Basically, the strength of the SPX is that moves the LI higher.
      Having these hints, I can’t help but doubt the usefulness of fundamental inputs.
      (But no question, I will try to use other inputs later; I reviewed some other articles that used interest rates, unemployment, etc. successfully to predict stock market. At least, that is what the authors claim in their report.)
      Using intraday ranges: when I started this quest, I tried daily forecast. In that context, I tried using
      daily (closePrice, volume) inputs, or daily (open, close, high, low, volume) inputs.
      Using high, low prices didn’t improve the result.
      To be honest, for me the daily prediction didn’t work at all. (maybe there was a bug in my Matlab code)
      With weekly bars (instead of daily bars), I can try the same I guess, by adding weekly (high, low) into the input.
      I think I will try it in the future.
      I don’t use an ANN classifier in a strict sense. My ANN estimate the next week RUT price %change from the current RUT price (this is the target).
      My sample population is about 12 years data, that is about 2800 days.
      Using every day as a sample for weekly prediction, I have 2800 sample. This maybe enough to filter out the noise.
      (unfortunately, the samples therefore are not independent)

  2. 3 Jack

    Closing prices… again, data points at specific points in time. How can you expect to derive any meaningful function from such a questionable set of data points? Closing prices aren’t necessarily at regular time intervals along what is not a truly continuous signal. Is it a meaningful target or even a meaningful question. If you look at the results of your closing price experiments, how many of those predicted closing prices fall within the days range? What does that do for your batting average? Is the intraday range more functionally aproximate-able? Perhaps, that would be a more meaningful question, and perhaps the answer would be more meaningful in the scheme of things.

    • Hi Jack,
      If you ask how can we expect to derive any meaningful information from the closing prices, than you should ask the technical analyst armada.
      Not that I really believe in technical analysis.
      If you question that how I derive a meaningful function, I have to normalize and detrend the closePrice input.
      In my case, my ‘input1 = closePrice/SMA(closePrice, 180) – 1’, which is the % above or below the SMA(180). This wobbles around zero, so it is automatically detrended.
      Why would it be good for me to predict the intraday ranges?
      I left your other questions unanswered mostly, because I don’t claim I have answers.
      Btw. just for curiosity, have you personally applied ANN to prediction of anything (like stock market)?
      Your experience is welcome. Thank you for your comments.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: