lib_Indicators_v2_DTULibrary "lib_Indicators_v2_DTU"
This library functions returns included Moving averages, indicators with factorization, functions candles, function heikinashi and more.
Created it to feed as backend of my indicator/strategy "Indicators & Combinations Framework Advanced v2 " that will be released ASAP.
This is replacement of my previous indicator (lib_indicators_DT)
I will add an indicator example which will use this indicator named as "lib_indicators_v2_DTU example" to help the usage of this library
Additionally library will be updated with more indicators in the future
NOTES:
Indicator functions returns only one series :-(
plotcandle function returns candle series
INDICATOR LIST:
hide = 'DONT DISPLAY', //Dont display & calculate the indicator. (For my framework usage)
alma = 'alma(src,len,offset=0.85,sigma=6)', //Arnaud Legoux Moving Average
ama = 'ama(src,len,fast=14,slow=100)', //Adjusted Moving Average
acdst = 'accdist()', //Accumulation/distribution index.
cma = 'cma(src,len)', //Corrective Moving average
dema = 'dema(src,len)', //Double EMA (Same as EMA with 2 factor)
ema = 'ema(src,len)', //Exponential Moving Average
gmma = 'gmma(src,len)', //Geometric Mean Moving Average
hghst = 'highest(src,len)', //Highest value for a given number of bars back.
hl2ma = 'hl2ma(src,len)', //higest lowest moving average
hma = 'hma(src,len)', //Hull Moving Average.
lgAdt = 'lagAdapt(src,len,perclen=5,fperc=50)', //Ehler's Adaptive Laguerre filter
lgAdV = 'lagAdaptV(src,len,perclen=5,fperc=50)', //Ehler's Adaptive Laguerre filter variation
lguer = 'laguerre(src,len)', //Ehler's Laguerre filter
lsrcp = 'lesrcp(src,len)', //lowest exponential esrcpanding moving line
lexp = 'lexp(src,len)', //lowest exponential expanding moving line
linrg = 'linreg(src,len,loffset=1)', //Linear regression
lowst = 'lowest(src,len)', //Lovest value for a given number of bars back.
pcnl = 'percntl(src,len)', //percentile nearest rank. Calculates percentile using method of Nearest Rank.
pcnli = 'percntli(src,len)', //percentile linear interpolation. Calculates percentile using method of linear interpolation between the two nearest ranks.
rema = 'rema(src,len)', //Range EMA (REMA)
rma = 'rma(src,len)', //Moving average used in RSI. It is the exponentially weighted moving average with alpha = 1 / length.
sma = 'sma(src,len)', //Smoothed Moving Average
smma = 'smma(src,len)', //Smoothed Moving Average
supr2 = 'super2(src,len)', //Ehler's super smoother, 2 pole
supr3 = 'super3(src,len)', //Ehler's super smoother, 3 pole
strnd = 'supertrend(src,len,period=3)', //Supertrend indicator
swma = 'swma(src,len)', //Sine-Weighted Moving Average
tema = 'tema(src,len)', //Triple EMA (Same as EMA with 3 factor)
tma = 'tma(src,len)', //Triangular Moving Average
vida = 'vida(src,len)', //Variable Index Dynamic Average
vwma = 'vwma(src,len)', //Volume Weigted Moving Average
wma = 'wma(src,len)', //Weigted Moving Average
angle = 'angle(src,len)', //angle of the series (Use its Input as another indicator output)
atr = 'atr(src,len)', //average true range. RMA of true range.
bbr = 'bbr(src,len,mult=1)', //bollinger %%
bbw = 'bbw(src,len,mult=2)', //Bollinger Bands Width. The Bollinger Band Width is the difference between the upper and the lower Bollinger Bands divided by the middle band.
cci = 'cci(src,len)', //commodity channel index
cctbb = 'cctbbo(src,len)', //CCT Bollinger Band Oscilator
chng = 'change(src,len)', //Difference between current value and previous, source - source .
cmo = 'cmo(src,len)', //Chande Momentum Oscillator. Calculates the difference between the sum of recent gains and the sum of recent losses and then divides the result by the sum of all price movement over the same period.
cog = 'cog(src,len)', //The cog (center of gravity) is an indicator based on statistics and the Fibonacci golden ratio.
cpcrv = 'copcurve(src,len)', //Coppock Curve. was originally developed by Edwin "Sedge" Coppock (Barron's Magazine, October 1962).
corrl = 'correl(src,len)', //Correlation coefficient. Describes the degree to which two series tend to deviate from their ta.sma values.
count = 'count(src,len)', //green avg - red avg
dev = 'dev(src,len)', //ta.dev() Measure of difference between the series and it's ta.sma
fall = 'falling(src,len)', //ta.falling() Test if the `source` series is now falling for `length` bars long. (Use its Input as another indicator output)
kcr = 'kcr(src,len,mult=2)', //Keltner Channels Range
kcw = 'kcw(src,len,mult=2)', //ta.kcw(). Keltner Channels Width. The Keltner Channels Width is the difference between the upper and the lower Keltner Channels divided by the middle channel.
macd = 'macd(src,len)', //macd
mfi = 'mfi(src,len)', //Money Flow Index
nvi = 'nvi()', //Negative Volume Index
obv = 'obv()', //On Balance Volume
pvi = 'pvi()', //Positive Volume Index
pvt = 'pvt()', //Price Volume Trend
rise = 'rising(src,len)', //ta.rising() Test if the `source` series is now rising for `length` bars long. (Use its Input as another indicator output)
roc = 'roc(src,len)', //Rate of Change
rsi = 'rsi(src,len)', //Relative strength Index
smosc = 'smi_osc(src,len,fast=5, slow=34)', //smi Oscillator
smsig = 'smi_sig(src,len,fast=5, slow=34)', //smi Signal
stdev = 'stdev(src,len)', //Standart deviation
trix = 'trix(src,len)' , //the rate of change of a triple exponentially smoothed moving average.
tsi = 'tsi(src,len)', //True Strength Index
vari = 'variance(src,len)', //ta.variance(). Variance is the expectation of the squared deviation of a series from its mean (ta.sma), and it informally measures how far a set of numbers are spread out from their mean.
wilpc = 'willprc(src,len)', //Williams %R
wad = 'wad()', //Williams Accumulation/Distribution.
wvad = 'wvad()' //Williams Variable Accumulation/Distribution.
}
f_func(string, float, simple, float, float, float, simple) f_func Return selected indicator value with different parameters. New version. Use extra parameters for available indicators
Parameters:
string : FuncType_ indicator from the indicator list
float : src_ close, open, high, low,hl2, hlc3, ohlc4 or any
simple : int length_ indicator length
float : p1 extra parameter-1. active on Version 2 for defining multi arguments indicator input value. ex: lagAdapt(src_, length_,LAPercLen_=p1,FPerc_=p2)
float : p2 extra parameter-2. active on Version 2 for defining multi arguments indicator input value. ex: lagAdapt(src_, length_,LAPercLen_=p1,FPerc_=p2)
float : p3 extra parameter-3. active on Version 2 for defining multi arguments indicator input value. ex: lagAdapt(src_, length_,LAPercLen_=p1,FPerc_=p2)
simple : int version_ indicator version for backward compatibility. V1:dont use extra parameters p1,p2,p3 and use default values. V2: use extra parameters for available indicators
Returns: float Return calculated indicator value
fn_heikin(float, float, float, float) fn_heikin Return given src data (open, high,low,close) as heikin ashi candle values
Parameters:
float : o_ open value
float : h_ high value
float : l_ low value
float : c_ close value
Returns: float heikin ashi open, high,low,close vlues that will be used with plotcandle
fn_plotFunction(float, string, simple, bool) fn_plotFunction Return input src data with different plotting options
Parameters:
float : src_ indicator src_data or any other series.....
string : plotingType Ploting type of the function on the screen
simple : int stochlen_ length for plotingType for stochastic and PercentRank options
bool : plotSWMA Use SWMA for smoothing Ploting
Returns: float
fn_funcPlotV2(string, float, simple, float, float, float, simple, string, simple, bool, bool) fn_funcPlotV2 Return selected indicator value with different parameters. New version. Use extra parameters fora available indicators
Parameters:
string : FuncType_ indicator from the indicator list
float : src_data_ close, open, high, low,hl2, hlc3, ohlc4 or any
simple : int length_ indicator length
float : p1 extra parameter-1. active on Version 2 for defining multi arguments indicator input value. ex: lagAdapt(src_, length_,LAPercLen_=p1,FPerc_=p2)
float : p2 extra parameter-2. active on Version 2 for defining multi arguments indicator input value. ex: lagAdapt(src_, length_,LAPercLen_=p1,FPerc_=p2)
float : p3 extra parameter-3. active on Version 2 for defining multi arguments indicator input value. ex: lagAdapt(src_, length_,LAPercLen_=p1,FPerc_=p2)
simple : int version_ indicator version for backward compatibility. V1:dont use extra parameters p1,p2,p3 and use default values. V2: use extra parameters for available indicators
string : plotingType Ploting type of the function on the screen
simple : int stochlen_ length for plotingType for stochastic and PercentRank options
bool : plotSWMA Use SWMA for smoothing Ploting
bool : log_ Use log on function entries
Returns: float Return calculated indicator value
fn_factor(string, float, simple, float, float, float, simple, simple, string, simple, bool, bool) fn_factor Return selected indicator's factorization with given arguments
Parameters:
string : FuncType_ indicator from the indicator list
float : src_data_ close, open, high, low,hl2, hlc3, ohlc4 or any
simple : int length_ indicator length
float : p1 parameter-1. active on Version 2 for defining multi arguments indicator input value. ex: lagAdapt(src_, length_,LAPercLen_=p1,FPerc_=p2)
float : p2 parameter-2. active on Version 2 for defining multi arguments indicator input value. ex: lagAdapt(src_, length_,LAPercLen_=p1,FPerc_=p2)
float : p3 parameter-3. active on Version 2 for defining multi arguments indicator input value. ex: lagAdapt(src_, length_,LAPercLen_=p1,FPerc_=p2)
simple : int version_ indicator version for backward compatibility. V1:dont use extra parameters p1,p2,p3 and use default values. V2: use extra parameters for available indicators
simple : int fact_ Add double triple, Quatr factor to selected indicator (like converting EMA to 2-DEMA, 3-TEMA, 4-QEMA...)
string : plotingType Ploting type of the function on the screen
simple : int stochlen_ length for plotingType for stochastic and PercentRank options
bool : plotSWMA Use SWMA for smoothing Ploting
bool : log_ Use log on function entries
Returns: float Return result of the function
fn_plotCandles(string, simple, float, float, float, simple, string, simple, bool, bool, bool) fn_plotCandles Return selected indicator's candle values with different parameters also heikinashi is available
Parameters:
string : FuncType_ indicator from the indicator list
simple : int length_ indicator length
float : p1 parameter-1. active on Version 2 for defining multi arguments indicator input value. ex: lagAdapt(src_, length_,LAPercLen_=p1,FPerc_=p2)
float : p2 parameter-2. active on Version 2 for defining multi arguments indicator input value. ex: lagAdapt(src_, length_,LAPercLen_=p1,FPerc_=p2)
float : p3 parameter-3. active on Version 2 for defining multi arguments indicator input value. ex: lagAdapt(src_, length_,LAPercLen_=p1,FPerc_=p2)
simple : int version_ indicator version for backward compatibility. V1:dont use extra parameters p1,p2,p3 and use default values. V2: use extra parameters for available indicators
string : plotingType Ploting type of the function on the screen
simple : int stochlen_ length for plotingType for stochastic and PercentRank options
bool : plotSWMA Use SWMA for smoothing Ploting
bool : log_ Use log on function entries
bool : plotheikin_ Use Heikin Ashi on Plot
Returns: float
Heikinashi
Awesome Heikin Ashi [Morty]This indicator uses Heikin Ashi candles and two EMAs to help you follow the trend and enter the trade. Heikin Ashi candles help to smooth the price and EMAs are used to detect trend. The default parameter of EMA is EMA10 and EMA20. You can use it at any timeframe. You should always adjust the EMA length according to different timeframes.
Features:
- Highlight background based on two EMAs
- Adjustable EMA length
- Adjustable Label size
- Show entry and exit signal labels
- Show stoploss price
- You can choose Long only or Short only or both signals
- Alert functions for notification
NOTE: If you use this signal to enter a trade, make sure the candle is close and enter in the next candle.
HTF Candles by DGThigher timeframe (multi timeframe) candles
a simple study introducing new pine function box.new
[jav] HeikinAshized OscillatorsThis script allows to HeikinAshize different commonly used centered oscillators.
It plots them like Heikin Ashi candles. In this way, we can eliminate some of the noise and uncertainty that is inherent to applying only one calculation period to the oscillators.
Applying Heikin Ashi to an oscillator might be advantageous compared to applying it directly to the chart, because you are not altering price readings. The obvious advantage is the clear visualization of the trend directions without noise.
INPUTS
The oscillators included are:
Relative Strength Index (RSI)
Stochastic
Stochastic RSI
Fisher transform
Inverse Fisher Transform of RSI (IFTRSI)
Commodity Channel Index (CCI)
Money Flow Index (MFI)
Chande Momentum Oscillator (CMO)
Momentum (MOM)
True Strength Index (TSI)
Williams' Percent Range (WPR).
Apart from the choice of one of these indicators, only two more inputs are required:
the main (median) period and
the % of variability of this period.
RESULTS
The script calculates 4 evenly spaced periods from that data (period and variability), e.g. for a period of 50 and a variability of 30%, the script calculates oscillator values for 4 different periods evenly spaced around 50, (35, 45, 55, 65) and uses these 4 values to draw the Heikin Ashi candle.
The script also plots the usual upper/lower (overbought/oversold) values, as well as the central line.
CREDITS
The interesting concept of applying Heikin Ashi to an oscillator was recently introduced in Tradingview by @JayRogers . Many thanks for the idea.
For Heikin Ashi calculations, the useful script by @allanster was taken as a reference.
Any improvements, modifications or suggestions are welcome.
Trend Indicator B-V2 (Momentum measuring)"Trend Indicator A-V2" and "Trend Indicator B-V2" are updated and improved versions of my initial trend indicators. Totally rethinking the code, adding highs and lows in the calculations, including some more customisation through colour schemes.
In practice, this indicator uses EMAs and Heikin Ashi to provide an overall idea of the trend.
The "Trend Indicator A-V2" is an overlay showing “Smoothed Heikin Ashi” .
The "Trend Indicator B-V2" uses the same values in a different way to measure the momentum of the trend and identify potential trend rejections.
Please, take into account that it is a lagging indicator.
Dziwne Trend Indicator A (EMA + Heikin Ashi cloud)First script ever publish.
It is a very simple trend indicator based on EMAs and Heikin Ashi .
HeikinAshi Fibonacci Retracement v2It draws Fib retracements based on the highest high measured when HeikinAshi candles are green, and lows based on when HeikinAshi candles are red.
The idea is that you can see the fib retracements based on HeikinAshi trends on a larger timeframe to help trade in smaller timeframes.
for v2 I reset the fib trace when a new high is set and also at the second green heikin candle. And I only show the last 20 bars of fib lines to avoid confusion and focus on the current trade.
Happy trading!
Heikin Ashi Candles - Actual CloseHeikin Ashi Candles - Actual Close is a simple script that instead of displaying Heikin Ashi Close it displays the actual close.
This script is a handy tool for anyone that wants to use Heikin Ashi candles that displays the real close. The coloring of the candles is still based on the Heikin Ashi calculations.
Enjoy.
QuantNomad - Heikin-Ashi PSAR AlertsUsing this script you can create alerts for my Heikin-Ashi PSAR Strategy:
When creating alerts use "Once Per Bar Close" in parameters.
####################
Disclaimer
Please remember that past performance may not be indicative of future results.
Due to various factors, including changing market conditions, the strategy may no longer perform as good as in historical backtesting.
This post and the script don’t provide any financial advice.
QuantNomad - Heikin-Ashi PSAR StrategyContinue experimenting with different combinations of strategies.
Here is the PSAR Strategy calculated based on HA candles. HA is already calculated inside the script, do not apply it to HA candles.
Strategy is calculated based on 25% equity invested with 0.1% commission.
####################
Disclaimer
Please remember that past performance may not be indicative of future results.
Due to various factors, including changing market conditions, the strategy may no longer perform as good as in historical backtesting.
This post and the script don’t provide any financial advice.
Ranged Volume - evoA simple script that shows mirrored regular volume bars with the purpose to show break-outs and low volume ranges, using highest and lowest of a few bars back.
Use Heikin Ashi function to smooth the colors with the trend.
Volume Moving Average - evoThis script shows regular volume bars with two separate moving averages using only bullish and only bearish candles. The moving average uses the last known value of its calculation.
Using the Heikin Ashi function will smooth the colors and moving averages (good for trends):
The crossovers are a good way to see what the dominant direction of a trend is, if you test them on your time frame and instrument they might be good to trade on their own, I have not tested this and the default settings are not tuned for that.
As always, let me know if you like it or found a good way to use it :)
Supertrend MTF Heikin AshiThis is non-repaiting Supertrend Multi Time Frame script, uses Heikin Ashi Candles as source on normal chart
There is an option for Higher Time Frame. if you choose "Auto" then Higher Time Frame calculation is made by the script. If you choose "User Defined" option and then you can select Time Frame.
You better use this script with other indicators such as RSI, Momentum etc.
Enjoy!
BERLIN CandlesA problem with Heikin Ashi is that while it gives you a great overview of overall direction, it is rarely possible to use it as a replacement for normal japanese
candlesticks. The reason for this is that actual price data is lost, since the candles are more akin to a moving average than a different way to see price action. Also, with Heikin Ashi, most of the actual price action is lost, because the candles can be bigger than the high and low of the underlying japanese candlestick.
With BERLIN Candles I have tried to fix that problem. By using a smoothed out version of the previous Heikin Ashi candle close as the current BERLIN Candle open, the high and low of the actual japanese candlestick for the high and low of the BERLIN Candle, and the current Heikin Ashi close as the BERLIN Candle close, while setting hard limits for BERLIN Candle open and close values so that they can never exceed the high and low of the underlying japanese candlestick.
One problem still persists though. The actual current price data is lost. However, the BERLIN Candles have solved this by adding a fifth part to the candles. The close of the underlying japanese candlesticks are indicated with a plus-sign. This way, actual price data is never lost, while keeping all of the other benefits of this type of candles.
A few added bonuses:
The addition of the 14 period ATR at the latest candle
The baseline from Ichimoku is included as an option
The 14 period ATR value of each candle can be seen in the indicator data as
the orange value
Heiken Ashi Triangles at the Top and Bottom of ScreenHeiken Ashi Triangles at the Top and Bottom of Screen
The image below shows the comparison to actual Heiken Ashi candles
(Though changing from candles to Heiken Ashi tends to smooth the triangles a little)
Real Candles Heikin Ashi (HA) Candle functionsThis script plots both real and HA candles regardless or which are used on the chart in TV settings.
(and has the functions for you to use.)
Lots of people seem to misunderstand backtesting (or scam people) based on HA candles.
Backtesting with HA candles leads to impossible trades. ALWAYS backtest with real candles.
That doesn't mean you might not want to look at HA candle values to make trading decisions.
Add the code below to calculate HA candles from real and use that in your HA trading algo,
but test it on real charts.
QuantNomad - Heikin Ashi Colors Higher TimeframeSimple script displaying color of Heiken Ashi candles from higher timeframes as a background.
EMA20 MA50 MA200 + T3-CCIEMA20 MA50 MA200 + T3-CCI
This combination of triple Moving Average and CCI is a strategy to be used in conjunction with Harmonical Patterns and Fibonacci Rations .
Heikin Ashi price can be used as the price source for the Moving Averages and the T3-CCI, instead of the real price.
Two instances of the indicator can be spawned to have both the triple MAs and the T3-CCI on the chart (L-Click on the Indicator > Move To > New Pane Below).
Alerts are available to warn of possible opportunities in the markets .
A single alert that can fire on both conditions can be set. It can also be used by other indicators, such as the Risk Management Wrapper .
Additional Technical Analysis is required to confirm the signals before opening a position.
This indicator is an update to MA50 EMA20 MA200 .
Heiken-Ashi CandlesSimple script to view Heiken-Ashi candles below a normal candles chart.
Could also be useful for using HA calcs in strategy scripts on normal candles chart for proper backtesting.
I adapted this to v4 from original v2 script by @samtsui. If you like please remember to give him a Thumbs Up for his original version! ->
Renko Bollinger StrategyIf you build Bollinger Bands from the values of Renko or Haken Ashi, then you can get an interesting strategy.
HeikinAshi - Candlestick % Difference This script shows the price difference ( %) between heikin ashi and candlestick for all investment instruments as Close, Open, High and Low. (Switchable )
In this way, you can see which instruments can easily use heikin ashi .
And by taking averages you can find the opportunity to compare which investment tools are more risk-free.
[RESEARCH] Heikin-Ashi Chart IdentifierA deterministic approach to identify Heikin-Ashi chart type.
The script checks the next statements about HA:
HA chart does not have any gaps in a classic sense
Every new HA open price is calculated using a specific recurrence formula. This fact also means that initial HA open price is used to calculate all the next and so on (a construction of Infinite Impulse Response filters)
The script works correctly being applied to other chart types:
Classic Candlestick
Range Bars
Line Break
Traditional Renko
ATR Renko
Traditional Point-and-Figure
ATR Point-and-Figure
Kagi
For special ones: this code allows you to check whether your script is being executed with Heikin-Ashi candles or not inside your script.
Ev sistr 'ta Laou!