Hi all,
I've been meaning to share this for a while but just now found the time to create the documentation and fully comment the code.
First, a big thank you to Earik for allowing me to share. Half of this code is his IP from his Mechanical Trading Systems book so it is very generous of him to allow me to share with the entire Wave59 community that may not have purchased his MTS book yet. If you haven't and you like what you see here, it is definitely a good idea to purchase so you can understand his sub-systems and the ideas I used to improve what he provides in the book. I probably would have floundered around for 10 years before I managed to build a system like this without the starting point he provides in his book so it was worth every penny and I expect this system to pay off his book very soon.
Everything is optimized to trade on an ES Daily chart. For all backtesting results, I am using IQFeed data for the ES continuous contract (@ES#C). All of the backtesting results attached are using the default settings, starting with a $125k account and with a contract cap of 5. Dynamic position sizing is enabled by default so you need to set the contract cap to the most contracts you are comfortable allowing the system to trade as this will override dynamic position sizing as your account grows.
The documentation file I attached as well as the comments in the code describe the strategy of the system as well as the additional sub-systems I created more in depth so please review everything before you use.
Lastly, even with the starting point Earik provided, this took me several hundred hours to complete. My only request is if you make any improvements, find any bugs or have any ideas for anything to add, please share so we can all benefit.
Also, for the sake of full disclosure, I am using this system live but still only with one contract. I plan on increasing the contract cap so it can fully utilize the batch exit system over the next six months.
Here is the code for backtesting: http://www.wave59.com/library/scriptdetail.asp?id=177
Here is the code for the live trading: http://www.wave59.com/library/scriptdetail.asp?id=178
Please note the following two points for the live version.
1. You need all of the SystemF functions in the backtesting version in order to run the live version as they share the same functions. This also means if you are experimenting with the backtesting version, make sure to create copies of these files.
2. You do need to create a folder named "trading_system_logs_and_settings" in the Wave59 directory in order for it to run. It uses this folder to store the log and position sizing text files.
Every descriptive name I created for this system was causing headaches when trying to select the correct file to load as the long name would run off the list so going forward I'll be using code names for most of my systems. This one I have named Livermore.
Thanks!
hjelmstade
MVS with Adaptive Batch Exit and Adaptive CTS
-
- Posts: 34
- Joined: Wed May 18, 2016 6:51 pm
- Contact:
MVS with Adaptive Batch Exit and Adaptive CTS
- Attachments
-
- ES_Daily_Livermore_Documentation.pdf
- (376.07 KiB) Downloaded 906 times
-
- ES_Daily_Livermore_12-19-16_Summary.PNG (34.32 KiB) Viewed 21470 times
-
- ES_Daily_Livermore_12-19-16_Equity_Small.PNG (29.35 KiB) Viewed 21470 times
-
- ES_Daily_Livermore_12-19-16_Annual.PNG (33.12 KiB) Viewed 21470 times
-
- ES_Daily_Livermore_12-19-16_Monthly.PNG (54.53 KiB) Viewed 21470 times
Last edited by hjelmstade on Wed Dec 28, 2016 1:15 am, edited 3 times in total.
-
- Posts: 34
- Joined: Wed May 18, 2016 6:51 pm
- Contact:
Re: MVS with Adaptive Batch Exit and Adaptive CTS
Hi Earik,
I have two questions.
1. Is there anyway you can enable PDF uploads to forum posts so I can upload a PDF of the documentation rather than a google drive link? Right now it says the extension is not allowed.
2. I kept having issues uploading the live version of the code to the qscript library as I was receiving an Upload Error every time I tried. I finally just tried uploading the indicator files and not the functions and got it to work. Can you confirm that this is due to both the backtesting and live versions sharing the same functions?
I did not see the point in having copies of all the functions for the live version as I always make copies whenever I make changes but if this will be a problem going forward, I can change my process.
Thanks!
I have two questions.
1. Is there anyway you can enable PDF uploads to forum posts so I can upload a PDF of the documentation rather than a google drive link? Right now it says the extension is not allowed.
2. I kept having issues uploading the live version of the code to the qscript library as I was receiving an Upload Error every time I tried. I finally just tried uploading the indicator files and not the functions and got it to work. Can you confirm that this is due to both the backtesting and live versions sharing the same functions?
I did not see the point in having copies of all the functions for the live version as I always make copies whenever I make changes but if this will be a problem going forward, I can change my process.
Thanks!
Re: MVS with Adaptive Batch Exit and Adaptive CTS
Hi hjelmstade,
You should be able to upload PDFs now. I didn't realize they were being blocked. This forum has way too many settings...
Not sure what was going on with the library. You should be able to share functions between various uploads - the server doesn't do any double-checking, etc. It may have been an issue with a flood-control setting (so the library can't be spammed), so it might have just been necessary to wait a minute before uploading a second time. Not totally sure. Let me know if it happens again.
Thanks for sharing all these systems!
Regards,
Earik
You should be able to upload PDFs now. I didn't realize they were being blocked. This forum has way too many settings...
![Confused :?](./images/smilies/icon_e_confused.gif)
Not sure what was going on with the library. You should be able to share functions between various uploads - the server doesn't do any double-checking, etc. It may have been an issue with a flood-control setting (so the library can't be spammed), so it might have just been necessary to wait a minute before uploading a second time. Not totally sure. Let me know if it happens again.
Thanks for sharing all these systems!
![Very Happy :D](./images/smilies/icon_e_biggrin.gif)
Regards,
Earik
Re: MVS with Adaptive Batch Exit and Adaptive CTS
Hi hjelmstade,
I recently bought and read through Earik's MTS book, and was browsing the forum and came across your trading system.
Thanks for uploading your system, I downloaded your back test script and was able to run it.
Your trading system performs amazingly well during the credit crisis years. That's phenomenal!
How has it been working for you? I think I'll try trading it but manually at first with just one contract of course.
Thanks again. Will let you know how it goes.
Sheikh
I recently bought and read through Earik's MTS book, and was browsing the forum and came across your trading system.
Thanks for uploading your system, I downloaded your back test script and was able to run it.
Your trading system performs amazingly well during the credit crisis years. That's phenomenal!
How has it been working for you? I think I'll try trading it but manually at first with just one contract of course.
Thanks again. Will let you know how it goes.
Sheikh
-
- Posts: 34
- Joined: Wed May 18, 2016 6:51 pm
- Contact:
Re: MVS with Adaptive Batch Exit and Adaptive CTS
Hi Sheikh,
Sorry, I didn't respond earlier. Life got busy and I wasn't able to check the forums for a while.
To answer your question, yes, I'm still running this same system. I've tried adding improvements but still have not come up with anything better.
Below is an update. As I finished the system in December, we can consider the last 6 months to be out of sample data. It has been profitable 4 out of the last 6 months and although it had a rough month in March, it has now recovered and is up for the year.
Just a note though, you need to run the system with at least 5 base contracts (I recommend $25k per contract so a $125k account) in order to take advantage of the batch exits and win/loss streak contract size adjustments which really help to smooth out the equity curve. If you don't, it will not perform as well.
Sorry, I didn't respond earlier. Life got busy and I wasn't able to check the forums for a while.
To answer your question, yes, I'm still running this same system. I've tried adding improvements but still have not come up with anything better.
Below is an update. As I finished the system in December, we can consider the last 6 months to be out of sample data. It has been profitable 4 out of the last 6 months and although it had a rough month in March, it has now recovered and is up for the year.
Just a note though, you need to run the system with at least 5 base contracts (I recommend $25k per contract so a $125k account) in order to take advantage of the batch exits and win/loss streak contract size adjustments which really help to smooth out the equity curve. If you don't, it will not perform as well.
-
- Posts: 34
- Joined: Wed May 18, 2016 6:51 pm
- Contact:
Re: MVS with Adaptive Batch Exit and Adaptive CTS
Just in case anyone stumbles across this in the future and decides to give this system a go.... don't.
I turned it off after letting it run for 6 months on my live account. It did nothing but lose money. I'm pretty sure I over optimized and overall made it far too complicated.
I have since built a new system using a modified version of Earik's Lunar system and am running that instead. It is much much simpler (it is not a MVS) and so far is having a killer year in 2018.
So, lesson learned here is keep things simple![Smile :)](./images/smilies/icon_e_smile.gif)
I turned it off after letting it run for 6 months on my live account. It did nothing but lose money. I'm pretty sure I over optimized and overall made it far too complicated.
I have since built a new system using a modified version of Earik's Lunar system and am running that instead. It is much much simpler (it is not a MVS) and so far is having a killer year in 2018.
So, lesson learned here is keep things simple
![Smile :)](./images/smilies/icon_e_smile.gif)
Re: MVS with Adaptive Batch Exit and Adaptive CTS
Thanks for sharing. And updating us.
I agree that simplicity it key. About 5 years ago I had a complex system that was composed of around 7 other systems. One or two of the systems would give me incorrect results....sometimes. I ended up writing scripts to take screenshots before and after, daily plus enabled a whole bunch of debug messages in the script log to track down what it was. I never did find the culprit and just scrapped that whole system.
I agree that simplicity it key. About 5 years ago I had a complex system that was composed of around 7 other systems. One or two of the systems would give me incorrect results....sometimes. I ended up writing scripts to take screenshots before and after, daily plus enabled a whole bunch of debug messages in the script log to track down what it was. I never did find the culprit and just scrapped that whole system.
Who is online
Users browsing this forum: No registered users and 67 guests