OPEN-SOURCE SCRIPT

Indicators Combination Framework v3 IND [DTU]

Updated
Hello All,
This script is a framework to analyze and see the results by combine selected indicators for (long, short, longexit, shortexit) conditions.
I was designed this for beginners and users to facilitate to see effects of the technical indicators combinations on the chart WITH NO CODE
You can improve your strategies according the results of this system by connecting the framework to a strategy framework/template such as Pinecoder, Benson, daveatt or custom.
This is enhanced version of my previous indicator "Indicators & Conditions Test Framework [DTU]"
Currently there are 93 indicators (23 newly added) connected over library. You can also import an External Indicator or add Custom indicator (In the source)
It is possible to change it from Indicator to strategy (simple one) by just remarking strategy parts in the source code and see real time profit of your combinations
Feel free to change or use it in your source
Special thanks goes to Pine wizards: Trading view (built-in Indicators), RodriGo, @midtownsk8rguy, LazyBear, Daveatt and others for their open source codes and contributions

SIMPLE USAGE
1. SETTING: Show Alerts= True (To see your entries and Exists)
2. Define your Indicators (ex: INDICATOR1: ema(close,14), INDICATOR2: ema(close,21), INDICATOR3: ema(close,200)
3. Define Your Combinations for long & Short Conditions
a. For Long: (INDICATOR1 crossover INDICATOR2) AND (INDICATOR3 < close)
b. For Short: (INDICATOR1 crossunder INDICATOR2) AND (INDICATOR3 > close)
4. Select Strategy/template (Import strategy to chart) that you export your signals from the list
5. Analyze the best profit by changing Indicators values

SOME INDICATORS DETAILS
Each Indicator includes:
- Factorization: Converting the selected indicator to Double, triple Quadruple such as EMA to DEMA, TEMA QEMA
- Log: Simple or log10 can be used for calculation on function entries
- Plot Type: You can overlay the indicator on the chart (such ema) or you can use stochastic/Percentrank approach to display in the variable hlines range
- Extended Parametes: You can use default parameters or you can use extended (P1,P2) parameters regarding to indicator type and your choice
- Color: You can define indicator color and line properties
- Smooth: you can enable swma smooth
- indicators: you can select one of the 93 function like ema(),rsi().. to define your indicator
- Source: you can select from already defined indicators (IND1-4), External Indicator (EXT), Custom Indicator (CUST), and other sources (close, open...)

CONDITION DETAILS
- There are are 4 type of conditions, long entry, short entry, long exit, short exit.
- Each condition are built up from 4 combinations that joined with "AND" & "OR" operators
- You can see the results by enabling show alerts check box
- If you only wants to enter long entry and long exit, just fill these conditions
- If "close on opposite" checkbox selected on settings, long entry will be closed on short entry and vice versa

COMBINATIONS DETAILS
- There are 4 combinations that joined with "AND" & "OR" operators for each condition
- combinations are built up from compare 1st entry with 2nd one by using operator
- 1st and 2nd entries includes already defined indicators (IND1-5), External Indicator (EXT), Custom Indicator (CUST), and other sources (close, open...)
- Operators are comparison values such as >,<, crossover,...
- 2nd entry include "VALUE" parameter that will use to compare 1st indicator with value area
- If 2nd indicator selected different than "VALUE", value are will mean previous value of the selection. (ex: value area= 2, 2nd entry=close, means close[2])
- Selecting "NONE" for the 1st entry will disable calculation of current and following combinations

JOINS DETAILS
- Each combination will join wiht the following one with the JOIN (AND, OR) operator (if the following one is not equal "NONE")

CUSTOM INDICATOR
- Custom Indicator defines harcoded in the source code.
- You can call it with "CUST" in the Indicator definition source or combination entries source
- You can change or implement your custom indicator by updating the source code

EXTERNAL INDICATOR
- You can import an external indicator by selecting it from the ext source.
- External Indicator should be already imported to the chart and it have an plot function to output its signal

EXPORTING SIGNAL
- You can export your result to an already defined strategy template such as Pine coders, Benson, Daveatt Strategy templates
- Or you can define your custom export for other future strategy templates

ALERTS
- By enabling show alerts checkbox, you can see long entry exits on the bottom, and short entry exits aon the top of the chart

ADDITIONAL INFO
- You can see all off the inputs descriptions in the tooltips. (You can also see the previous version for details)
- Availability to set start, end dates
- Minimize repainting by using security function options (Secure, Semi Secure, Repaint)
- Availability of use timeframes
-

Version 3 INDICATORS LIST (More to be added):
▼▼▼ OVERLAY INDICATORS ▼▼▼
alma(src,len,offset=0.85,sigma=6).-------Arnaud Legoux Moving Average
ama(src,len,fast=14,slow=100).-----------Adjusted Moving Average
accdist().-------------------------------Accumulation/distribution index.
cma(src,len).----------------------------Corrective Moving average
dema(src,len).---------------------------Double EMA (Same as EMA with 2 factor)
ema(src,len).----------------------------Exponential Moving Average
gmma(src,len).---------------------------Geometric Mean Moving Average
highest(src,len).------------------------Highest value for a given number of bars back.
hl2ma(src,len).--------------------------higest lowest moving average
hma(src,len).----------------------------Hull Moving Average.
lagAdapt(src,len,perclen=5,fperc=50).----Ehlers Adaptive Laguerre filter
lagAdaptV(src,len,perclen=5,fperc=50).---Ehlers Adaptive Laguerre filter variation
laguerre(src,len).-----------------------Ehlers Laguerre filter
lesrcp(src,len).-------------------------lowest exponential esrcpanding moving line
lexp(src,len).---------------------------lowest exponential expanding moving line
linreg(src,len,loffset=1).---------------Linear regression
lowest(src,len).-------------------------Lovest value for a given number of bars back.
mcginley(src, len.-----------------------McGinley Dynamic adjusts for market speed shifts, which sets it apart from other moving averages, in addition to providing clear moving average lines
percntl(src,len).------------------------percentile nearest rank. Calculates percentile using method of Nearest Rank.
percntli(src,len).-----------------------percentile linear interpolation. Calculates percentile using method of linear interpolation between the two nearest ranks.
previous(src,len).-----------------------Previous n (len) value of the source
pivothigh(src,BarsLeft=len,BarsRight=2).-Previous pivot high. src=src, BarsLeft=len, BarsRight=p1=2
pivotlow(src,BarsLeft=len,BarsRight=2).--Previous pivot low. src=src, BarsLeft=len, BarsRight=p1=2
rema(src,len).---------------------------Range EMA (REMA)
rma(src,len).----------------------------Moving average used in RSI. It is the exponentially weighted moving average with alpha = 1 / length.
sar(start=len, inc=0.02, max=0.02).------Parabolic SAR (parabolic stop and reverse) is a method to find potential reversals in the market price direction of traded goods.start=len, inc=p1, max=p2. ex: sar(0.02, 0.02, 0.02)
sma(src,len).----------------------------Smoothed Moving Average
smma(src,len).---------------------------Smoothed Moving Average
super2(src,len).-------------------------Ehlers super smoother, 2 pole
super3(src,len).-------------------------Ehlers super smoother, 3 pole
supertrend(src,len,period=3).------------Supertrend indicator
swma(src,len).---------------------------Sine-Weighted Moving Average
tema(src,len).---------------------------Triple EMA (Same as EMA with 3 factor)
tma(src,len).----------------------------Triangular Moving Average
vida(src,len).---------------------------Variable Index Dynamic Average
vwma(src,len).---------------------------Volume Weigted Moving Average
volstop(src,len,atrfactor=2).------------Volatility Stop is a technical indicator that is used by traders to help place effective stop-losses. atrfactor=p1
wma(src,len).----------------------------Weigted Moving Average
vwap(src_).------------------------------Volume Weighted Average Price (VWAP) is used to measure the average price weighted by volume
▼▼▼ NON OVERLAY INDICATORS ▼▼
adx(dilen=len, adxlen=14, adxtype=0).----adx. The Average Directional Index (ADX) is a used to determine the strength of a trend. len=>dilen, p1=adxlen (default=14), p2=adxtype 0:ADX, 1:+DI, 2:-DI (def:0)
angle(src,len).--------------------------angle of the series (Use its Input as another indicator output)
aroon(len,dir=0).------------------------aroon indicator. Aroons major function is to identify new trends as they happen.p1 = dir: 0=mid (default), 1=upper, 2=lower
atr(src,len).----------------------------average true range. RMA of true range.
awesome(fast=len=5,slow=34,type=0).------Awesome Oscilator is an indicator used to measure market momentum. defaults : fast=len= 5, p1=slow=34, p2=type: 0=Awesome, 1=difference
bbr(src,len,mult=1).---------------------bollinger %%
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(src,len).----------------------------commodity channel index
cctbbo(src,len).-------------------------CCT Bollinger Band Oscilator
change(src,len).-------------------------A.K.A. Momentum. Difference between current value and previous, source - source[length]. is most commonly referred to as a rate and measures the acceleration of the price and/or volume of a security
cmf(len=20).-----------------------------Chaikin Money Flow Indicator used to measure Money Flow Volume over a set period of time. Default use is len=20
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(src,len).----------------------------The cog (center of gravity) is an indicator based on statistics and the Fibonacci golden ratio.
copcurve(src,len).-----------------------Coppock Curve. was originally developed by Edwin Sedge Coppock (Barrons Magazine, October 1962).
correl(src,len).-------------------------Correlation coefficient. Describes the degree to which two series tend to deviate from their ta.sma values.
count(src,len).--------------------------green avg - red avg
cti(src,len).----------------------------Ehler s Correlation Trend Indicator by
dev(src,len).----------------------------ta.dev() Measure of difference between the series and its ta.sma
dpo(len).--------------------------------Detrended Price OScilator is used to remove trend from price.
efi(len).--------------------------------Elders Force Index (EFI) measures the power behind a price movement using price and volume.
eom(len=14,div=10000).-------------------Ease of Movement.It is designed to measure the relationship between price and volume.p1 = div: 10000= (default)
falling(src,len).------------------------ta.falling() Test if the `source` series is now falling for `length` bars long. (Use its Input as another indicator output)
fisher(len).-----------------------------Fisher Transform is a technical indicator that converts price to Gaussian normal distribution and signals when prices move significantly by referencing recent price data
histvol(len).----------------------------Historical volatility is a statistical measure used to analyze the general dispersion of security or market index returns for a specified period of time.
kcr(src,len,mult=2).---------------------Keltner Channels Range
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.
klinger(type=len).-----------------------Klinger oscillator aims to identify money flow’s long-term trend. type=len: 0:Oscilator 1:signal
macd(src,len).---------------------------MACD (Moving Average Convergence/Divergence)
mfi(src,len).----------------------------Money Flow Index s a tool used for measuring buying and selling pressure
msi(len=10).-----------------------------Mass Index (def=10) is used to examine the differences between high and low stock prices over a specific period of time
nvi().-----------------------------------Negative Volume Index
obv().-----------------------------------On Balance Volume
pvi().-----------------------------------Positive Volume Index
pvt().-----------------------------------Price Volume Trend
ranges(src,upper=len, lower=-5).---------ranges of the source. src=src, upper=len, v1:lower=upper . returns: -1 source<lower, 1 source>=upper otherwise 0
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(src,len).----------------------------Rate of Change
rsi(src,len).----------------------------Relative strength Index
rvi(src,len).----------------------------The Relative Volatility Index (RVI) is calculated much like the RSI, although it uses high and low price standard deviation instead of the RSI’s method of absolute change in price.
smi_osc(src,len,fast=5, slow=34).--------smi Oscillator
smi_sig(src,len,fast=5, slow=34).--------smi Signal
stc(src,len,fast=23,slow=50).------------Schaff Trend Cycle (STC) detects up and down trends long before the MACD. Code imported from
stdev(src,len).--------------------------Standart deviation
trix(src,len) .--------------------------the rate of change of a triple exponentially smoothed moving average.
tsi(src,len).----------------------------The True Strength Index indicator is a momentum oscillator designed to detect, confirm or visualize the strength of a trend.
ultimateOsc(len.-------------------------Ultimate Oscillator indicator (UO) indicator is a technical analysis tool used to measure momentum across three varying timeframes
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.
willprc(src,len).------------------------Williams %R
wad().-----------------------------------Williams Accumulation/Distribution.
wvad().----------------------------------Williams Variable Accumulation/Distribution.

HISTORY[/B]
v3.01
ADD: 23 new indicators added to indicators list from the library. Current Total number of Indicators are 93. (to be continued to adding)
ADD: 2 more Parameters (P1,P2) for indicator calculation added. Par:(Use Defaults) uses only indicator(Source, Length) with library's default parameters. Par:(Use Extra Parameters P1,P2) use indicator(Source,Length,p1,p2) with additional parameters if indicator needs.
ADD: log calculation (simple, log10) option added on indicator function entries
ADD: New Output Signals added for compatibility on exporting condition signals to different Strategy templates.
ADD: Alerts Added according to conditions results
UPD: Indicator source inputs now display with indicators descriptions
UPD: Most off the source code rearranged and some functions moved to the new library. Now system work like a little bit frontend/backend
UPD: Performance improvement made on factorization and other source code
UPD: Input GUI rearranged
UPD: Tooltips corrected
REM: Extended indicators removed
UPD: IND1-IND4 added to indicator data source. Now it is possible to create new indicators with the previously defined indicators value. ex: IND1=ema(close,14) and IND2=rsi(IND1,20) means IND2=rsi(ema(close,14),20)
UPD: Custom Indicator (CUST) added to indicator data source and Combination Indicator source.
UPD: Volume added to indicator data source and Combination Indicator source.
REM: Custom indicators removed and only one custom indicator left
REM: Plot Type "Org. Range (-1,1)" removed
UPD: angle, rising, falling type operators moved to indicator library

Release Notes
Bug on mcginley(src,len) corrected
combinationconditionsframeworkMoving AveragesOscillatorstemplateTrend Analysis

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?

Disclaimer