A Basic Stock Trading Backtesting System for F# using Ta-Lib and FSharp.Data
This article is written for the intermediate F# audience who has a basic familiarity of stock trading and technical analysis, and is intended to show the basics of implementing a backtesting system in F#.
If you’re an F# beginner it may not take too long for you to get up to speed on the concepts if you check out a few resources. In particular:
The backtesting strategy which you will implement is a simple SMA crossover where the fast line is 10 bars and the slow one 25. When the fast line crosses above the slow line, a buy signal will be triggered, and when the fast line cross below the slow line, a sell signal will be triggered. Only one long position will exist at any time, so the system will not trigger another buy order until after the long position is sold.