lix

Lix_JAMES

212 1 24
Uses various trend algos to help indicate market turns
Remove from Favorite Scripts Add to Favorite Scripts
study(title="Lix_JAMES", shorttitle="Lix_JAMES", overlay=true)
len = input(14, minval=1, title="DI Length")
lensig = input(14, title="ADX Smoothing", minval=1, maxval=50)
up = change(high)
down = -change(low)
trur = rma(tr, len)
plus = fixnan(100 * rma(up > down and up > 0 ? up : 0, len) / trur)
minus = fixnan(100 * rma(down > up and down > 0 ? down : 0, len) / trur)
sum = plus + minus 
adx = 100 * rma(abs(plus - minus) / (sum == 0 ? 1 : sum), lensig)
//EMAs
srcEma1 = close, len1 = input(6, minval=1, title="Fast EMA")
ema1 = ema(srcEma1, len1)
srcEma2 = close, len2 = input(20, minval=1, title="Slow EMA")
ema2 = ema(srcEma2, len2)
//
//
diffEma = (100 * (ema1 - ema2) / ((ema1 + ema2) / 2))
emaSignalBuy = ema1>ema2 ? 1 : 0
//SAR
startSAR = input(0.02)
incrementSAR = input(0.02)
maximumSAR = input(0.2)
//
outSAR = sar(startSAR, incrementSAR, maximumSAR)
//MACD
sourceMCD = close
fastLengthMCD = input(12, minval=1), slowLength=input(26,minval=1)
signalLengthMCD=input(9,minval=1)
fastMACD = ema(sourceMCD, fastLengthMCD)
slowMACD = ema(sourceMCD, slowLength)
macd = fastMACD - slowMACD
signal = sma(macd, signalLengthMCD)
hist = macd - signal
//plot(hist, color=red, style=histogram)
//plot(macd, color=blue)
//plot(signal, color=orange)
isSarUp = outSAR < close ? 1 : 0
isMacdUp = signal < macd ? 1 : 0
diff = (100 * (macd - signal) / ((macd + signal) / 2))
act = abs(diff) > 0.01 and abs(diff) < 2 ? diff : 0
c = low - (low/1000000)
signalBuy = (isSarUp > 0 and isMacdUp > 0 and emaSignalBuy > 0 and adx > 20) ? (c) : na
//signalBuy = (isMacdUp > 0 and emaSignalBuy > 0) ? (c) : na
//plot(outSAR)
//plot(signalBuy)
plot(signalBuy, style=circles, color=purple, linewidth = 2)
plot(ema1, color=red)
plot(ema2)
//plot(act, color=yellow)
Nice work !!! Added to my library.
Reply
Ideas Scripts Chart
United States
United Kingdom
India
España
Italia
Brasil
Россия
Türkiye
日本
한국
Home Stock Screener Economic Calendar How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter
Private Messages Chat Ideas Published Followers Following Priority Support Public Profile Profile Settings Billing Sign Out