patrickestarian

Trend, Stoch, Price Action or in short: TSP

Combining the three most important factors that a trader usually needs in a single indicator.

Red = Trend
Blue = Stoch
Orange = Price Action
Usuń z Ulubionych Skryptów Dodaj do Ulubionych Skryptów
study(title="Trend, Stoch, Price Action", shorttitle="TSP")

len1 = input(200)

lenStoch = input(14)
lenK = input(3)

hb = input(75)
lb = input(-75)

len2 = len1 / 4
len3 = len2 / 2
len4 = len3 /2
len5 = len4 / 2
len6 = len5 / 2

hline(lb)
hline(0)
hline(hb)

o = open
h = high
l = low
c = close
m = (l + h) / 2
r = h - l
v = volume

hhll_ = (l-l[1]) / r[1] + (h-h[1]) / r[1]
hhll = (hhll_ > 1) ? 1 : (hhll_ < -1) ? -1 : hhll_
// expand / contract
exct = (c > o) ? abs(r / r[1]) : -abs(r / r[1])
// close vs range
cvsr = (c - m) / r * 2
// close vs open
cvso = (c-o)/r
t1 = (hhll + exct + cvsr + cvso) / 4

plot(sma(t1*50, lenK), color=orange)

ma1 = sma(c, len1)
ma2 = sma(c, len2)
ma3 = ema(c, len3)
ma4 = ema(c, len4)

p1 = (ma1 > ma1[1]) ? 1 : (ma1 < ma1[1]) ? -1 : 0
p2 = (ma2 > ma2[1]) ? 1 : (ma2 < ma2[1]) ? -1 : 0
p3 = (ma3 > ma3[1]) ? 1 : (ma3 < ma3[1]) ? -1 : 0

pma1 = (ma2 > ma1) ? 1 : (ma2 < ma1) ? -1 : 0
pma2 = (ma3 > ma2) ? 1 : (ma3 < ma2) ? -1 : 0

pu1 = (p1 > 0 and l > ma1) ? 1 : (p1 > 0 and c > ma1) ? 0.5 : 0
pd1 = (p1 < 0 and h < ma1) ? -1 : (p1 < 0 and c < ma1) ? -0.5 : 0

pu2 = (p2 > 0 and l > ma2) ? 1 : (p2 > 0 and c > ma2) ? 0.5 : 0
pd2 = (p2 < 0 and h < ma2) ? -1 : (p2 < 0 and c < ma2) ? -0.5 : 0

pu3 = (p3 > 0 and l > ma3) ? 1 : (p3 > 0 and c > ma3) ? 0.5 : 0
pd3 = (p3 < 0 and h < ma3) ? -1 : (p3 < 0 and c < ma3) ? -0.5 : 0

tma1 = p1 + pu1 + pd1
tma2 = p2 + pu2 + pd2
tma3 = p3 + pu3 + pd3

t2 = (tma1 + tma2 + tma3 + pma1 + pma2) / 5

obv = (c > o) ? v : -v
//obv = sum(volpn, len)
vl = lowest(obv, len5)
vh = highest(obv, len5)
t3 = nz((obv-vl) / (vh - vl) * 0.5)

t = t1*2 + t2 + t3*0

ta = ema(ema(t, len5), len6) * 30
talr = linreg(ta, len5, 0)

tclr = (talr > talr[1]) ? green : red 


ll = lowest(l, lenStoch)
hh = highest(h, lenStoch)
st = (c-ll) / (hh - ll) * 200 - 100
k = linreg(sma(st, lenK), lenK, 0)
//k = sma(st, lenK)

//sclr = (k > k[1]) ? green : red
//clr = (talr>talr[1] and lowest(k, len5)<lb) ? green : ((talr<0 and talr[1]>0) or (highest(k, len5)>hb and k<hb)) ? red : white
//plot(0, color=clr, style=circles, linewidth=2)

plot(talr, color=red)
plot(k, color=navy)

Komentarze

For more details about the indicator, please see this SeekingAlpha article: http://bit.ly/1QhF0Pj
+1 Odpowiedz
This a very slick indicator that is better then a lot of ones on TradingView you should have way more downloads good job on this one!
Odpowiedz
Patrick, this indicator is awesome. How would I change the names of the plots in the settings to set up alerts?
Odpowiedz
Patrick, thank you for the indicator. Good job.
I was trying to add script to a chart, but got the follow message:
line 2:14 mismatched input 'study' expecting LEND
Could you tell me, please, what should I do?
Odpowiedz
mny-mny mny-mny
Sorry, Patrick. I've found what was the problem: I didn't delete the default lines.
Now I'm ready to test you indicator.
Wish you luck.
Odpowiedz
Sorry mny-mny, I saw your message late. But I'm glad you figured that out. Please don't forget to give me your feedback. If you have a user in seekingalpha, please leave the comment there. Otherwise, here is fine too. Thanks and good luck.
Odpowiedz
Strona główna Skaner akcji Skaner Forex Skaner Krypto Kalendarz ekonomiczny Jak to działa Funkcje wykresów Cennik Poleć przyjaciela Dobre Praktyki Centrum Pomocy Rozwiązania internetowe i brokerskie Widżety Wykresy Lekka Biblioteka Wykresów Blog i wiadomości Twitter
Profil Ustawienia profilu Konto i płatności Poleceni znajomi Monety Wiadomości do działu obsługi Centrum Pomocy Opublikowane Pomysły Obserwujący Obserwujesz Wiadomość prywatna Czat Wyloguj