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

סקריפט קוד פתוח

ברוח TradingView אמיתית, מחבר הסקריפט הזה פרסם אותו בקוד פתוח, כך שסוחרים יכולים להבין ולאמת אותו. כל הכבוד למחבר! אתה יכול להשתמש בו בחינם, אך שימוש חוזר בקוד זה בפרסום כפוף לכללי הבית. אתה יכול להכניס אותו למועדפים כדי להשתמש בו בגרף.

כתב ויתור

המידע והפרסומים אינם אמורים להיות, ואינם מהווים, עצות פיננסיות, השקעות, מסחר או סוגים אחרים של עצות או המלצות שסופקו או מאושרים על ידי TradingView. קרא עוד בתנאים וההגבלות.

רוצה להשתמש בסקריפ זה בגרף?
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)