EDMA Scalping Strategy (Exponentially Deviating Moving Average)This strategy uses crossover of Exponentially Deviating Moving Average (MZ EDMA ) along with Exponential Moving Average for trades entry/exits. Exponentially Deviating Moving Average (MZ EDMA ) is derived from Exponential Moving Average to predict better exit in top reversal case.
EDMA Philosophy
EDMA is calculated in following steps:
In first step, Exponentially expanding moving line is calculated with same code as of EMA but with different smoothness (1 instead of 2).
In 2nd step, Exponentially contracting moving line is calculated using 1st calculated line as source input and also using same code as of EMA but with different smoothness (1 instead of 2).
In 3rd step, Hull Moving Average with 2/3 of EDMA length is calculated using final line as source input. This final HMA will be equal to Exponentially Deviating Moving Average.
EDMA Defaults
Currently default EDMA and EMA length is set to 20 period which I've found better for higher timeframes but this can be adjusted according to user's timeframe. I would soon add Multi Timeframe option in script too. Chikou filter's period is set to 25.
Additional Features
EMA Band: EMA band is shown on chart to better visualize EMA cross with EDMA .
Dynamic Coloring: Chikou Filter library is used for derivation of dynamic coloring of EDMA and its band.
Trade Confirmation with Chikou Filter: Trend filteration from Chikou filter library is used as an option to enhance trades signals accuracy.
Strategy Default Test Settings
For backtesting purpose, following settings are used:
Initial capital=10000 USD
Default quantity value = 5 % of total capital
Commission value = 0.1 %
Pyramiding isn't included.
Backtesting data never assures that the same results would occur in future and also above settings use very less of total portfolio for trades, which in a way results less maximum drawdown along with less total profit on initial capital too. For example, increasing default quantity value will definity increase maximum drawdown value. The other way is also to use fix contracts in backtesting but it all depends on users general practice. Best option is to explore backtesting results with manually modified settings on different charts, before trusting them for other uses in future.
Usage and In-Detail Backtesting
This strategy has built-in option to enable trade confirmations with Chikou filter which will reduce the total number of trades increasing profit factor.
Symmetrically Weighted Moving Average (SWMA) on input source, may risk repainting in real-time data. Better option is to run a trade on bar close or simply left this optin unchecked.
I've set Chikou filter unchecked to increase number of trades (greater than 100) on higher timeframe (12H) and this can be changed according to your precision requirement and timeframe.
Timeframes lower than 4H usually have more noise. So its better to use higher EDMA and EMA length on lower timeframes which will decrease total number of offsetting trades increasing average total number of bars within a single trade.
Original "Exponentially Deviating Moving Average (MZ EDMA )" Indicator can be found here.
Adaptive
Exponentially Deviating Moving Average (MZ EDMA)Exponentially Deviating Moving Average (MZ EDMA) is derived from Exponential Moving Average to predict better exit in top reversal case.
EDMA Philosophy
EDMA is calculated in following steps:
In first step, Exponentially expanding moving line is calculated with same code as of EMA but with different smoothness (1 instead of 2).
In 2nd step, Exponentially contracting moving line is calculated using 1st calculated line as source input and also using same code as of EMA but with different smoothness (1 instead of 2).
In 3rd step, Hull Moving Average with 3/2 of EDMA length is calculated using final line as source input. This final HMA will be equal to Exponentially Deviating Moving Average.
EDMA Advantages
EDMA's main advantage is that in case of top price reversal it deviates from conventional EMA of 2*Length. This benefits in using EDMA for EMA cross with quick signals avoiding unnecessary crossovers. EDMA's deviation in case of top reversal can be seen as below:
EDMA presents better smoothened curve which acts as better Support and resistance. EDMA coparison with conventional EMA of 2*length of EDMA is as follows.
Additional Features
EMA Band: EMA band is shown on chart to better visualize EMA cross with EDMA.
Dynamic Coloring: Chikou Filter library is used for derivation of dynamic coloring of EDMA and its band.
Alerts: Alerts are provided of all trade signals. Weak buy/sell would trigger if EMA of 2*EDMA_length crosses EDMA. Strong buy/sell would trigger if EMA of same length as of EDMA crosses EDMA.
Trade Confirmation with Chikou Filter: Trend filteration from Chikou filter library is used as an option to enhance trades signals accuracy.
Defaults
Currently default EDMA and EMA1 length is set to 20 period which I've found better for higher timeframes but this can be adjusted according to user's timeframe. I would soon add Multi Timeframe option in script too. Chikou filter's period is set to 25.
Adaptive_LengthLibrary "Adaptive_Length"
This library contains functions to calculate Adaptive dynamic length which can be used in Moving Averages and other indicators.
Two Exponential Moving Averages (EMA) are plotted. Coloring in plot is derived from Chikou filter and Dynamic length of MA1 is adapted using Signal output from Chikou library.
dynamic(para, adapt_Pct, minLength, maxLength) Adaptive dynamic length based on boolean parameter
Parameters:
para : Boolean parameter; if true then length would decrease and would increase if its false
adapt_Pct : Percentage adaption based on parameter
minLength : Minimum allowable length
maxLength : Maximum allowable length
Returns: Adaptive Dynamic Length based on Boolean Parameter
auto_alpha(src, a) Adaptive length based on automatic alpha calculations from source input
Parameters:
src : Price source for alpha calculations
a : Input Alpha value
Returns: Adaptive Length calculated from input price Source and Alpha
Ehlers Median Average Adaptive Filter [CC]The Median Average Adaptive Filter was created by John Ehlers and this is another in my current series of undiscovered gems. I'm sure you are all saying but Franklin, Ehlers doesn't have any undiscovered gems but in this case you would be wrong. This was actually an indicator so buried on the internet that I had to use the wayback machine to find the original source code. Ehlers notoriously hates adaptive moving averages which is funny because he has made a decent amount of them. This is a very unique indicator that uses a while loop to adjust the length and I thought it deserved some extra recognition from the TV community. I have included strong buy and sell signals in addition to normal ones so strong signals are darker in color and normal signals are lighter in color. Buy when the line turns green and sell when it turns red.
Let me know if there are any other scripts or indicators you would like to see me publish!
action zone - ATR stop reverse order strategy v0.1 by 9nckACTION ZONE-ATR MOD v0.1 DOCUMENTATION
Overview
This tradingview pine script strategy is mainly created to enrich my coding skill. It is a combination of “CDC-ACTIONZONE” and my personal studies of trading techniques in various sources e.g.book, course or blog. This strategy purposefully built to connect with my automatic trading bot. However, It will be very useful to aid your trading routine by diminishing mental distraction which possibly leads to bad trades.
How does it work?
This strategy will do a basic simple thing that most traders do by creating entry signals on both sides long/short and also set the stop loss. Furthermore, It will also reverse the order (from long to short and vice versa (if long/short conditions are met). Finally, it will recalculate the stop loss/take profit price in every complete bar to increase the chance of winning and limit our loss.
Entry rules(Long/Short)
If you have no open order, an order will be created when a fast EMA crosses(up(long)/down(short) the slow EMA(It’s as simple as that).
If you have an open order, the current order will be (sold if long, covered if short) and the opposite side order will be created.
Exit and Reverse rules(Long/Short)
If fast EMA cross (DOWN(long), UP(short)), the current order will be closed, THE OPPOSITE SIDE ORDER WILL ALSO BE CREATED.
Risk management
FLEX STOP PRICE : initial value will be set at the bar which order created. It is a fast ema (+/-) MIDDLE ATR value.
If MIDDLE ATR value rises, it will be our new stop price.
If MIDDLE ATR value falls, stop price unchanged
If Price OVERBOUGHT(long)/SOLD(short), LOW of that bar will be a new stop price.
Minimum position hold period
In order to eliminate risk of repeatedly open, close orders in sideway trends. Minimum hold period must be passed to start exit our position. However, It always respects stop loss prices. The value refers to the number of bars.
MUST READ!!!
This strategy uses only MARKET ORDER. If you trade with a bot, make sure you choose only enormous market cap tokens.
This strategy is bi-direction strategy. It will work best in the DERIVATIVE market.
It was initially designed to compete in the cryptocurrency market which has very high volume and volatility.
I only use this strategy in 1HR (acceptable change rate, optimum trade frequency)
How (should) we use it?
Choose crypto future pairs (recommend only top 10-15 market volume pairs in Binance, let’s say 1000M+ trade value)
Choose your time frame (1H is strongly recommended)
Setup your portfolio profile (Setting->Properties) such as Initial cap, order size, commission. DO NOT USE CAL ON EVERY TICK IT WILL CAUSE REPAINTING AND YOUR CAPITAL IS BLEEDING !!!
BACKTEST FIRST!! Back test is a combination of art, math and statis(and a bit of luck). You can apply to train and test methods or whatever you are familiar with. In my opinion, your test period should include UPTREND, SIDEWAY, DOWNTREND. Fine tune fast, slow ema first(my best ema length of 1H timeframe around 7-10, 17-22). Try to eliminate fault breakout trade and use other options only necessary. Hopefully we can use automatic optimization on Pine Script soon.
Don’t forget to turn off using a specific backtest date option to start your strategy.A
THIS IS NOT A PERFECT (OR EVEN PROFITABLE) STRATEGY. USE AT YOUR OWN RISK AND TRADE RESPONSIBLY. DYOR DUDE.
Volume Adaptive Bollinger Bands (MZ VABB)This indicator is a functional enhancement to John Bollinger's Bollinger Bands. I've used Volume to adapt dynamic length which is used in basis (middle line) of Bollinger Bands and Simple Moving Average is replaced with Adaptive Ehlers Deviation Scaled Moving Average ( AEDSMA ).
BOLLINGER BANDS BASIC USAGE AND LIMITATIONS
Bollinger bands are popular among traders because of their simple way to detect volatility in market and redefine support and resistance accordingly. These are some basic usages of original Bollinger Bands:
Most commonly Bollinger Band works on 20 period Simple Moving Average as Basis / Middle Line and standard deviation of 2 for volatility detection.
Upper and lower bands can act as support and resistance which accordingly update with standard deviation of same period as of Simple Moving Average.
As upper and lower bands act as volatility measure which benefits in Squeeze detection and breakout trading.
Among all the usages there are some limitations as follows:
Original Bollinger Bands use 20 period Simple Moving Average as Basis which itself restricted to some number of data pints and if market moves in one direction or simply goes sideways for long time; candles can stay on either bands for long time. This gives benefit for staying in directional trade but will completely nullify the use of both bands as support and resistance.
Above point simply be explained as markets can stay overbought / oversold for long time and one way to make Bollinger Bands more useful is to simply use higher periods in SMA but as we know with higher periods SMA becomes more laggy and less adaptive.
Most traders use BBs alongside some other Volume Oscillator for example "On Balance Volume" but that does solve BBs limitations issue that it should be more adaptive to detect volatility in market.
VOLUME ADAPTIVE BOLLINGER BAND WORKING PRINCIPLE
Best way to make original Bollinger band more adaptive was to just use dynamic length instead on constant 20 period. This dynamic length had to be based on some other powerful parameter which can't be volatility as BB itself is a volatility indicator and adapting its length based volatility would have been superimposing volatility on Bollinger bands giving unrealistic results.
For adaptive length, I tried using Volume and for this purpose I used my Relative Volume Strength Index " RVSI " indicator. RVSI is the best way to detect if Volume is going for a breakout or not and based on that indication length of Bollinger Band Basis Moving Average changes.
RVSI breaking above provided value would indicate Volume breakout and hence dynamic length would accordingly make Bollinger band basis moving average more over fitted and similarly standard deviation of achieved dynamic length would give better bands for support and resistance. Similar case would happen if Volume goes down and dynamic length becomes more underfit.
According to my back testing studies I found that Simple Moving Average wasn't the best choice for dynamic length usage in Bollinger Band Basis. So, I used Adaptive Ehlers Deviation Scaled Moving Average ( AEDSMA ) which is more adaptive and already modified to adapt with RVSI.
SLOPE USAGE FOR TREND STRENGTH DETCTION
Volume Adaptive Bollinger Bands are more reactive to market trends so, I used slope for trend strength detection.
If slope of Volume Adaptive Bollinger Band Basis (i.e. AEDSMA ), Upper and Lower Bands is supporting a trend at same time then script will provide signal in that direction. That signal can also use Volume as confirmation if Bollinger Bands trend direction is supported by Volume or not.
DYNAMIC COLORS AND TREND CORRELATION
I’ve used dynamic coloring in Basis ( AEDSMA ) to identify trends with more detail which are as follows:
Lime Color: Slope supported Strong Uptrend also supported by Volume and Volatility or whatever you’ve chosen from both of them.
Fuchsia Color: Weak uptrend only supported by Slope or whatever you’ve selected.
Red Color: Slope supported Strong Downtrend also supported by Volume and Volatility or whatever you’ve chosen from both of them.
Grey Color: Weak Downtrend only supported by Slope or whatever you’ve selected.
Yellow Color: Possible reversal indication by Slope if enabled. Market is either sideways, consolidating or showing choppiness during that period.
SIGNALS
Green Circle: Market good for long with support of Volume and Volatility or whatever you’ve chosen from both of them.
Red Circle: Market good to short with support from Volume and Volatility or whatever you’ve chosen from both of them.
Flag: Market either touched upper or lower band and can act as good TP and warning for reversal.
FIBONACCI BANDS
I’ve included Fibonacci multiple bands which would act as good support/resistance zones. For example, 0.618 Fib level act as good local support and resistance in both upper and lower zones. Fibonacci values can be modified but should be lower than 1.
DEFAULT SETTINGS
I’ve set default Minimum length to 50 and Maximum length to 100 which I’ve found works best for almost all timeframes but you can change this delta to adapt your timeframe accordingly with more precision.
Dynamic length adoption is enabled based on Volume only but volatility can be selected which is already explained above.
Trend signals are enabled based on Slope and Volume but Volatility can be enabled for more precise confirmations.
In “ RVSI ” settings "Klinger Volume Oscillator" is set to default but others work good too especially Volume Zone Oscillator. For more details about Volume Breakout you can check “MZ RVSI Indicator".
ATR breakout is set to be positive if period 14 exceeds period 46 but can be changed if more adaption with volatility is required.
EDSMA super smoother filter length is set to 20 which can be increased to 50 or more for better smoothing but this will also change slope results accordingly.
EDSMA super smoother filter poles are set to 2 because found better results with 2 instead of 3.
FURTHER ENHANCEMENTS
So far, I've achieved better results with "Klinger Volume Oscillator" in RVSI but TFS Volume Oscillator and On Balance Volume can be used which would change dynamic length differently. It doesn't mean that results would be wrong with some oscillator and precise with others but every oscillator works in its specific way for and RVSI just detect strength of Volume based on provided oscillator.
Volume Adaptive Chikou Scalping StudyIDEA PLACEMENT
This indicator uses “Chikou” cross concept of Ichimoku cloud indicator and enhances usage of High/Low data with Volume Breakout and Volatility based dynamic adaption.
I’ve been working on making Moving Averages more adaptive based on Volume Breakout and Volatility but as we know Mas work better on close values. I wanted to create a study that may have maximum data available and that’s how I came up with the concept of making adaptive Ichimoku Cloud. Except, I used different concept than Ichimoku. As we know that Tenkan-sen and Kijun-sen from Ichimoku Cloud average out highest and lowest values within 26 and 9 period respectively but I tried making it Volume Breakout and Volatility based Adaptive but couldn’t get better results.
Along the way I came up with an idea of instead of averaging out just keeping the High/Low values data separate and intact and to do so I took Linear regression of High values of Volume Breakout and Volatility based Adaptive dynamic period and similarly with Low values.
Then the strategy was to use Chikou for crossover and crossunder indication and for this purpose I used Chikou with same dynamic length as used before in High/Low linear regression.
The idea becomes simple as when Adaptive Dynamic Chikou crosses Adaptive Dynamic Linear Regression of High/Low values then Lowest / Highest value within current Adaptive Dynamic Length becomes the next Support / Resistance.
SIGNALS
Not every Chikou cross would give signal instead signal should be supported by either Volume Breakout or Volatility whatever you have selected from.
FIBONACCI EVELOPE BANDS
I’ve included ATR based Fibonacci multiple bands which would act as good support/resistance zones.
DEFAULT SETTINGS
I’ve set default Minimum length to 20 and Maximum length to 50 which I’ve found works best for almost all timeframes but you can change this delta to adpat your timeframe accordingly with more precision.
Dynamic length adoption is enabled based on both Volume and Volatility but only one or none of them can also be selected.
Trend signals verification is enabled based on Volume but Volatility can also be enabled for more precise confirmations.
In “RVSI” settings TFS Volume Oscillator is set to default but others work good too especially Volume Zone Oscillator. For more details about Volume Breakout you can check “MZ RVSI Indicator”
ATR breakout is set to be true if period 14 exceeds period 46 but can be changed if more adaption with volatility is required.
FURTHER ENHANCEMENTS
I’ve used Linear Regression of High/Low values because I found better results with it but SMA and HMA can also be used. I’m planning to perpetually use this study for Dynamically length adaption and trades confirmations in other strategies.
Adaptive Ehlers Deviation Scaled Moving Average (AEDSMA)AEDSMA INTRODUCTION
This indicator is a functional enhancement to “Ehlers Deviation Scaled Moving Average (EDSMA / DSMA)”. I’ve used Volume Breakout and Volatility for dynamic length adaption and further Slope too for trend evaluation.
EDSMA was originally developed by John F. Ehlers (Stocks & Commodities V. 36:8: The Deviation-Scaled Moving Average).
IDEA PLACEMENT
I’ve traded almost every kind of market with different volatility conditions using Moving Averages. It was too much of a hassle to select and use different MA length depending upon market trend. So, the journey started with adapting Moving Averages with another parameter and that’s how “MZ SAMA ” came into being where Slope was used to adapt Adaptive Moving Average with trend change. The problem was still pretty much the same as SAMA might not be effective on every market condition. Hence, I worked on Volume to adapt Moving Averages accordingly. I cane up with “MZ RVSI ” which I used in “MZ DVAMA ” to adapt dynamic length in Adaptive Moving Average and also used “MZ RVSI " alongside Slope as confirmation of trend changes.
Meanwhile, I started using DVAMA methodology on different types on Moving Averages that allow dynamic length for example Hull Moving Average, Linear Regression Curve, SMA, WMA, TMA and many more. All of my tested Mas showed too much flexibility because of volume based Adaptive length.
I came across a script of “Adaptive Hull Moving Average” which pretty much used the similar methodology as DVAMA but when I looked into its depth, its volume oscillator wasn’t working at all and only volatility based dynamic length was used. It was an interesting idea so, I decided to use Volume and Volatility alongside for better results but was nearly impossible to achieve what I wanted using only Hull Moving Average.
I had been using EDSMA in “MA MTF Cross Strategy” and “MZ SRSI Strategy V1.0” previously. It was the perfect choice when comparing to usage of slope on it. DSMA works perfectly as support and resistance as its Deviation Scaled. So, I tried using it to adapt dynamic length based on Volume and Volatility and I wasn’t disappointed. It worked like a charm when I adapted dynamic length between 50 and 255.
DYNAMIC LENGTH BENEFITS
Dynamic length adaption methodology works in a way of adapting Relatively Lower Length leading toward overfitting if trend is supported by Volume and Volatility . Similarly, adapting Relatively Higher Length leading toward underfitting if trend isn’t supported by Volume and Volatility .
Dynamic length adaption makes Moving Average to work better for both Bull and Bear-runs avoiding almost every fake break-in and breakouts. Hence, adaptive MA becomes more reliable for breakout trading.
MA would be more useful as it would adapt almost every chart based on its Volume and Volatility data.
DYNAMIC COLORS AND TREND CORRELATION
I’ve used dynamic coloring to identify trends with more detail which are as follows:
Lime Color: Strong Uptrend supported by Volume and Volatility or whatever you’ve chosen from both of them.
Fuchsia Color: Weak uptrend only supported by Slope or whatever you’ve selected.
Red Color: Strong Downtrend supported by Volume and Volatility or whatever you’ve chosen from both of them.
Grey Color: Weak Downtrend only supported by Slope or whatever you’ve selected.
Yellow Color: Possible reversal indication by Slope if enabled. Market is either sideways, consolidating or showing choppiness during that period.
SIGNALS
Green Circle: Market good for long with support of Volume and Volatility or whatever you’ve chosen from both of them.
Red Circle: Market good to short with support from Volume and Volatility or whatever you’ve chosen from both of them.
Yellow Cross: Market either touched top or bottom ATR band and can act as good TP or SL.
EDSMA EVELOPE/BANDS: I’ve included ATR based bands to the Adaptive EDSMA which act as good support/resistance despite from main Adaptive EDSMA Curve.
DEFAULT SETTINGS
I’ve set default Minimum length to 50 and Maximum length to 255 which I’ve found works best for almost all timeframes but you can change this delta to adapt your timeframe accordingly with more precision.
Dynamic length adoption is enabled based on both Volume and Volatility but only one or none of them can also be selected.
Trend signals are enabled based on Slope and Volume but Volatility can be enabled for more precise confirmations.
In “ RVSI ” settings TFS Volume Oscillator is set to default but others work good too especially Volume Zone Oscillator. For more details about Volume Breakout you can check “MZ RVSI Indicator".
ATR breakout is set to be positive if period 14 exceeds period 46 but can be changed if more adaption with volatility is required.
EDSMA super smoother filter length is set to 20 which can be increased to 50 or more for better smoothing but this will also change slope results accordingly.
EDSMA super smoother filter poles are set to 2 because found better results with 2 instead of 3.
FURTHER ENHANCEMENTS
So far, I’ve seen better results with Volume Breakout and Volatility but other parameters such as Linear Slope of Particular MA, MACD, “MZ SRSI ”, a Conditional Uptrend MA or simply KDJ can also be used for dynamic length adaption.
I haven't yet gotten used to pine script arrays so, defining and using conditional operators is pretty much lazy programming for me. Would be great redefining everything through truth matrix instead of using if-else conditions.
Slope Adaptive Moving Average (MZ SAMA)INTRODUCTION
This script is inspired from "Vitali Apirine (Stocks & Commodities V.36:5: Adaptive Moving Averages)" and a correction to Dynamic Volume Adaptive Moving Average (MZ DVAMA) . I have used slope filtering in order to adapt trends more precisely for better trades.
Slope adaption makes it better for adaptive moving average to detect trend health; making it easier to make decisions based on market strong price momentums, consolidations or breakouts. This isn’t possible with only using simply Adaptive Moving Averages .
Adaptive Moving Averages curve doesn’t change its length based on Slope but it uses slope adaptive color for trend strength detection.
TREND DETECTION
Green Color:
Strong Uptrend with good price momentum.
Red Color:
Strong Downtrend.
Yellow Color:
Market is either choppy, sideways or consolidating. Better to avoid taking new positions and if trade is running then its good to carry it on.
DEFAULTS SETTINGS
AMA length is 200 (Better for timeframes higher than 1H)
Minor length is 6
Major length is 14
Slope period is set to 34 with 25 of initial range. Consolidation is always below 17.
ALERTS
Buy/Sell Alerts will follow on when slope is out of consolidation/choppiness area. Best entry is at absolute alerts timing but other trades can be started midway based on trend condition.
Dynamic Volume Adaptive Moving Average (MZ DVAMA)INTRODUCTION
This indicator is inspired from "Vitali Apirine (Stocks & Commodities V.36:5: Adaptive Moving Averages)" but I have used Volume filtering to in order to adapt trends more precisely for better trades.
Volume adaption makes it better for adaptive moving average to detect trend health; making it easier to make decisions based on market strong momentums, consolidations or breakouts. This isn’t possible with only using simply Adaptive Moving Averages .
Adaptive Moving Averages curve doesn’t change its length based on Volume but it uses dynamic volume adaptive color for trend strength detection.
TREND DETECTION
Green Color:
Strong Uptrend with good volume supported momentum.
Lime Color:
Uptrend is relatively weak but still good enough to follow.
Red Color:
Strong Downtrend with volume support.
Gray Color:
Downtrend is relatively weak but still good enough to follow.
Yellow Color:
Market is either choppy, sideways or consolidating. Better to avoid taking new positions and if trade is running then its good to carry it on.
DEFAULTS SETTINGS
AMA length is 200 (Better for timeframes higher than 1H)
Minor length is 6
Major length is 14
Volume RSI period is considered to be 200 with 50 period for its Hull Moving Average
ALERTS
Buy/Sell Alerts will follow on when volume is breaking up above provided value. Best entry is at absolute alerts timing but other trades can be started midway based on trend condition.
BTC Golden Bottom with Adaptive Moving AverageIntroduction:
This study uses Adaptive Moving Average with 1 year of length to plot on all time history Index Calculated by Tradingview . All previous $BTC bear runs bottomed on this curve which makes it important enough. Use this only on " "
Default Values:
AMA length is 1 year
Minor length is 50
Major length is 100
Range Adaptive EMA Float Series Inputuses range and change distance on arrays to allow for more control as well as any choice of input value as a controller for how tightly it grips the input signal.
Adaptive Relative Strength (ARS by Premal Parekh)Dear All,
This is my first public script modified to adapt the concept of Mr. Premal Parekh on Adaptive Relative Strength - ARS)
The original Script is developed by modhelius.
I have proved the version as per my requirement and included concept of ARS.
This script will remove the manual calculation task which is required on daily basis to calculate number of sessions from ARS Date.
Hope this script will be helpful.
If yes, do hit like button and share with your friends.
Ashish Kesarkar
India
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.
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.
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.
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!