Directions to run the file.
1. Unzip the file "TradingStrat.zip" so that you'll get the folder "TradingStrat".
2. Set your working directory as "TradingStrat > CSV" (The CSV folder holds the comma separated values data which is required to use the back tester)
3. Run the file 'runCSV.mat' by typing runCSV at the Matlab prompt.
4. A new window will open. In the 'Input:' window, select the stock you want to backtest.
5. Click on 'Execute'. At the main Matlab prompt, you should see a percentage progress from 0% to 100%.
6. Once done, another window will open for you to select the time frame of data to back test. Click on 'Execute' again.
7. A main window opens showcasing the candlestick data of the stock and various indicators with buy and sell signals as according to the strategy implemented. Look at the Readme file for a description of the strategies used.
8. You are free to change the parameters of each individual strategy. The profit and loss will be changed accordingly.
1. Simple and Exponential Moving Average Crossover.
2. Stochastic Oscillator.
3. Bollinger Band.
4. MACD Divergence.
5. RSI Strategy.
Stocks in the backtester:
DBS Bank (DBS), Genting (GENS), Kim Eng (KEH), Kep Corp (KEP), Osim (OSIM), Raffles Education Group (RLS), Singapore Airlines (SIA), Singapore Press Holdings (SPH), Singapore Technologies Engineering (STE), Starhub (STH), United Overseas Bank (UOB), UOL Group (UOL), Wilmar (WIL).
I am trying to run the Trading Strategy back tester but it's not working on my pc.
As far as I can see the problem is in the CSVconvert script, in the following:
stock = uicontrol(grp1,'style','popup','Position',[0.1 0.5 0.8 0.4],'Units','normalized','BackgroundColor',[0.8 0.8 0.8],...
It looks like the popup window is not popping up.
Is it a Java problem? Or is it the Matlab version (I am using R2015a)?
I am wondering if someone can help me with this problem.
I am applying filter and moving average trading rules using matlab to some stock prices. I could not get results from them and every time it shows that there sre some mistakes. I trying to deretmine buying and selling single but no results. can i find these rules already programmed some where.
what do i need to change in the convert function so that the data imports correctly?
i have EURUSD data which has time in the separate column and different data separations...
2007.03.30 17:04 1.3376 1.3377 1.3375 1.3376 57
2007.03.30 17:05 1.33755 1.3376 1.3374 1.3375 65
where as dbs data looks like this:
02/11/2010 09:00 14.22 14.22 14.2 14.2 4000 56860
DBS data is something like this:
02/11/2010 09:00 14.22 14.22 14.2 14.2 4000 56860
I found your program and tested it out.
Initially I had a problem with readdata when I clicked on execute after selecting an input CSV file on the first screen. Matlab returned the following error:
??? Undefined function or method 'readdata' for input arguments of type
Error in ==> CSVconvert>execute at 126
[TheData TheName] = readdata(tempname);
??? Error while evaluating uicontrol Callback
As a work around, I copied the contents of TradingStrat into the CSV folder. This seemed to work.
Then, while using your STE.csv file:
I found that if I removed all data after 6/11/10 15:32, The data range is incorrectly displayed as 2/11/10 to 6/10/10.
If I add anymore data points from 6/11/10 after 15:32, the range is fine.
I found that if I removed all data after 6/10/10 15:36, The data range is incorrectly displayed as 2/11/10 to 0/69/10
(which I assume is a formatting error combined with the incorrect date). If I add anymore data points from 6/10/10 after 15:36, the range is fine.
I found that if I removed all data after 6/09/10 15:35, The data range is incorrectly displayed as 2/11/10 to 0/68/10.
If I add anymore data points from 6/09/10 after 15:35, the range is fine (although there is still the formatting error of 0/69/10).
In conclusion, it seems as though the correct day is not registered until some time after 15:30pm. Any ideas?
I have been using matlab for one day so unfortunately I do not have the knowledge to fix these errors! Any input you could provide would be greatly appreciated.
Thanks again for posting this program.
I am getting errors trying to Input a .csv file after executing runCSV at the prompt.
Error in ==> CSVconvert>execute at 124
tempname = thelist(value,:);
Thanks for your interest in my Matlab program.
PnL is based on buying one stock at its closing price when there is a buy signal and selling it at its closing price when there is a sell signal ONLY FOR EACH buy-sell pair. For the cases when there is a buy signal but no sell signal after, no stock is bought. It is in dollars and cents of one stock, not one lot.
Commission, MAR, etc. is not taken into consideration.
Regarding your comment on Matlab users, to my knowledge, I believe Matlab has more popularity compared to the other math based programs due to its simplicity. If Matlab users are rare, then I would only assume Java and C++ users that create such algorithmic backtesters are even more rare.
Hi, its seem that you are from Singapore, btw its difficult to find matlab-ers over here.
I'm doing similar stuff as what yr application does, back-testing and walk-forward optimization trading strategies using matlab.
May i ask what is the PnL based on, dollar & cents? Do you take into consideration of commission, MAR (min acceptable rate of return), etc. to compute the performance of a strategy?
Change title from "Algorithmic Trading strategy back tester" to "Trading strategy back tester"