I thought it might be cool to have a stock price generator which is generating a steady sinus output, so that it can be used for the testing of trading strategies.

A sinus generator function generally needs the following input

  • amplitude
  • omega
  • phase

This is oscillating between -amplitude and +amplitude so we also need to add the following additional parameter to raise the center on the y axis

  • offset

These parameter can also be determined by using the existing stock data and finding the parameters which are fitting best. This functionality is now available in the HarmonicStockOscillator class! I also added a implementation for RandomForecast and SimpleRegressionForecast.

Here is a quick Demo


Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *