Relative Strength Improved (Premal Parekh ASR Version)This script is improved over the existing script developed by Mr. modhelius
I have added ASR Concept of Mr. Premal Parekh.
This script will remove manual calculation of Trading Days from ASR Date.
Adaptive
Ehlers Kaufman Adaptive Moving Average [CC]The Kaufman Adaptive Moving Average was created by Perry Kaufman and this is a variation of that original formula created by John Ehlers. I have included a side by side with an original script (blue line) done by @HPotter that shows that Ehlers version is slightly more reactive compared to the original version. I have included strong buy and sell signals in addition to normal ones and so darker colors are strong signals and lighter colors are normal ones. Buy when the line turns green and sell when it turns red.
Let me know if there are any other scripts you would like to see me publish!
Automatic Moving AverageAutomatic moving average removes the need to set the moving average length manually. The indicator progressively finds a suitable length that minimizes the number of candle body touches and maximizes the number of wick touches.
Ehlers Adaptive Bandpass Filter [CC]The Adaptive Bandpass Filter was created by John Ehlers (Cycle Analytics For Traders pgs 153-156) and this uses his autocorrelation code to provide the adaptive lengths to use for the underlying bandpass filter. The bandpass filter is a common way in digital signal processing to filter out the underlying noise in the data. It can actually be turned into a leading indicator by changing the bw variable to a smaller amount. Since this indicator is adaptive using the cycle period, the buy and sell signals are different compared to the normal bandpass filter. Buy signals for this indicator according to Ehlers are when the line is red and the line is under the oversold line (also red) then you buy when the indicator line turns green and then you exit when the indicator line turns red and is above the overbought line. This indicator doesn't provide clear buy and sell signals in all circumstances but generally speaking buy when the indicator line turns green and sell when it turns red. Feel free to experiment with this one.
Let me know if there are any other scripts you would like to see me publish!
Ehlers Adaptive Stochastic Indicator V1 [CC]The Adaptive Stochastic Indicator V1 was created by John Ehlers (Rocket Science For Traders pgs 233-234) and this indicator uses the same calculations to find a cycle period that is then used for both the creation of the stochastic indicator but also for the smoothing to create a double smoothed stochastic indicator. Because it is calculated this way, this indicator is more reactive than almost any other stochastic indicator and provides clear buy and sell signals especially when the underlying stock is trending. It is interpreted in the same way as a normal stochastic indicator so great buy signals are when the indicator is below the oversold line and starts to move up and vice versa. Buy when the line turns green and sell when it turns red.
Let me know if there are any other indicators you would like to see me publish!
Ehlers Adaptive Relative Strength Index V1 [CC]The Adaptive Relative Strength Index was created by John Ehlers and this is his first version. I will of course publish his updated version at a later date along with publishing the final script from Jim Sloman's Ocean Theory book. I have changed his script to include extra smoothing to provide clear buy and sell signals. This is a version of a RSI that is very adaptive to changes by finding the length of the current cycle and using that to calculate the rsi and I use this same basic process to provide extra smoothing. A great strategy of course is to buy right after the indicator goes from below the oversold level to right above it and stay in until the indicator turns red or when it reaches the overbought level. I have included strong buy and sell signals in addition to normal ones and the darker colors mean strong signals and lighter colors are normal signals.
Let me know what other indicators you would like to see me publish!
Ehlers Smoothed Adaptive Momentum [CC]The Smoothed Adaptive Momentum indicator was created by John Ehlers and this indicator gives a lot of useful information. When the indicator is above 0 then there is very strong upward momentum and when the indicator falls below 0 then there is very strong downward momentum. A very profitable way to use this particular indicator is buy long when the indicator is below 0 and it crosses over it's signal line and then sell of course when you get the first sell signal. I have included strong buy and sell signals in addition to normal ones so darker colors mean strong signals and lighter colors are normal signals. Buy when the line turns green and sell when it turns red.
Let me know if you have any other scripts you would like to see me publish!
Ehlers Adaptive Cyber Cycle [CC]The Adaptive Cyber Cycle was created by John Ehlers and this is a cycle based indicator which you don't find too many of these days. Each stock goes through cycles which are repeating patterns of price movement and cycle indicators help you find the timing of the cycle to capitalize on the underlying cycle. That is an extremely simple explanation but most importantly don't interpret these indicators as the same as other indicators because it may seem like there are very many false signals but that is because of the different cycles the stock is undergoing. Buy when the line turns green and sell when it turns red.
Let me know if there are any other indicators you would like to see me publish.
Cyclic Smoothed RSI MTFAdaptive cyclic smoothed Relative Strength Indicator (csRSI MTF)
The cyclic smoothed RSI MTF indicator is an enhancement of the RSI , adding zero-lag smoothing, adaptive oversold/overbought bands and period color highlighting from higher timeframe to filter signals.
Providing the following advanced features:
using the current dominant cycle length as input for the indicator to ensure more accurate change in trends,
additional smoothing without introducing lag and maintaining clear sharp turns for signal generation,
adaptive upper and lower bands to avoid whipsaw trades and adapt the indicator to trending/cyclic conditions,
using higher time-frame csRSI oversold/overbought conditions to automatically highlight time windows with green/red backgrounds on the indicator panel for signal filtering and/or alert rules,
can be used to trigger alerts on your key symbols to get informed when a red/green windows are reached.
The following common problems with standard indicators are solved by this indicator:
First, normal indicators introduce a lot of false signals due to their noisy signal line. Second, to compensate for the noise, one would normally try to add some smoothing. But this only results in adding more delay to the indicator, which makes it almost useless. Third, oscillators contain static threshold levels to define oversold/overbought conditions. However, the market is not static and changes between trending and cycling periods. In trending periods, these static oversold/overbought levels are useless ore will trigger too much whipsaw trades. Finally, indicators don't take their state from other timeframes into account to filter signals.
All four problems described above are solved by the developed adaptive cyclic RSI with embedded MTF period highlighting.
Examples
S&P500 EMini Futures - csRSI 2H chart / 1D filter example signals
S&P E-Mini Futures 2h chart with daily higher time-frame filtering period for the csRSI, showing the standard RSI in the lower panel for signal comparison, signals from the csRSI are marked on the price chart
Bitcoin BTC /USD - csRSI 2H chart / 1D filter example signals
Bitcoin BTC /USD 2h chart with daily higher time-frame filtering period for the csRSI, signals marked
EUR/USD Forex - csRSI 20min chart / 2h filter example signals
EUR/USD 20min chart with 2H higher time-frame filtering period for the csRSI, signals marked
Info:
All three examples are setup with the basic standard settings and no additional parameter adjustments. The placed arrows on the price/indicator panel and the projection price areas have been added manually to visualize the signals for an discretionary trading approach. They are derived based on standard technical indicator oscillator readings (signal turn above/below bands). Due to the nature of the indicator (ultra-smooth, sharp curves, dynamic bands), these signals are easy to spot, and will help to avoid whipsaw trades in volatile conditions.
Settings & Parameter
The Inputs section allows you to select the time frame for the indicator signals. We recommend keeping the indicator time-frame according to your chart time frame ("Same as chart"). The cycle length allows to improve the signals by entering the dominant cycle length of the analyzed dataset. This parameter is optional if the current dominant cycle is not known. In that case, leave it at 20. The dominant cycle length can even improve the indicator signal generation. The examples above have not been optimized by using the dominant cycle length and just used the standard setting of 20.
The MTF CYCLE FILTER area is used to set the time-frame used as filter to plot the colored indicator background in red and green areas when the higher time-frame indicator is above (red) or below (green) the dynamic bands. These indicate the period of time with high probability to look for signals on the main indicator line.
The MTF Resolution parameter input is important for generating the highlighted red/green areas on the indicator panel. You must enter a higher time-frame than your indicator time-frame in order to get the reliable highlighting. We recommend the following combinations of trading time-frame and filter time-frame resolutions:
Chart Timeframe | MTF Indicator Highlighting Resolution
------------------------------------------------------------------------
20 min | 2 h
2 h | 1 d
You can enter the current dominant cycle length on the chosen higher time-frame resolution to even further optimize the indicator accuracy in the field "MTF CYCLE FILTER - Cycle Length".
The Style sections allows to active/de-active individual plots. The standard setting disables the higher time-frame csRSI indicator which is only used to indicate the colored areas. If required, you can also enable the MTF indicator and adaptive bands to be plotted in the same indicator panel. The values shown in the style section also indicate which values are available for individual alert generation.
Automatic Signals & Alerts
It is possible to create your own automatic signals with the csRSI MTF indicator using the TradingView alert function. Click on the three dots "More" beside the indicator name label and select "Add Alert on csRSI ..." from the context menu. For example, if you want to receive an alert when the high probability periods (red/green highlighted areas) have been reached for a symbol without manually watching the indicator panel, you can set up a custom alert. The csRSI indicator provides the raw values necessary to set up your alarm conditions. Set the "CSRSI MTF" as the value for the "Out of Channel" condition and select the "HigBand MTF" and "LowBand MTF" indicator values as the upper and lower limit parameters in the alarm's dialog box. Once you have set up this alarm, you will not need to monitor your charts manually. The TradingView alert will inform you as soon as an important time zone is reached. These are the situations when you would open the chart and watch for trigger signals on the indicator line. If you set up this alert as an email, you can even focus on other things and let the csRSI MTF highlighter condition alert you when you should pay attention to the trading chart.
Usage & Trade Signals
Classic rules apply as with every technical oscillator. In addition use this indicator to identify the following conditions:
Indicator turns above/below the adaptive upper and lower bands (expected trend reversals)
Indicator crosses below upper band / crossed above lower band (start of trend reversal)
Indicator crosses above upper band / crossed below lower band (trend continuation/confirmation)
Divergence between price / indicator indicate strong signal confidence
Hidden divergences between price/indicator indicate string signal confidence
After strong price movements, wait for the second signal confirmed by a divergence
Use the mentioned conditions in the highlighted red/green periods indicated by the MTF settings
Purpose & Disclaimer
This indicator is not designed for use as an automated trading strategy. This is an improved technical indicator using the dominant cycle to provide its advanced features. The basic applications of technical analysis for using oscillators apply. The script is intended for use in discretionary trading and can be used as a part of automated systems. Indicator signal failures will occur as you should expect with every technical indicator. If you are not sure if this indicator might help your trading style, please try and check our open source public version which will give you basic understanding upfront.
Basic open-source public version
This indicator is an advanced version of our public available open-source cyclic smoothed RSI indicator named "RSI cyclic smoothed v2". The advanced invite-only version provides fully automatic time frame highlighting by using a cyclically smoothed RSI from a higher time frame to indicate time frames with high probability signals. These high probability windows are highlighted when the indicator from the higher time frame is in dynamic overbought or oversold territory. You will find the basic open-source public version here below for your own review:
How to get access
Please check the "authors instructions" section for further details.
QF VZO QF VZO is a leading volume oscillator
Its advantage is in giving leading buy/sell signals based on volume conditions and identifying overbought/oversold volume conditions, along with extreme overbought/oversold situations which lead to a change in sentiment, and most probably, leads to change of the current trend. QF VZO also has leading divergences to potentially spot trend reversals and trend continuation with almost zero lag.
QF FISHERQF fisher is based on John Ehler's fisher transform which converts prices into a Gaussian normal distribution. Its usefulness is in identifying overbought and oversold levels and due to its sharp reversals it provides fast divergences with high accuracy.
QF Fisher is calculated using adaptive period to work on multiple timeframes.
72s Strat: Backtesting Adaptive HMA+ pt.1This is a follow up to my previous publication of Adaptive HMA+ few months ago, as a mean to provide some kind of initial backtesting tools. Which can be use to explore many possible strategies, optimise its settings to better conform user's pair/tf, and hopefully able to help tweaking your general strategy.
If you haven't read the study or use the indicator, kindly go here first to get the overall idea.
The first strategy introduce in this backtest is one most basic already described in the study; buy/sell is when movement is there and everything is on the right side; When RSI has turned to other side, we can use it as exit point (if in profit of course, else just let it hit our TP/SL, why would we exit before profit). Also, base on RSI when we make entry, we can further differentiate type of signals. --Please check all comments in code directly where the signals , entries , and exits section are.
Second additional strategy to check; is when we also use second faster Adaptive HMA+ for exit. So this is like a double orders on a signal but with different exit-rule (/more on this on snapshots below). Alternatively, you can also work the code so to only use this type of exit.
There's also an additional feature which you can enable its visuals, the Distance Zone , is to help measuring price distance to our xHMA+. It's just a simple atr based envelope really, I already put the sample code in study's comment section, but better gonna update it there directly for non-coder too, after this.
In this sample I use Lot for order quantity size just because that's what I use on my broker. Also what few friends use while we forward-testing it since the study is published, so we also checked/compared each profit/loss report by real number. To use default or other unit of measurement, change the entry code accordingly.
If you change your order size, you should also change the commission in Properties Tab. My broker commission is 5 USD per order/lot, so in there with example order size 0.1 lot I put commission 0.5$ per order (I'll put 2.5$ for 0.5 lot, 10$ for 2 lot, and so on). Crypto usually has higher charge. --It is important that you should fill it base on your broker.
SETTINGS
I'm trying to keep it short. Please explore it further again. (Beginner should also first get acquaintance with terms use here.)
ORDERS:
Base Minimum Profit Before Exit:
The number is multiplier of ongoing ATR. Means that when basic exit condition is met, algo will check whether you're already in minimum profit or not, if not, let it still run to TP or SL, or until it meets subsequent exit condition, then it will check again.
Default Target Profit:
Multiplier of ATR at signal. If reached before any eligible exit condition is met, exit TP.
Base StopLoss Point:
You can change directly in code to use other like ATR Trailing SL, fix percent SL, or whatever. In the sample, 4 options provided.
Maximum StopLoss:
This is like a safety-net, that if at some point your chosen SL point from input above happens to be exceeding this maximum input that you can tolerate, then this max point is the one will be use as SL.
Activate 2nd order...:
The additional doubling of certain buy/sell with different exits as described above. If enable, you should also set pyramiding to at least: 2. If not, it does nothing.
ADAPTIVE HMA+ PERIOD
Many users already have their own settings for these. So in here I only sample the default as first presented in the study. Make it to your adaptive.
MARKET MOVEMENT
(1) Now you can check in realtime how much slope degree is best to define your specific pair/tf is out of congestion (yellow) area. And (2) also able to check directly what ATR lengths are more suitable defining your pair's volatility.
DISTANCE ZONE
Distance Multiplier. Each pair/tf has its own best distance zone (in xHMA+ perspective). The zone also determine whether a signal should appear or not. (Or what type of signal, if you wanna go more detail in constructing your strategy)
USAGE
(Provided you already have your own comfortable settings for minimum-maximum period of Adaptive HMA+. Best if you already have backtested it manually too and/or apply as an add-on to your working strategy)
1. In our experiences, first most important to define is both elements in the Market Movement Settings . These also tend to be persistent for whole season since it's kinda describing that pair/tf overall behaviour. Don't worry if you still get a low Profit Factor here, but by tweaking you should start to see positive changes in one of Max Drawdown and Net Profit, or Percent Profitable.
2. Afterwards, find your pair/tf Distance Zone . When optimising this, what we seek is just a "not to bad" equity curves to start forming. At least Max Drawdown should lessen more. Doesn't have to be great already, but should be better, no red in Net Profit.
3. Then go manage the "Trailing Minimum Profit", TP, SL, and max SL.
4. Repeat 1,2,3. 👻
5. Manage order size, commission, and/or enable double-order (need pyramiding) if you like. Check if your equity can handle max drawdown before margin call.
6. After getting an acceptable backtest result, go to List of Trades tab and find the biggest loss or when many sequencing loss in a row happened. Click on it to go to exact point on chart, observe why the signal failed and get at least general idea how it can be prevented . The rest is yours, you should know your pair/tf more than other.
You can also re-explore your minimum-maximum period for both Major and minor xHMA+.
Keep in mind that all numbers in Setting are conceptually in a form of range . You don't want to get superb equity curves but actually a "fragile" , means one can easily turn it to disaster just by changing only a fraction in one/two of the setting.
---
If you just wanna test the strength of the indicator alone, you can disable "Use StopLoss" temporarily while optimising settings.
Using no SL might be tempting in overall result data in some cases, but NOTE: It is not recommended to not using SL, don't forget that we deliberately enter when it's in high volatility. If want to add flexibility or trading for long-term, just maximise your SL. ie.: chose SL Point>ATR only and set it maximum. (Check your max drawdown after this).
I think this is quite important specially for beginners, so here's an example; Hypothetically in below scenario, because of some settings, the buy order after the loss sell signal didn't appear. Let's say if our initial capital only 1000$ using leverage and order size 0,5 lot (risky position sizing already), moreover if this happens at the beginning of your trading season, that's half of account gone already in one trade . Your max SL should've made you exit after that pumping bar.
The Trailing Minimum Profit is actually look like this. Search in the code if you want to plot it. I just don't like too many lines on chart.
To maximise profit we can try enabling double-order. The only added rule coded is: RSI should rising when buy and falling when sell. 2nd signal will appears above or below default buy/sell signal. (Of course it's also prone to double-loss, re-check your max drawdown after. Profit factor play its part in here for a long run). Snapshot in comparison:
Two default sell signals on left closed at RSI exit, the additional sell signal closed later on when price crossover minor xHMA+. On buy side, price haven't met our minimum profit when first crossunder minor xHMA+. If later on we hit SL on this "+buy" signal, at least we already profited from default buy signal. You can also consider/treat this as multiple TP points.
For longer-term trading, what you need to maximise is the Minimum Profit , so it won't exit whenever an exit condition happened, it can happen several times before reaching minimum profit. Hopefully this snapshot can explain:
Notice in comparison default sell and buy signal now close in average after 3 days. What's best is when we also have confirmation from higher TF. It's like targeting higher TF by entering from smaller TF.
As also mention in the study, we can still experiment via original HMA by putting same value for minimum-maximum period setting. This is experimental EU 1H with Major xHMA+: 144-144, Flat market 13, Distance multiplier 3.6, with 2nd order activated.
Kiwi was a bit surprising for me. It's flat market is effectively below 6, with quite far distance zone of 3.5. Probably because I'm using big numbers in adaptive period.
---
The result you see in strategy tester report below for EURUSD 15m is using just default settings you see in code, as follow:
0,1 lot for each order (which is the smallest allowed by my broker).
No pyramiding. Commission: 0.5 usd per order. Slippage: 3
Opening position is only using basic strategy #1 (RSI exit). Additional exit not activated.
Minimum Profit: 1. TP: 3.
SL use: Half-distance zone. Max SL: 4.5.
Major xHMA+: 172-233. minor xHMA+: 89-121
Distance Zone Multiplier: 2.7
RSI: Standard 14.
(From our forward-testing, the difference we get from net profit is because of the spread, our entry isn't exactly at the close/open price. Not so much though, but not the same. If somebody can direct me to any example where we can code our entry via current bid/ask price, that would be awesome!)
It's already a long post (sorry), think I'm gonna pause here. Check out the code :)
---
DISCLAIMER: Past performance is no guarantee of future results , and so on.. you know the drill ;)
Please read whole description first before using, don't take 1-2 paragraph and claim it's the whole logic, you are responsible of your own actions and understanding.
The Trend Oracle - The Ultimate Position ToolThe Trend Oracle is a superadaptive multi-timeframe Indicator
Ideal timeframes are 4H, and 1D
It is based on a combination of several other indicators including:
- The Superstrength Index - An adaptive indicator using volume weighted average of the traditional RSI, MFI and OBV
- The Superfast MACD - An adaptive zero lag MACD
- ADX Trend - A tweaked version of the ADX
- Chop Zones - A combination of 2 Chop indexes to identify trending and non trending conditions.
- The Adaptive Supertrend - An adaptive version of the Supertrend, (switching multipliers based on the market trend)
- Breakout & Breakdown - An algorithm computing volume compression and expansion to indicate breakout & breakdown signals.
- [bBullish and Bearish Divergences - Confirmed Bull and Bear divs shown as green and red dots at the top and bottom of the indicator.
Areas highlighted in Aqua are bullish, red are bearish.
Use this indicator as a tool to position yourself over longer timeframes.
Enjoy!
MM :)
Dominant Cycle Adaptive MACDThis Indicator is based on classic MACD but with an exceptional smoothing.
This smoothing eliminates the noise of the classic MACD as you see in the Chart
Adaptive MACD is compiled using with two adaptive moving averages, one adaptive to the dominant cycle and the other adaptive to twice the dominant cycle. As the basic behind the MACD is the difference of two moving averages we cannot find much difference between the conventional MACD (12, 26) and the adaptive MACD. However the adaptive MACD is less prone for less whipsaws and it catches the trends very well at the same time the catches the turning points in time. The Adaptive MACD is definite one notch better than the conventional MACD.
Dominant Cycle Period is calculated using Ehler's Method {Mentioned in the code}
This is how the Adaptiveness Impacts the Price Chart
1. (12, 26 EMA) VS Adaptive Dominant Cycle EMA
2. See how the Adaptive Lengths {both FastLength and SlowLength changes with time!}
Enjoy!
Adaptive Double EMA StochInspired from the Works of Double Smoothed Stochastic by Walter Bressert,
I present to you!
Adaptive Double EMA Stoch Which Performs adaptively to the volumetric trends,
So the Green and Red Area Regions which you over the Stoch Indicator is the direction in which you should trade, These Areas are formed by a volumetric adaptive stoch, of adaptive period determined by the crosses of VWMA 55 and VWMA 200
The blue line is a stationary fixed length Double EMA Stoch of length 14,
How to Trade
1. Get the Status of the Trend : green area, for Bullish and red for Bearish from adaptive stoch
2. Check for the First Overbought (of stationary Stoch / blue line above 80) in Bearish Trend to go short
and similarly first Oversold (blue line below 20) in Bullish Trend to go long!
Enjoy!
MACD Price Projected Bands [MPPB] Strategy for NIFTY / BTC 2 minMACD Price Projected Bands is an intraday NON REPAINTING Strategy to be used over BTCUSD and NIFTY on 2mins charts for optimum results!!
How the Strategy works
The strategy uses MACD with standard configuration as its main component.
The adaptive Bands are calculated over the MACD lookback, and MACD crosses of the adaptive bands are projected over the Price for creating a decision logic
A cyclic Trend Filter is used to calculate the Optimum Entry and Exit Points for the Strategy,
Levels are also plotted over the price projected bands for better visualisation of the targets!
What is used !
Macd_config : { fast:12 , slow:26 , signal:9 }
Lookback Length : 55
The Strategy has Provision for Alerts
You get Two signals
1. MPPBS Buy Signal
2. MPPBS Sell Signal
How the Visual Target System Works and How to trade Using this Strategy
An Adaptive Projected Band is constructed using MACD for traders to get Visual inputs regarding targets!!
The Trading Methodologies are in below Charts
For Short Trades
For Long Trades
Strategy Configurations for Backtest
For Englishmen!
The Backtesting Rules in the Strategy calculates only when order gets filled, the basic pyramiding in the strategy is set to 1, i.e The maximum number of entries allowed in the same direction is set to 1,
Also we trade only 1 quantity of the security with initial capital of 100000USD, and The commission type used in the strategy is set to 0.05 USD that means we pay 0.05USD as commissions in every trade!
For Coders!
{
calc_on_order_fills=true,
pyramiding=1,
default_qty_type=strategy.fixed,
default_qty_value=1,
initial_capital=100000,
currency=currency.USD,
commission_type= strategy.commission.cash_per_order,
commission_value = 0.05
}
How can you get access
Only do private message to me, donot use comment box for requesting access!
Self-Optimising MACD (Experimental)Hi guys, just thought I'd share a small part of an idea i've been working on.
One of the biggest problems with algo trading is optimisation and finding a way to constantly adapt to the market conditions as time unfolds.
First of all... You should NEVER EVER trade just using a MACD, including this study, and I only produced this script in a small amount of time, so make sure you backtest it properly before using it. When backtesting, it is my advice that your sample size should be at least 5000 trades, but I recommend 10000 in order to get sufficient statistical significance.
Also, I am not a financial advisor, and any trading based decisions are your sole responsibility.
Anyways...
This script is simple... it simply uses 4 different MACD's and tracks their profit/loss and automatically uses the one with the most historical profit at any given time to execute a trade. The type of MACD will obviously change as market states fluctuate.
Included are : Hull MACD, Ema MACD, Sma MACD and VWMA Macd.
You can adjust all four of their settings to your desire.
The trade execution is simple and definitely flawed... it simply tracks the MACD when it has a crossover for long, and then the opposite for short.
The green line represents the performance of the top MACD for Longs at any given time. This line refreshes once a year, and where it is in relation to price, reflects how profitable it has been I.e - the higher it is the better.
The Red line represents the performance on the Short side, and again, it reflects profit/loss, but this time the LOWER the line is in relation to price the better.
There is no exit strategy in place! This is why I do NOT recommend trading off this script alone, but to use it as a tool to help optimise your choice of MACD.
However, your exit strategy could change your optimal choice of MACD, so keep that in mind.
The lookback period represents how far the script will track the performance at any given time. This will change your results. The longer the period, the more it will show long term success and vice versa.
This optimisation process could be done with different indicators, moving averages, or even multiple strategies to find the most statistically viable option at any given time... if you wish to have this process coded into your strategies or indicators, message me.
Enjoy.
ATR Stop (Adaptive and Advanced)Hi everyone I am excited to share with you all a tool that has been in a lot of my research lately I and think would greatly benefit everyone.
In the last years I have fallen in love with ATR stoplosses/ stop and reverses. However all the ones offered in the community lacked the features that I wanted to have, so I built them all myself and want to share them with you all today!!!
Assuming that you are already familiar with ATR stops, here is what is new and improved with this version:
1. This script takes anything as an input! As you can see in the chart above I have used an EMA as an input into this script and this greatly smoothed out the results while still allowing for phenomenal entries with minimal whiplash. You can use this tool on anything now, from moving averages to oscillators.
2. Previous scripts were not adaptive, you can now choose how adaptive this script is! Increasing this number allows this ATR stop to follow price when it is running away so you don't have to give back much profit. Likewise it makes sure that the ATR stop slows down when the market is ranging so you wont get randomly stopped out.
3. You can now get it to start at the exact moment you enter your trade! Previous scripts had the ATR stop running forever which wasn't helpful if you only needed it for your own trades. You can now set it to start at the exact time of your trade if that is the only time you need it!
4. Now you can easily get alerts when the ATR stop gets hit.
Hope this helps you all!
[blackcat] L2 Ehlers DFT-Adapted RSILevel: 2
Background
John F. Ehlers introuced his DFT-ADAPTED RELATIVE STRENGTH INDEX (RSI) in Jan, 2007.
Function
In "Fourier Transform For Traders" in Jan, 2007, John Ehlers presented an interesting technique of improving the resolution of spectral analysis that could be used to effectively measure market cycles. Better resolution is obtained by a surprisingly simple modification of the discrete Fourier transform. John Ehlers suggests using the discrete Fourier transform (DFT) to tune indicators. Here, I demonstrate this by building a DFT-adapted relative strength index (RSI) strategy.
Rather than display the RSI for a single cycle length across the entire chart, Ehlers DFT adaptive RSI value reflects the DFT-calculated dominant cycle length RSI. If the dominant cycle changes from 14 to 18 bars, the RSI length parameter changes accordingly. Computationally, this requires the strategy to continuously update values for all possible RSI cycle lengths via a "for" loop and array.
In details, a full-featured formula that implements a high-pass filter (HP) and a six-tap low-pass finite impulse response (FIR) filter on input, then does discrete Fourier transform calculations. I has taken liberty of adding extra parameters so the user can modify the analysis window length and the high-pass filter cutoff frequency in real time using the parameters window. Once the suite of possible RSI values is calculated, we use the DFT to select the relevant RSI for the current bar. The strategy then trades according to J. Welles Wilder's original rules for the RSI.
Key Signal
fastline--> DFT-ADAPTED RELATIVE STRENGTH INDEX (RSI) fast line
slowline--> DFT-ADAPTED RELATIVE STRENGTH INDEX (RSI) slow line
Pros and Cons
100% John F. Ehlers definition translation, even variable names are the same. This help readers who would like to use pine to read his book.
Remarks
The 71th script for Blackcat1402 John F. Ehlers Week publication.
Based on original work of Ehlers, I added ALMA smoothing on DFT-adapted relative strength index (RSI) so that clearer trend can be observed.
Readme
In real life, I am a prolific inventor. I have successfully applied for more than 60 international and regional patents in the past 12 years. But in the past two years or so, I have tried to transfer my creativity to the development of trading strategies. Tradingview is the ideal platform for me. I am selecting and contributing some of the hundreds of scripts to publish in Tradingview community. Welcome everyone to interact with me to discuss these interesting pine scripts.
The scripts posted are categorized into 5 levels according to my efforts or manhours put into these works.
Level 1 : interesting script snippets or distinctive improvement from classic indicators or strategy. Level 1 scripts can usually appear in more complex indicators as a function module or element.
Level 2 : composite indicator/strategy. By selecting or combining several independent or dependent functions or sub indicators in proper way, the composite script exhibits a resonance phenomenon which can filter out noise or fake trading signal to enhance trading confidence level.
Level 3 : comprehensive indicator/strategy. They are simple trading systems based on my strategies. They are commonly containing several or all of entry signal, close signal, stop loss, take profit, re-entry, risk management, and position sizing techniques. Even some interesting fundamental and mass psychological aspects are incorporated.
Level 4 : script snippets or functions that do not disclose source code. Interesting element that can reveal market laws and work as raw material for indicators and strategies. If you find Level 1~2 scripts are helpful, Level 4 is a private version that took me far more efforts to develop.
Level 5 : indicator/strategy that do not disclose source code. private version of Level 3 script with my accumulated script processing skills or a large number of custom functions. I had a private function library built in past two years. Level 5 scripts use many of them to achieve private trading strategy.
72s: Adaptive Hull Moving Average+One challenging issue for beginner traders is to differentiate market conditions, whether or not the current market is giving best possibility to stack profits, as earliest, in shortest time possible, or not.
On intraday, we've seen some big actions by big banks are somewhat can be defined --or circling around-- by HMA 200 . I've been thinking on to make the visuals more conform to price dynamics (separating major movement and minor noise) to get clearer signs of when it starts to happen. So it will be easier to see in a glance when the strength starts really taken place, with less cluttered chart.
This Adaptive HMA is using the new Pine Script's feature which now support Dynamic Length arguments for several Pine functions. ( read: www.tradingview.com). It hasn't support the built-in HMA() directly, but thankfully we can use its wma() formula to construct. (Note: I tweaked a bit HMA formula already popular here by using plain int() instead of round() on its wma's length, since I find it precisely match tradingview's built-in HMA).
You can choose which aspect the Adaptive HMA period will adapt to.
In this study I present it with two options: Volume and Volatility . It will "moves" faster or slower depends on which situation the aspect is currently into. ie: When volume is generally low or volatile readings is not there, price won't move very much, so the adapting MA will slow down by dynamically lengthen the lookback period, and vice versa, and so on.
Colour-markings in the Adaptive resembles which situation explained above. In addition, I also combine it with slope calculation of the MA to help measuring trend-strength or sideway/choppy conditions.
This way when we use it as dynamic support/resistance it will be more visually-reliable.
Secondly, and more important, it might help us traders with better probability info of whether or not a trade should even worth to be made . ie: If in the mean time market won't give much movement, any profit would also only as much. In most cases, we might better save our dime for later or place it somewhere else.
HOW TO USE:
Aside from better dynamic support/resistance and clearer breakout confirmation, MA is coloured as follow:
YELLOW:
Market is in consolidation or flat. Be it sideways, choppy, or in relatively small movements. If it shows up in a trending market, it may be an earlier sign that current trend might about to change its direction, or confirming a price broke-out to another side.
LIGHT GREEN or LIGHT RED:
Tells if a trend is forming but still relatively weak (or getting weaker), as it doesn't have volume or volatility to support.
DARKER GREEN ot DARKER RED:
This is where we can expect some good and strong price movement to ride. If it's strong enough, many times it marks a start of new long-lasting major trend.
SETTINGS:
Charger:
Choose which aspect your HMA should plug itself into, thus it will adapt to it.
Minimum Period, Maximum Period:
172 - 233 is just my own setting to outmatch the static HMA 200 for intraday. I find it --in my style of trading-- best in 15m tf in almost any pair, and 15m to 1H for some stocks. It also works nicely with conventional EMA 200, sometimes as if they somewhat work hand-in-hand in defining where the price should go. But you can, ofcourse, experiment with other ranges, broader or narrower. Especially if you already have an established strategy to follow to. As you might do with:
Consolidation area threshold:
This has to do with slope calculation. The bigger the number means your MA needs bigger degree to define the market is out of flat (yellow) area. This can be useful if needed to lighten up the filter or vice-versa.
Background colouring:
Just another colouring to help highlighting the difference in market conditions.
ALERTS:
There are two alerts:
Volume Break: when volume is breaking up above average, and
Volatility Meter: when the market more likely is about to have its moment of the big wiggling brush.
USAGE:
Very very nice BUY entry to catch big up-movement if:
1. Price is above MA. (It is best when price is also not to far distance from the MA, or you can also use distance oscillator to help out too)
2. HMA's color is in darker green. Means it's on the charging plug with your chosen aspect.
3. RSI is above 50. This is to help as additional confirmation.
Clear SELL entry signal is same as above, just the opposite.
-------------------------------------------------------
Note:
Lower timeframe of course means more noise to be filtered. Depends on the instrument, you might need to tweak the settings a bit till it conform nicely and shows lots of good trades in history. Here's another example on GBPUSD 5m timeframe:
For exit/take-profit point, you can use a second faster period static HMA. Or you can also use RSI. Here's an example:
Don't get me wrong, on few occasions I found it's still best using static MA to spot fakeouts, breakouts, etc, especially ones that's been already use widely. If that's the case or price actions seems suspicious, simply put the same value for minimum and maximum period settings, and there you have the original HMA with extra features.
For developer, check in the code if you need to customise your own charger.
-------------------------------------------------------
That's it. Hopefully this Adaptive HMA+ could at least be a good sidekick to your own strategy, as it does mine. ;)
Ehlers Adaptive Commodity Channel Index V1 [CC]The Adaptive Commodity Channel Index V1 was created by John Ehlers (Rocket Science For Traders pgs 236-237) and this is the typical Commodity Channel formula with the introduction of adaptive lengths based on his earlier work with indicators such as the Mother of Adaptive Moving Averages. For longer term signals you would get a bullish signal when CCI is above 0 and a bearish signal when CCI falls below 0. For shorter term signals you would get a bullish signal when crosses over it's overbought level or when it crosses above it's oversold level or vice versa. I have included both signals to make it easier.
Let me know if you want a custom script written or if you have a special request for me
Ehlers Adaptive Relative Vigor Index [CC]The Adaptive Relative Vigor Index was created by John Ehlers (Cybernetic Analysis For Stocks And Futures pgs 140-141) and it does a pretty good job of capturing the peaks and valleys of the underlying data. There are several ways to read this particular indicator so for long term trades then buy when it goes above 0 and sell when it falls below 0 or for shorter term trades then buy when the indicator line turns green and sell when it turns red.
Let me know if there are other indicators you would like to see me publish or if you want something custom done!
MESA Adaptive Moving Average - MTF and Divergence analysisThe latest iteration of the MESA Adaptive Moving Average - rewritten to make use of Pinescript v4 Arrays.
Explanation of settings and example use cases:
Fast Limit: Lower values will reduce the reactivity of the MA to rapid price changes.
- For instance, if you want to ignore price spikes on a low timeframe, then reduce Fast Limit
Slow Limit: Lower values will reduce the reactivity of the MA to slow price changes.
- For instance, if you want the MA to ignore small retracements during a trend, then reduce Slow Limit
Show MESA for next higher timeframe: Display the MA of the next standard timeframe that TV offers.
- Displays 3min if the chart timeframe is 1min. Displays D if the chart timeframe is 4H. Does not work with custom timeframes.
Show MESA for custom higher timeframe: Display a secondary MESA plot with a custom timeframe, selectable via the Custom Timeframe drop-down. Overrides the previous setting, if enabled. This functionality is experimental since it provides a higher sample rate than would normally be available. Take precautions making entries using only Custom Timeframe MESA.
- For instance, you made a decision on the 4H chart using MESA and are now watching the 15min to time a trade entry. Enable and select "4H" from the drop-down menu
Show Divergence between MESA Timeframes: Since divergence can differ greatly between assets, we form a baseline by continuously tracking the difference between the chart MA and higher timeframe MA. We note the maximum divergence in each direction (bullish and bearish). A white circle is plotted when divergence is close to the historical maximum. When a record-breaking divergence occurs, a yellow circle is plotted. You can tweak these indications by adjusting the Divergence Threshold %
- Multi-timeframe divergence is typically a weak indication of trend exhaustion, especially if Volume is not present.
Show Divergence between Source & MESA: Again, divergence can differ greatly between assets. This time, we form a baseline by continuously tracking the difference between the chart MA and Source (usually Close). We note the maximum divergence in each direction (bullish and bearish). A purple triangle is plotted when divergence is close to the historical maximum. When a record-breaking divergence occurs, a lime-green triangle is plotted. You can tweak these indications by adjusting the Divergence Threshold %
- Price divergence is a strong indicator of over-extension. It works well for timing reversals on intraday timeframes.
Source: The input data to perform MESA calculations on.
I've really enjoyed trading with this indicator, especially when combined with my previous two tools:
Empirical Suite : factors Trend, Price momentum, Volume, and Volatility
Squeeze Zone : provides a visual representation of volatility squeezes and attempts to predict breakout directions
Use this indicator to get a sense of overall trend, from any chart timeframe, as well as indications of over-extensions and exhaustion.