I updated the CMF indicator to C, new strategy (NQ) results and code included
A new way to create custom indicators in RealTest using C (that's right). The strategy produced a PF of 1.7 and Sharpe of 1.33 on 525 trades in the last 10 years of NQ data.
Disclaimer: the following post is an organized representation of my research and project notes. It doesn’t represent any type of advice, financial or otherwise. Its purpose is to be informative and educational. Backtest results are based on historical data, not real-time data. There is no guarantee that these hypothetical results will continue in the future. Day trading is extremely risky, and I do not suggest running any of these strategies live.
Important!
This strategy has been updated. When I was working on adding this strategy to a portfolio project, I ran across an error I made in the short logic. I accidentally had it set to take longs instead of shorts. When I fixed this, it changed the results. The short portion of the strategy only accounted for about 1/5 of the trades. The new results for just the long side are posted directly below this paragraph. The strategy code has been updated for the paid subscribers. Sorry for the mistake!
I have been doing a lot of experimenting with creating custom indicators for RealTest (RT) using C. Just a few weeks ago, I didn't even know that this was something that could be done in RT. Now, I am working on converting all of my favorite indicators to C so I can program them in a way that works better for my brain. Of course, this requires that I learn some C code along the way. You don't have to though. If you are interested (and a paid subscriber), the code will be provided for you to experiment with or use.
Below are the results from this strategy. You can see longs and shorts tested separately and in-sample/out-of-sample results.
Stats for the entire strategy are below. I am updating my subdomain for strategy results, so bare with me for a couple of weeks until I get that updated. Once updated, all strategy results can be found there again.
Chaikin's Money Flow (CMF), C-style
I have come full circle with this indicator. I learned about it and it's logic from "Statistically Sound Indicators" by Timothy Masters. In that book, the code examples provided are in C. So, I took that logic and translated it into Python (infinitely easier to learn and work with), and tested it from there. Then, I took the calculation logic and figured out how to create it using RT script. I got annoyed with creating indicators in RT Script and at some point in my questioning on the forum, I was instructed to look at the RTDLL
directory inside the RT install directory. There, I discovered that I can actually code an indicator in C and call it from inside RealTest. The following is the first indicator I completed and tested.
It's important to mention that RT exposes a header file with pointers you can use to design your indicators. It works on a single pass principle, meaning that the indicators designed this way will work with 1 array of data at a time unless you actively pass in different arrays of data with the function call (more on this in future posts). In this indicator, we actually need to calculate and store a rolling window of data to make further calculations. I attempted to comment this as best I could.
The rest of this post is for paid subscribers. Paid subscribers will have access to all paid publications, strategies, code associated with posts, and access to the HGT chat room. Red Team members will have access to the community GitHub and more.