Created
October 8, 2016 14:47
-
-
Save e1t0n/ac985b6d537b6fbbfebe52a48dcbbd2b to your computer and use it in GitHub Desktop.
Pine Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//tradingview.com pine script | |
study("Average Directional Index with Threshold", shorttitle="ADX") | |
adxlen = input(14, title="ADX Smoothing") | |
dilen = input(14, title="DI Length") | |
dirmov(len) => | |
up = change(high) | |
down = -change(low) | |
truerange = rma(tr, len) | |
plus = fixnan(100 * rma(up > down and up > 0 ? up : 0, len) / truerange) | |
minus = fixnan(100 * rma(down > up and down > 0 ? down : 0, len) / truerange) | |
[plus, minus] | |
adx(dilen, adxlen) => | |
[plus, minus] = dirmov(dilen) | |
sum = plus + minus | |
adx = 100 * rma(abs(plus - minus) / (sum == 0 ? 1 : sum), adxlen) | |
sig = adx(dilen, adxlen) | |
th1 = input(title="threshold", type=integer, defval=10) | |
th2 = input(title="threshold", type=integer, defval=20) | |
th3 = input(title="threshold", type=integer, defval=40) | |
plot(sig, color=green, title="ADX", style=histogram) | |
hline(th1, color=silver, linestyle=dashed) | |
hline(th2, color=silver, linestyle=dashed) | |
hline(th3, color=silver, linestyle=dashed) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi
Can we create a histogram with above script. If yes can we make algo trade with that script