How to backtest my trading strategy ?
6 views (last 30 days)
Show older comments
I have a strategy that buys/sells based on a criteria. I would like to back test it, to understand how good/bad it works.
How can i program matlab to back test and record the results?
Please view the two charts below to understand the strategy.
Basically when the detrended data chart reached to the level of -125 (bottom red line) then buy the stock, and when it reaches to a level of +125 (top red line) sell it.
Stock data chart
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/361885/image.png)
Detrended data chart
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/361888/image.png)
0 Comments
Answers (1)
Puru Kathuria
on 8 Mar 2021
Have a look at the documentation of backtestStrategy which will help you in creating a backtestStrategy object where you can define your portfolio allocation strategy.
0 Comments
See Also
Categories
Find more on Transaction Cost Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!