Indicator · Pine Script v4 · Own pane

Linear Regression ADX Eyachay

by estebanvz

This indicator draws a combined bias in a separate pane, aimed at crypto charts.

View on GitHub

GitHub stars8on the repository
Pine versionv4older, still runs
Lines of code116
Settings12inputs
LicenceGPL-3.0
Last update4 years ago17 Feb 2022

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

116 lines of Pine Script v4 from linear_regression_adx.pine, published under GPL-3.0. Keep the author's credit and licence lines when you reuse it.

linear_regression_adx.pine
//@version=4
// Thanks to the nexts authors:
// LazyBear Code Monitor
// ADX v4 from BeikabuOyaji

study(title = 'Linear Regression ADX Eyachay', shorttitle = 'Eyachay')

// colorGreen = #00ff00
colorGreen = color.rgb(0,255,0,1)
colorRed = color.rgb(255,0,0,1)

colorDarkGreen = color.rgb(153, 167, 153)
colorDarkRed =     color.rgb(255, 175, 175)


colorGreenLR =color.rgb(62, 124, 23)
colorRedLR = color.rgb(174, 67, 30)

colorDarkGreenLR = color.rgb(62, 124, 23)
colorDarkRedLR =     color.rgb(174, 67, 30)        


colorWhite = color.rgb(150,150,150,1)
colorBlack = color.rgb(10,10,10,1)
buyColor= color.rgb(173,223,173,1)
sellColor= color.rgb(255,159,0,1)

buyColor2= color.rgb(173,223,173,50)
sellColor2= color.rgb(255,159,0,50)

showWT = input(false, title="Wave Trend")

lengthKC=input(20, title="LR Tamaño")
adxlen = input(14, title="ADX Suavizado")
th = input(23, title="ADX Límite")
nivel = input(title="Sensibilidad", defval="Basico", options=["Basico","Intermedio","Avanzado","Experto"] )
colorAlert = colorWhite
wtShow = input(true, title = 'Show WaveTrend', type = input.bool)
wtChannelLen = input(9, title = 'WT Channel Length', type = input.integer)
wtAverageLen = input(12, title = 'WT Average Length', type = input.integer)
wtMASource = input(hlc3, title = 'WT MA Source', type = input.source)
wtMALen = input(3, title = 'WT MA Length', type = input.integer)
obLevel = input(53, title = 'WT Overbought Level 1', type = input.integer)
osLevel = input(-53, title = 'WT Oversold Level 1', type = input.integer)





// Functions

normalize(_src, _min, _max) => 
    var _historicMin =  0.0
    var _historicMax = 0.0
    _historicMin := min(nz(_src, _historicMin), _historicMin)
    _historicMax := max(nz(_src, _historicMax), _historicMax)
    _historicMax := _historicMin - (_historicMin * 2)
    _min + (_max - _min) * (_src - _historicMin) / max(_historicMax - _historicMin, 10e-10)
f_wavetrend(src, chlen, avg, malen, tf) =>
    tfsrc = security(syminfo.tickerid, tf, src)
    esa = ema(tfsrc, chlen)
    de = ema(abs(tfsrc - esa), chlen)
    ci = (tfsrc - esa) / (0.015 * de)
    wt1 = security(syminfo.tickerid, tf, ema(ci, avg))
    wt2 = security(syminfo.tickerid, tf, sma(wt1, malen))
    wtVwap = wt1 - wt2
    wtOversold = wt2 <= osLevel
    wtOverbought = wt2 >= obLevel
    wtCross = cross(wt1, wt2)
    wtCrossUp = wt2 - wt1 <= 0
    wtCrossDown = wt2 - wt1 >= 0
    wtCrosslast = cross(wt1[2], wt2[2])
    wtCrossUplast = wt2[2] - wt1[2] <= 0
    wtCrossDownlast = wt2[2] - wt1[2] >= 0
    [wt1, wt2, wtOversold, wtOverbought, wtCross, wtCrossUp, wtCrossDown, wtCrosslast, wtCrossUplast, wtCrossDownlast, wtVwap]



// LINEAR REGRESSION

val = linreg(close  -  avg(avg(highest(high, lengthKC), lowest(low, lengthKC)),sma(close,lengthKC)),lengthKC,0)

// ADX

[a, b, c] = dmi(adxlen, adxlen)
DIPlus = a
DIMinus = b
sig = c

// VUMANCHU
[wt1, wt2, wtOversold, wtOverbought, wtCross, wtCrossUp, wtCrossDown, wtCross_last, wtCrossUp_last, wtCrossDown_last, wtVwap] = f_wavetrend(wtMASource, wtChannelLen, wtAverageLen, wtMALen, timeframe.period)
// COLORS



if(nivel=="Basico")
    colorAlert := iff( sig>=th and DIPlus>=DIMinus and sig>sig[1] and val>val[1] ,colorGreen,iff(sig>=th and DIPlus<=DIMinus and sig>sig[1] and val<val[1],colorRed, colorWhite) )
if(nivel=="Intermedio")
    colorAlert := iff( DIPlus>=DIMinus and sig>sig[1] and val>val[1],colorGreen,iff(DIPlus<=DIMinus and sig>sig[1] and val<val[1],colorRed, colorWhite) )
if(nivel=="Avanzado")
    colorAlert := iff( DIPlus>=DIMinus and val>val[1],iff(sig>sig[1], colorGreen,colorDarkGreen),iff(DIPlus<=DIMinus and val<val[1],iff(sig>sig[1],colorRed,colorDarkRed), colorWhite) )
if(nivel=="Experto")
    colorAlert := iff( val>val[1],iff(sig>sig[1] and DIPlus>=DIMinus,colorGreen,iff(sig<sig[1],colorDarkGreen,colorWhite) ) ,iff(sig>sig[1] and DIPlus<=DIMinus,colorRed,iff(sig<sig[1],colorDarkRed,colorWhite) ))

bcolor = iff( val > 0,iff( val > nz(val[1]), colorDarkGreenLR, colorRedLR),iff( val < nz(val[1]), colorDarkRedLR, colorGreenLR))
adxcolor = iff( sig >= th,iff( DIPlus >= DIMinus, iff(sig>sig[1],colorGreen,colorDarkGreen), iff(sig<sig[1],colorDarkRed,colorRed)),iff( DIPlus >= DIMinus, iff(sig>sig[1],colorGreen,colorDarkGreen), iff(sig<sig[1],colorDarkRed,colorRed)))

wt2n= normalize(wt2,-15,15)

plot(normalize(val,-30,30), color=bcolor, title= "Regresión Lineal", style = plot.style_columns, linewidth=4)
plot(th, title = 'Adx Limite', color = colorWhite, linewidth = 1, style = plot.style_stepline)
plot(iff(colorAlert==colorWhite,na,0), title = 'Compra o Venta', color = colorAlert, linewidth = 2, style = plot.style_cross)
plot(wtShow ? wt2n : na, style = plot.style_area, title = 'WT Wave',color=color.white, transp = 70)
plot(cross(wt1, wt2)?wt2n:na, linewidth = 2,color= wt2 - wt1 > 0 ? color.red : color.lime, style=plot.style_circles)
plot(sig, color = adxcolor, linewidth = 1)
plot(sig>th?sig:na, color = adxcolor, linewidth = 1, style = plot.style_circles)

Overview

Linear Regression ADX Eyachay colors the alert green, red, or white from a linear-regression value and ADX directional movement, using a sensitivity input that tightens or loosens the ADX threshold and slope rules. An optional WaveTrend oscillator adds channel length, smoothing, source, and overbought and oversold levels. The author treats three green components as a long cue and a red flip as an exit cue, but the script does not place orders or set stops.

Details

Published by

estebanvz on GitHub

Type

Indicator, Pine Script v4

Draws

Separate pane below the chart

Category

Trend, Oscillators & momentum

Markets

Crypto

Timeframes

Any timeframe

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Topics

tradinglinear-regressionadxrsibitcoinestebanvilcatradingview

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
Wave TrendboolfalseshowWT
LR Tamañoint20lengthKC
ADX Suavizadoint14adxlen
ADX Límiteint23th
SensibilidadstringBasiconivel
Show WaveTrendbooltruewtShow
WT Channel Lengthint9wtChannelLen
WT Average Lengthint12wtAverageLen
WT MA Sourcesourcehlc3wtMASource
WT MA Lengthint3wtMALen
WT Overbought Level 1int53obLevel
WT Oversold Level 1int-53osLevel
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

Schaff Trend Cycle

by everget
948 stars

This indicator plots the Schaff Trend Cycle in a separate pane. It subtracts a slow exponential moving average from a fast one, applies a stochastic cycle twice, and smooths each result to form a 0–100 oscillator. Line color follows the slope, or the upper and

Indicator v4 Oscillators & momentumTrend
Updated 10 days ago · GPL-3.0 GitHub repository of Schaff Trend Cycle

Beep Boop

by magic8bot
409 stars

This indicator calculates a modified MACD oscillator and signal line alongside a trend EMA filter, plotting the output as a stylized column histogram in a separate pane. Instead of plotting true MACD distance, it quantifies positive and negative histogram mome

Indicator v4 Oscillators & momentumTrend
Updated 3 years ago · MIT GitHub repository of Beep Boop

[RS]Standardized Trend Map

by ricardosantos79
261 stars

Standardized Trend Map calculates series momentum relative to active price range across 40 distinct lookback periods ranging from 2 to 80 bars on an exponential moving average source. Each standardized calculation rounds to an integer values of -1, 0, or 1 to

Indicator v4 TrendOscillators & momentum
Updated 4 years ago · None stated GitHub repository of [RS]Standardized Trend Map

ADX Histogram

by harryguiacorn
219 stars

This indicator calculates and displays the Average Directional Index (ADX) as a column histogram in a separate pane. It evaluates market trend strength by calculating directional movement metrics based on specified smoothing and DI length inputs. When the ADX

Indicator v5 TrendOscillators & momentum
Updated 1 year ago · None stated GitHub repository of ADX Histogram
218 stars

Multi-Timeframe Analysis Suite calculates trend direction and momentum conditions across five user-selected timeframes using moving averages, RSI, and Stochastic oscillators. It evaluates moving average slope and oscillator levels to compute trend alignment, m

Indicator v6 Screeners & dashboardsTrend
Updated 3 months ago · None stated GitHub repository of Multi-Timeframe Analysis Suite

More indicators

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers