Hybrid, Zero lag, Adaptive cycle MACD Backtest (Simple) [Loxx]Simple backtest for Hybrid, Zero lag, Adaptive cycle MACD Backtest (Simple) found here:
What this backtest includes:
-Customization of inputs for MACD calculation
-Take profit 1 (TP1), and Stop-loss (SL), calculated using standard RMA-smoothed true range
-Activation of TP1 after entry candle closes
-Zero-cross entry signal plots
-MACD-Signal cross entry continuations
-Longs and shorts
Happy trading!
Dominant
Enhanced Autocorrelation Periodogram RasterChart - EhlersFirstly, this is NOT an indicator. It's an advanced cycle period detector for advanced developers OR scripts providing a "Period Source" they may have developed that can utilize this detector. Be forewarned! I would only recommend this for advanced developers, not novice. If you are up to the challenge of manually altering period adjustments on the daily chart of an indicator by hand in real time, you may still obtain this indicator after negotiating a proper request for access, but I will say this, it is NOT suitable for all indicators.
Understand all of the above aforementioned? Proceed...
For those of you wondering how I did it without Pine support for arrays, I had to emulate them, totaling over 600+ lines of code. This was a formidable task to achieve. This may be the hardest task I have ever accomplished, as of yet, in Pine.
Now, on to the Description...
This is my enhanced and heavily* modified version of Dr. John Ehlers' autocorellation periodogram for detecting dominant cycles(frequencies) in an asset using Pine Script version 4.0. The original concept comes from chapter 8 of his book "Cycle Analytics for Traders" and may also be found in TASC magazine in the September 2016 issue. I did heavily modify the original computations for the purpose of providing the "maximum" amount of adjustability there is to possibly offer, but left the original settings intact. I also provided an assortment of vibrant color changing techniques to choose from for anyone who may have vision impairments. This also displays that color scheming is VERY possible in Pine ...if only I could get "chart.theme" for auto-detection.
I once again would personally like to thank the talented individuals at TV for providing a platform that embraces an initial free membership, which I first obtained myself, for individuals like me to freely code in Pine with mathemagical ideas and mental wizardry, creating ultimately, inventions like this eye candy display above.
Features List Includes:
"Source" Selection
Color schemes (displayed above)
Transparency for the heat map to reduce or intensify color brightness ( Thank you TV! For this feature...)
The detected dominant cycle can be 'Sourced' by another specially** modified script providing an integer, float, or a rounded float.
Resolution enhancement has 3 settings
Smoother period control
Highpass period control
Pearson correlation period control
Minimal Power Threshold Tweak(Experimental***)
Adjustment for the smoothing coefficients of the Fourier Transforms(Experimental!)
This is not a freely available indicator, FYI. To witness my Pine poetry in action, properly negotiated requests for unlimited access, per indicator, may ONLY be obtained by direct contact with me using TV's "Private Chats" or by "Message" in my member name above. The comments section below is solely just for commenting and other remarks, ideas, compliments, etc... If you do have any questions or comments regarding this indicator, I will consider your inquiries, thoughts, and ideas presented below in the comments section, when time provides it. As always, "Like" it if you simply just like it, and also return to my scripts list occasionally for additional postings. Have a profitable future everyone!
* This has additional features/tweaks not included in the original.
** Many Pine built-in functions WILL NOT support the use of this detector if 'Sourced' to control a period setting. You have to totally rewrite those built-in Pine functions in Pine script. Yes, it is very possible! BUT ...in many cases, not all.
*** This "modification" reduces large spikes in the detected dominant cycle period with increased adjustment. Increasing this value may reduce dominant cycle spikes around 0.3-ish
Adaptive Zero Lag EMA v2This is my most successful strategy to date! Please enjoy and join the Open Source movement by sharing your code and ideas online!
OPERATING PRINCIPLE
The strategy is based on Ehlers idea that any indicator can be turned into a signal-producing trade system through smoothing and other filtering processes.
In fact, I'm using his Zero Lag EMA (ZLEMA) as a baseline indicator as well as some code snippets he has made public (1). God bless open source!
Next, I've provided the option to use an Instantaneous Frequency Measurement (IFM) method, which will adaptively choose the best period for the ZLEMA (2)
I've written other studies that use the differential calculus approximations for IFM, so it was only natural to include them in this strategy.
The primary two are Cosine IFM (3) and In-phase Quadrature IFM (4). You can also find an indicator with both plotted and the ability to average them together, as one IFM prefers long periods and the other short. (5)
BEFORE WE BEGIN
1. This strategy only runs on "normal" FX pairs (EURUSD, GBPJPY, AUDUSD ...) and will fail on Metals or Commodities.
Cryptos are largely untested.
2. Please run it on these time frames: M15 to D.
Anything outside this range will likely fail.
HOW TO USE AND SUCCEED
1. If the Default settings don't produce good results right off the bat, then lower gain limit to 1 or 2 and threshold to 0.01.
2. Test each setting under adaptive method . If you want to leave it Off , then I'd recommend using some kind of IFM (see my links below) to
discover the most efficient period to use.
3. Once you have the best adaptive method chosen, begin incrementing gain limit until you find a nice balance between profit factor (PF) and drawdown.
4. Now, begin incrementing threshold . The goal is to have PF above 2 and a drawdown as low as possible.
5. Finally, change the source ! Typically, close is the best option, but I have run into cases where high
yielded the highest returns and win rate.
6. Sit back, relax, and tweak the risk until you're happy with the return and drawdown amounts.
ADVANCED
You may need to adjust take profit (TP) points and stop loss (SL) points to create the best entry possible. Don't be greedy! You'll likely have poor
results if the TP is set to 300 and SL is 50.
If you are trading a pair that has a long Dominant Cycle Period , then you may increase Max Period to allow the IFM
to accept longer periods. Any period above the Max Period will be rejected. This may increase lag time!
Cheers and good luck trading!
-DasanC
PS - This code doesn't repaint or have future-leak, which was present in Pinescript v2.
PPS - Believe me! These returns are typical! Sometimes you must push aside the "if it's too good to be true..." mindset that society has ingrained in you.
Do you really believe the most successful pass up opportunities before investigating them? ;)
(1) Ehlers & Ric Zero Lag EMA
(2) Measuring Cycles by Ehlers
(3) Cosine IFM
(4) Inphase Quadrature IFM
(5) Averaging IFM
Ehlers Smoothed Adaptive MomentumEhlers Smoothed Adaptive Momentum script.
This indicator was developed and described by John F. Ehlers in his book "Cybernetic Analysis for Stocks and Futures" (2004, Chapter 12: Adapting to the Trend).
Ehlers Instantaneous TrendlineEhlers Instantaneous Trendline script.
This indicator was described by John F. Ehlers in his book "Rocket Science for Traders" (2001, Chapter 10: The Instantaneous Trendline).
Missile RSI (RSI of momentum w/ Dominant Cycle length + Fisher)This is a predictive indicator that looks for explosions in momentum of the cycles in price and large shifts in Momentum (Fisher turns the Bimodal PDF into Guassian like) as statistically unlikely events, showing points to exit or reverse positions.
You can adjust the lowpass frequency cuttoff (Aka what cycles you want to remove from the calculations through the super smoother filter).
To be honest you can monkey trade the direction of the Signal if you'd like but the Divergences and Maxing of the values is whats most useful.
Let me know if you guys want me to add anything else.
DFT - Dominant Cycle Period 8-50 bars - John EhlerThis is the translation of discret cosine tranform (DCT) usage by John Ehler for finding dominant cycle period (DC).
The price is first filtered to remove aliasing noise(bellow 8 bars) and trend informations(above 50 bars), then the power is computed.
The trick here is to use a normalisation against the maximum power in order to get a good frequency resolution.
Current limitation in tradingview does not allow to display all of the periods, still the DC period is plot after beeing computed based on the center of gravity algo.
The DC period can be used to tune all of the indicators based on the cycles of the markets. For instance one can use this (DC period)/2 as an input for RSI.
Hope you find this of some interrest.
Relative Vigor Index with Dominant Cycle Detection (RVI)Relative Vigor Index with Dominant Cycle Detection. As Ehler's mentioned, fixed length look back is inherently flawed when it is possible to extract a length from a dominant price cycle. may be less effective if signal to noise ratio is greater than 2, but that usually would not happen at >5m candles, and honestly shouldn't be looking at RV(igor)I when price is moving sideways.
Read just like an RVGI, but adjusted to the current time frame. To reduce noise, changing to heiken ashi will help with signals as well. Let me know if there are improvements!
Made for JD, the OG.