I want to create a Custom Indicator that will be an index between 0 and 100 and will incorporate a number of other indicators including RSI and MACD and possibly some MOMP. The strategy will invest/divest if the Custom Indicator goes above/below a specific threshold, just like one might do with RSI. The Custom Indicator index would be created by weighting the different indicators and ensuring it conforms to a 0-100 scale. As such, it will require some math functions.
I understand how to create a Custom Indicator, but I haven't found an example that incorporates other ‘standard’ indicators and couldn't get it to work. Any suggestions on how to proceed (in Python). Thanks!
Fred Painchaud
Hi Koen,
I've been doing that extensively. Overall, I use two “techniques”:
1- The existing indicators I want to use are simply assigned to one self.some_variable in my custom indicator.
2- I re-implement the existing indicator inside my custom indicator when it makes more sense to blend it in instead of letting it encapsulated. For instance, having multiple encapsulated indicators inside another indicator can multiply the duplication of data. Dumb example: let's day one indie integrates 3 EMAs of different lengths and makes comparisons to produce signals. If you keep those 3 EMAs separate, the shorter one's data is also inside the other two and the middle one's is in the longer one… So then I would choose to keep only the longer length of data once and calculate all 3 EMAs from that data. It's not only a question of data duplication (space) but also a question of time (processing). Oftentimes, I also do “dynamic programming”, which means I calculate some “small results” only once and I re-use those results over and over again when I calculate larger results, instead of always re-calculating smaller results when needing larger ones. 😊 When the algo is about doing that…….. Doing my best to popularize here.
Fred
.ekz.
Sharing this relevant post from Fred. It might be useful as he breaks down, in much detail, how custom indicators work.
Koen Dirckx
@ekz and @fred - appreciate the suggestions. Incorporating both!
Trader Benedict
is there any template to incorporate a standard indicators into a custom indicators, with the update, warmup period, and plotting include ? For exemple, i'am currently trying to build an ADX based on the average of 7 DX, which is it self based on +DI and -DI computed on 14 period. In other words ADX period = 7 and +DI, -DI period = 14.
Trader Benedict
A kind of “fast” ADX compare to the 14 period ADX
Trader Benedict
I upload my code and a special discussion for my case: "
Trader Benedict
I upload my code and a special discussion for my case: "
Trader Benedict
After spending many hours working on this problem, I've finally found a solution. The code I'm sharing is the very first template designed to calculate a custom indicator using a pre-existing indicator as a base.
I hope sharing this will save someone else the six full days of hard work and effort I put into solving it myself :))
Koen Dirckx
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!