Thống kê diễn đàn

Bài viết
113,249
Bình luận
808,445
Thành viên
110,409
Thành viên mới nhất
Trung_afftop

Thành viên trực tuyến

Không có thành viên nào trực tuyến.

Tìm cơ hội cược BO với Trend line

Tìm cơ hội cược BO với Trend line

Tìm cơ hội cược BO với Trend line
Quà năm mới tặng anh em :)
Code TradingView Clock - MTF beta 3:
* Cập nhật giá trị nhận biết trend kiệt sức (điểm Buy/Sell rớt từ trên 75 xuống dưới 75 - xem như giá đã đạt target, giá chạy đã xa, hay còn gọi là trend kiệt sức bla bla... anh em gọi gì cũng được - thì lúc này indi cũng sẽ ngừng phát tín hiệu :D)
* Cập nhật hiển thị số điểm của Sell và Buy lên cửa sổ indicator (thang điểm 100)
=== Code ===
Mã:
//@version=4
//BO TradingView Clock - MTF beta 3
//author: anhnguyen14

study(title="BO TradingView Clock - MTF beta 3", shorttitle="MTF- beta 3", overlay=false)

// === Signal Time ===
CTimeDvM   = input(true, title = "=== Trading Time ===")
FromHourDvM   = input(defval = 5, title = "From Hour", minval = 00, maxval = 23)
FromMinuteDvM = input(defval = 00, title = "From Minute", minval = 00, maxval = 59)
ToHourDvM   = input(defval = 04, title = "To Hour", minval = 00, maxval = 23)
ToMinuteDvM = input(defval = 59, title = "To Minute", minval = 00, maxval = 59)
GMT_FHDvM=FromHourDvM<7?FromHourDvM-7+24:FromHourDvM-7
GMT_THDvM=ToHourDvM<7?ToHourDvM-7+24:ToHourDvM-7
fhDvM= (GMT_FHDvM<10?"0"+tostring(GMT_FHDvM):tostring(GMT_FHDvM))
fmDvM= (FromMinuteDvM<10?"0"+tostring(FromMinuteDvM):tostring(FromMinuteDvM))
thDvM= (GMT_THDvM<10?"0"+tostring(GMT_THDvM):tostring(GMT_THDvM))
tmDvM= (ToMinuteDvM<10?"0"+tostring(ToMinuteDvM):tostring(ToMinuteDvM))
WorkingHourDvM = fhDvM+fmDvM+"-"+thDvM+tmDvM
t0_DvM = time(timeframe.period, WorkingHourDvM)
//bgcolor(CTimeDvM? t0_DvM? color.gray : na:na, title="Trading Time", transp=90)

//A. Oscillators
//1. Rsi
RSI(src,per) =>
    len = per
    up = rma(max(change(src), 0), len)
    down = rma(-min(change(src), 0), len)
    rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - 100 / (1 + up / down)
    RSI=rsi
rsi_Sig=RSI(close,14)

//RSI Signal
A1_red =
       rsi_Sig<30
       ?1:0
A1_blue =
       rsi_Sig>70
       ?1:0
//2. Stochastic
STOCH(src,perK,perD,perS) =>
    K = perK
    D = perD
    smooth = perS
    hh = highest(high, K)
    ll = lowest(low, K)
    k = sma((src - ll) / (hh - ll) * 100, smooth)
    d = sma(k, D)
    STOCH=k
stoch_Sig = STOCH(close,14,3,3)
//plot(stoch_Sig,color=color.green)

//STOCH Signal
A2_red =
       stoch_Sig<20
       ?1:0
A2_blue =
       stoch_Sig>80
       ?1:0

//3. CCI
CCI(src,per) =>
    lengthcci1 = per
    macci1 = sma(src, lengthcci1)
    cci1 = (src - macci1) / (0.015 * dev(src, lengthcci1))
    CCI = cci1
cci_Sig=CCI(close,20)
//plot(cci_Sig,color=color.blue)

//CCI Signal
A3_red =
       cci_Sig<-100
       ?1:0
A3_blue =
       cci_Sig>100
       ?1:0

//4. ADX
adxlen = 14
dilen = 14
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)

adxHigh(dilen, adxlen) =>
    [plus, minus] = dirmov(dilen)
    plus
  
adxLow(dilen, adxlen) =>
    [plus, minus] = dirmov(dilen)
    minus
  
ADX_Sig = ADX(dilen, adxlen)
di_sigHigh = adxHigh(dilen, adxlen)
di_sigLow = adxLow(dilen, adxlen)
//plot(ADX_Sig)

//ADX Signal
A4_red =
       di_sigLow>di_sigHigh
       and ADX_Sig>25
       ?1:0
A4_blue =
       di_sigHigh>di_sigLow
       and ADX_Sig>25
       ?1:0

//5. AO
ao = sma(hl2,5) - sma(hl2,34)

//AO Signal
A5_red =
       ao<0
       ?1:0
A5_blue =
       ao>0
       ?1:0
//6. momentum
mom = close - close[10]

//momentum Signal
A6_red =
       mom<0
       ?1:0
A6_blue =
       mom>0
       ?1:0

//7. MACD
fast_ma = ema(close, 12)
slow_ma = ema(close, 26)
macd = fast_ma - slow_ma
signal = ema(macd, 9)
hist = macd - signal

//MACD Signal
A7_red =
       hist < hist[1]
       ?1:0
A7_blue =
       hist > hist[1]
       ?1:0

//8. Stoch RSI
rsi1 = rsi(close, 14)
rsik = sma(stoch(rsi1, rsi1, rsi1, 14), 3)
rsid = sma(rsik, 3)
rsih0 = 80
rsih1 = 20

//Stoch RSI Signal
A8_red =
       rsik < rsih1
       ?1:0
A8_blue =
       rsik > rsih0
       ?1:0

//9. %R
upper = highest(14)
lower = lowest(14)
out = 100 * (close - upper) / (upper - lower)
rband1 = -20
rband0 = -80

// %R Signal
A9_red =
       out < rband0
       ?1:0
A9_blue =
       out > rband1
       ?1:0

//10. Bull bear
Length = 30
r1=iff(close[1]<open,max(open-close[1],high-low),high-low)
r2=iff(close[1]>open,max(close[1]-open,high-low),high-low)
bull=iff(close==open,iff(high-close==close-low,iff(close[1]>open,max(high-open,close-low),r1),iff(high-close>close-low,iff(close[1]<open, max(high-close[1],close-low), high-open),r1)),iff(close<open,iff(close[1]<open,max(high-close[1],close-low), max(high-open,close-low)),r1))
bear=iff(close==open,iff(high-close==close-low,iff(close[1]<open,max(open-low,high-close),r2),iff(high-close>close-low,r2,iff(close[1]>open,max(close[1]-low,high-close), open-low))),iff(close<open,r2,iff(close[1]>open,max(close[1]-low,high-close),max(open-low,high-close))))

// Bull bear Signal
A10_red =
       sma(bull-bear,Length)<0
       ?1:0
A10_blue =
       sma(bull-bear,Length)>0
       ?1:0

//11.UO
length7 = 7,
length14 = 14,
length28 = 28
average(bp, tr_, length) => sum(bp, length) / sum(tr_, length)
high_ = max(high, close[1])
low_ = min(low, close[1])
bp = close - low_
tr_ = high_ - low_
avg7 = average(bp, tr_, length7)
avg14 = average(bp, tr_, length14)
avg28 = average(bp, tr_, length28)
uoout = 100 * (4*avg7 + 2*avg14 + avg28)/7

// UO Signal
A11_red =
       uoout < 30
       ?1:0
A11_blue =
       uoout > 70
       ?1:0

//Sum Signal A
A_red = A1_red + A2_red + A3_red + A4_red + A5_red + A6_red + A7_red + A8_red + A9_red + A10_red + A11_red
A_blue = A1_blue + A2_blue + A3_blue + A4_blue + A5_blue + A6_blue + A7_blue + A8_blue + A9_blue + A10_blue + A11_blue

//B. Moving Averages
//1. ema 5
B1_red =
       close<ema(close,5)
       ?1:0
B1_blue =
       close>ema(close,5)
       ?1:0

//2. sma 5
B2_red =
       close<sma(close,5)
       ?1:0
B2_blue =
       close>sma(close,5)
       ?1:0

//3. ema 10
B3_red =
       close<ema(close,10)
       ?1:0
B3_blue =
       close>ema(close,10)
       ?1:0

//4. sma 10
B4_red =
       close<sma(close,10)
       ?1:0
B4_blue =
       close>sma(close,10)
       ?1:0

//5. ema 20
B5_red =
       close<ema(close,20)
       ?1:0
B5_blue =
       close>ema(close,20)
       ?1:0

//6. sma 20
B6_red =
       close<sma(close,20)
       ?1:0
B6_blue =
       close>sma(close,20)
       ?1:0

//7. ema 30
B7_red =
       close<ema(close,30)
       ?1:0
B7_blue =
       close>ema(close,30)
       ?1:0

//8. sma 30
B8_red =
       close<sma(close,30)
       ?1:0
B8_blue =
       close>sma(close,30)
       ?1:0

//9. ema 50
B9_red =
       close<ema(close,50)
       ?1:0
B9_blue =
       close>ema(close,50)
       ?1:0
//10. sma 50
B10_red =
       close<sma(close,50)
       ?1:0
B10_blue =
       close>sma(close,50)
       ?1:0

//11. ema 100
B11_red =
       close<ema(close,100)
       ?1:0
B11_blue =
       close>ema(close,100)
       ?1:0

//12. sma 100
B12_red =
       close<sma(close,100)
       ?1:0
B12_blue =
       close>sma(close,100)
       ?1:0

//13. ema 200
B13_red =
       close<ema(close,200)
       ?1:0
B13_blue =
       close>ema(close,200)
       ?1:0

//14. sma 200
B14_red =
       close<sma(close,200)
       ?1:0
B14_blue =
       close>sma(close,200)
       ?1:0

//15. Ichimoku Cloud - Baseline
donchian(len) => avg(lowest(len), highest(len))
ichi_baseline = donchian(26)
B15_red =
       close<ichi_baseline
       ?1:0
B15_blue =
       close>ichi_baseline
       ?1:0

//16. VWMA 20
B16_red =
       close<vwma(close,20)
       ?1:0
B16_blue =
       close>vwma(close,20)
       ?1:0

//17. Hull 9
hma(src,len) => wma(2*wma(src, len/2)-wma(src, len), round(sqrt(len)))
B17_red =
       close<hma(close,9)
       ?1:0
B17_blue =
       close>hma(close,9)
       ?1:0

//Sum Signal B
B_red = B1_red + B2_red + B3_red + B4_red + B5_red + B6_red + B7_red + B8_red + B9_red + B10_red + B11_red + B12_red + B13_red + B14_red + B15_red + B16_red + B17_red
B_blue = B1_blue + B2_blue + B3_blue + B4_blue + B5_blue + B6_blue + B7_blue + B8_blue + B9_blue + B10_blue + B11_blue + B12_blue + B13_blue + B14_blue + B15_blue + B16_blue + B17_blue

//C. Pivot

///////////////
// FUNCTIONS //
///////////////

// Function outputs 1 when it's the first bar of the D/W/M/Y
is_newbar(res) =>
    ch = 0
    if(res == 'Y')
        t  = year(time('D'))
        ch := change(t) != 0 ? 1 : 0
    else
        t = time(res)
        ch := change(t) != 0 ? 1 : 0
    ch

// Rounding levels to min tick
nround(x) =>
    n = round(x / syminfo.mintick) * syminfo.mintick

////////////
// INPUTS //
////////////

pp_res = 'D'

/////////////////////
// Get HLC from HT //

// Calc Open
open_cur = 0.0
open_cur := is_newbar(pp_res) ? open : open_cur[1]

popen = 0.0
popen := is_newbar(pp_res) ? open_cur[1] : popen[1]

// Calc High
high_cur = 0.0
high_cur := is_newbar(pp_res) ? high : max(high_cur[1], high)

phigh = 0.0
phigh := is_newbar(pp_res) ? high_cur[1] : phigh[1]

// Calc Low
low_cur = 0.0
low_cur := is_newbar(pp_res) ? low : min(low_cur[1], low)

plow = 0.0
plow := is_newbar(pp_res) ? low_cur[1] : plow[1]

// Calc Close
pclose = 0.0
pclose := is_newbar(pp_res) ? close[1] : pclose[1]


////////////////////////////
// CALCULATE Pivot POINTS //
////////////////////////////

PP = 0.0
R1 = 0.0, R2 = 0.0, R3 = 0.0
S1 = 0.0, S2 = 0.0, S3 = 0.0

//if (pp_type == "Traditional")
TR_PP = (phigh + plow + pclose) / 3
TR_R1 = TR_PP     + (TR_PP   - plow)
TR_S1 = TR_PP     - (phigh - TR_PP)
TR_R2 = TR_PP     + (phigh - plow)
TR_S2 = TR_PP     - (phigh - plow)
TR_R3 = phigh  + 2 * (TR_PP   - plow)
TR_S3 = plow   - 2 * (phigh - TR_PP)

//Signal

C1_red =
       (close<TR_S1 and not cross(close,TR_S2))
       or
       (close<TR_S2 and not cross(close,TR_S3))
       or
       (close<TR_S3 and not cross(high,TR_S3))
       ?1:0
 
C1_blue =
       (close>TR_R1 and not cross(close,TR_R2))
       or
       (close>TR_R2 and not cross(close,TR_R3))
       or
       (close>TR_R3 and not cross(low,TR_R3))
       ?1:0

//if (pp_type == "Fibonacci")
FIB_PP = (phigh + plow + pclose) / 3
FIB_R1 = FIB_PP + (phigh - plow) * 0.382
FIB_S1 = FIB_PP - (phigh - plow) * 0.382
FIB_R2 = FIB_PP + (phigh - plow) * 0.618
FIB_S2 = FIB_PP - (phigh - plow) * 0.618
FIB_R3 = FIB_PP + (phigh - plow) * 1.000
FIB_S3 = FIB_PP - (phigh - plow) * 1.000
 
C2_red =
       (close<FIB_S1 and not cross(close,FIB_S2))
       or
       (close<FIB_S2 and not cross(close,FIB_S3))
       or
       (close<FIB_S3 and not cross(high,FIB_S3))
       ?1:0

C2_blue =
       (close>FIB_R1 and not cross(close,FIB_R2))
       or
       (close>FIB_R2 and not cross(close,FIB_R3))
       or
       (close>FIB_R3 and not cross(low,FIB_R3))
       ?1:0

//if (pp_type == "Woodie")
WO_PP = (phigh + plow + 2 * popen) / 4
WO_R1 = WO_PP + (WO_PP - plow)
WO_S1 = WO_PP - (phigh - WO_PP)
WO_R2 = WO_PP + (phigh - plow)
WO_S2 = WO_PP - (phigh - plow)
WO_R3 = phigh + 2 * (WO_PP - plow)
WO_S3 = plow  - 2 * (phigh - WO_PP)
  
C3_red =
       (close<WO_S1 and not cross(close,WO_S2))
       or
       (close<WO_S2 and not cross(close,WO_S3))
       or
       (close<WO_S3 and not cross(high,WO_S3))
       ?1:0

C3_blue =
       (close>WO_R1 and not cross(close,WO_R2))
       or
       (close>WO_R2 and not cross(close,WO_R3))
       or
       (close>WO_R3 and not cross(low,WO_R3))
       ?1:0


//if (pp_type == "Camarilla")
CA_PP = (phigh + plow + pclose) / 3
CA_R1 = pclose + (phigh - plow) * 1.1/12
CA_S1 = pclose - (phigh - plow) * 1.1/12
CA_R2 = pclose + (phigh - plow) * 1.1/6
CA_S2 = pclose - (phigh - plow) * 1.1/6
CA_R3 = pclose + (phigh - plow) * 1.1/4
CA_S3 = pclose - (phigh - plow) * 1.1/4

C4_red =
       (close<CA_S1 and not cross(close,CA_S2))
       or
       (close<CA_S2 and not cross(close,CA_S3))
       or
       (close<CA_S3 and not cross(high,CA_S3))
       ?1:0

C4_blue =
       (close>CA_R1 and not cross(close,CA_R2))
       or
       (close>CA_R2 and not cross(close,CA_R3))
       or
       (close>CA_R3 and not cross(low,CA_R3))
       ?1:0


//C Point
C_red = C1_red + C2_red + C3_red + C4_red

C_blue = C1_blue + C2_blue + C3_blue + C4_blue

//Sum point
Sum_red=A_red+B_red+C_red
Sum_blue=A_blue+B_blue+C_blue
sell_point=(Sum_red/32)*100
buy_point=(Sum_blue/32)*100

//Trade Zone
sellzone =
       A_red>A_blue
       and B_red>B_blue
       and C_red>C_blue
       and sell_point>50
       and close>open
       and not crossunder(sell_point,75)


buyzone =
       A_red<A_blue
       and B_red<B_blue
       and C_red<C_blue
       and buy_point>50
       and close<open
       and not crossunder(buy_point,75)

// - /FUNCTIONS

xTech=
       sellzone
    
    

yTech=
       buyzone
    
    

//--------------------------------------\\
// - /FUNCTIONS

//--------------------------------------\\

//plot
h100=hline(100)
h0=hline(0)
col_sell=xTech?color.new(color.red,10):color.new(color.red,60)
col_buy=yTech?color.new(color.blue,10):color.new(color.blue,60)
plot(sell_point, title="Sell Level", style=plot.style_columns, color=col_sell)
plot(buy_point, title="Buy Level", style=plot.style_columns, color=col_buy)
//Alert
CputcolDvM = xTech? color.red : na
CcallcolDvM = yTech? color.blue : na
//plotshape(CTimeDvM?t0_DvM?xTech:na:na, title='Put', text="Put", style=shape.labeldown, location=location.bottom, color=color.orange, textcolor=color.black, offset=1, transp=0)
//plotshape(CTimeDvM?t0_DvM?yTech:na:na, title='Call', text="Call", style=shape.labelup, location=location.bottom, color=color.orange, textcolor=color.black, offset=1, transp=0)
//bgcolor(CTimeDvM?t0_DvM?CputcolDvM:na:na, transp=0, offset=1, title="Put Signal")
//bgcolor(CTimeDvM?t0_DvM?CcallcolDvM:na:na, transp=0, offset=1, title="Call Signal")
PutSignal=CTimeDvM?t0_DvM?xTech?-100:na:na:na
CallSignal=CTimeDvM?t0_DvM?yTech?-100:na:na:na
hmacro=hline(-100)
plot(PutSignal, title='Put Signal', style=plot.style_columns, color=color.red, offset=0, transp=0,show_last=1)
plot(CallSignal, title='Call Signal', style=plot.style_columns, color=color.blue, offset=0, transp=0,show_last=1)
plotshape(PutSignal, title='Put', text="Put", style=shape.labeldown, location=location.bottom, color=color.orange, textcolor=color.black, offset=0, transp=0,show_last=1)
plotshape(CallSignal, title='Call', text="Call", style=shape.labelup, location=location.bottom, color=color.orange, textcolor=color.black, offset=0, transp=0,show_last=1)
sell_point_text = tostring(sell_point)
buy_point_text = tostring(buy_point)
label_sell_point = label.new(bar_index, sell_point, text=sell_point_text,  style= label.style_none)
label.delete(label_sell_point[1])
label_buy_point = label.new(bar_index, buy_point, text=buy_point_text,  style= label.style_none)
label.delete(label_buy_point[1])

  
//EOF

=== Ảnh minh họa ===
chrome_oAvIYgSGC5.png
Cái cột màu xanh nó nổi bật lên làm mình ko nhìn đc cái màu còn lại trong cột đó. ko như cột màu đỏ. Mà cho em hỏi cái cột biểu thị cái gì thế bác
 
 

Đính kèm

  • dh.png
    dh.png
    201 KB · Xem: 34
Cái cột màu xanh nó nổi bật lên làm mình ko nhìn đc cái màu còn lại trong cột đó. ko như cột màu đỏ. Mà cho em hỏi cái cột biểu thị cái gì thế bác
Điểm vào lệnh ngay tại giá đóng cửa đó bạn, bạn để ý là mỗi lần indi gợi ý điểm vào là cột điểm đổi màu, điểm vào mất thì cột điểm trở lại bình thường, còn ngay cuối nến thì nó bị lưu lại vì đã qua nến mới :D
 
 
Hi. Thanks bác. Chúc bác năm mới an khang, thịnh vượng, gặp nhiều may mắn. Nhất là sẽ tìm ra đc chén thánh để ae ăn ké cửa của bác...
Mà nay bác rảnh dỗi chụp màn hình cho ae chiêm ngưỡng con marco nó hoạt động như nào.
Nói thật là e chưa hiểu kiểu bắn lệnh của con marco lắm
Macro giống macro của chương trình soạn thảo Word vậy đó bạn, nó đơn giản là làm thay các thao tác của mình thôi, kể cả thao tác nhìn màu :D Nói thì khó hiểu chứ nhìn phát là hiểu ngay hà, mình cũng không biết giải thích sao nữa :D
 
 
Tặng anh em hàng mới nữa nhé.
Technical Analysis - Panel Info: đem cả chiếc đồng hồ TradingView lên chart của bạn :D
=== Code ===
Mã:
//@version=4
//Technical Analysis - Panel Info
//author: anhnguyen14

study(title="Technical Analysis - Panel Info", overlay=false)

//A. Oscillators
//1. Rsi
RSI(src,per) =>
    len = per
    up = rma(max(change(src), 0), len)
    down = rma(-min(change(src), 0), len)
    rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - 100 / (1 + up / down)
    RSI=rsi
rsi_Sig=RSI(close,14)

//RSI Signal
A1_red =
       rsi_Sig<30
       ?1:0
A1_blue =
       rsi_Sig>70
       ?1:0
//2. Stochastic
STOCH(src,perK,perD,perS) =>
    K = perK
    D = perD
    smooth = perS
    hh = highest(high, K)
    ll = lowest(low, K)
    k = sma((src - ll) / (hh - ll) * 100, smooth)
    d = sma(k, D)
    STOCH=k
stoch_Sig = STOCH(close,14,3,3)
//plot(stoch_Sig,color=color.green)

//STOCH Signal
A2_red =
       stoch_Sig<20
       ?1:0
A2_blue =
       stoch_Sig>80
       ?1:0

//3. CCI
CCI(src,per) =>
    lengthcci1 = per
    macci1 = sma(src, lengthcci1)
    cci1 = (src - macci1) / (0.015 * dev(src, lengthcci1))
    CCI = cci1
cci_Sig=CCI(close,20)
//plot(cci_Sig,color=color.blue)

//CCI Signal
A3_red =
       cci_Sig<-100
       ?1:0
A3_blue =
       cci_Sig>100
       ?1:0

//4. ADX
adxlen = 14
dilen = 14
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)

adxHigh(dilen, adxlen) =>
    [plus, minus] = dirmov(dilen)
    plus
    
adxLow(dilen, adxlen) =>
    [plus, minus] = dirmov(dilen)
    minus
    
ADX_Sig = ADX(dilen, adxlen)
di_sigHigh = adxHigh(dilen, adxlen)
di_sigLow = adxLow(dilen, adxlen)
//plot(ADX_Sig)

//ADX Signal
A4_red =
       di_sigLow>di_sigHigh
       and ADX_Sig>25
       ?1:0
A4_blue =
       di_sigHigh>di_sigLow
       and ADX_Sig>25
       ?1:0

//5. AO
ao = sma(hl2,5) - sma(hl2,34)

//AO Signal
A5_red =
       ao<0
       ?1:0
A5_blue =
       ao>0
       ?1:0
//6. momentum
mom = close - close[10]

//momentum Signal
A6_red =
       mom<0
       ?1:0
A6_blue =
       mom>0
       ?1:0

//7. MACD
fast_ma = ema(close, 12)
slow_ma = ema(close, 26)
macd = fast_ma - slow_ma
signal = ema(macd, 9)
hist = macd - signal

//MACD Signal
A7_red =
       hist < hist[1]
       ?1:0
A7_blue =
       hist > hist[1]
       ?1:0

//8. Stoch RSI
rsi1 = rsi(close, 14)
rsik = sma(stoch(rsi1, rsi1, rsi1, 14), 3)
rsid = sma(rsik, 3)
rsih0 = 80
rsih1 = 20

//Stoch RSI Signal
A8_red =
       rsik < rsih1
       ?1:0
A8_blue =
       rsik > rsih0
       ?1:0

//9. %R
upper = highest(14)
lower = lowest(14)
out = 100 * (close - upper) / (upper - lower)
rband1 = -20
rband0 = -80

// %R Signal
A9_red =
       out < rband0
       ?1:0
A9_blue =
       out > rband1
       ?1:0

//10. Bull bear
Length = 30
r1=iff(close[1]<open,max(open-close[1],high-low),high-low)
r2=iff(close[1]>open,max(close[1]-open,high-low),high-low)
bull=iff(close==open,iff(high-close==close-low,iff(close[1]>open,max(high-open,close-low),r1),iff(high-close>close-low,iff(close[1]<open, max(high-close[1],close-low), high-open),r1)),iff(close<open,iff(close[1]<open,max(high-close[1],close-low), max(high-open,close-low)),r1))
bear=iff(close==open,iff(high-close==close-low,iff(close[1]<open,max(open-low,high-close),r2),iff(high-close>close-low,r2,iff(close[1]>open,max(close[1]-low,high-close), open-low))),iff(close<open,r2,iff(close[1]>open,max(close[1]-low,high-close),max(open-low,high-close))))

// Bull bear Signal
A10_red =
       sma(bull-bear,Length)<0
       ?1:0
A10_blue =
       sma(bull-bear,Length)>0
       ?1:0

//11.UO
length7 = 7,
length14 = 14,
length28 = 28
average(bp, tr_, length) => sum(bp, length) / sum(tr_, length)
high_ = max(high, close[1])
low_ = min(low, close[1])
bp = close - low_
tr_ = high_ - low_
avg7 = average(bp, tr_, length7)
avg14 = average(bp, tr_, length14)
avg28 = average(bp, tr_, length28)
uoout = 100 * (4*avg7 + 2*avg14 + avg28)/7

// UO Signal
A11_red =
       uoout < 30
       ?1:0
A11_blue =
       uoout > 70
       ?1:0

//Sum Signal A
A_red = A1_red + A2_red + A3_red + A4_red + A5_red + A6_red + A7_red + A8_red + A9_red + A10_red + A11_red
A_blue = A1_blue + A2_blue + A3_blue + A4_blue + A5_blue + A6_blue + A7_blue + A8_blue + A9_blue + A10_blue + A11_blue

//B. Moving Averages
//1. ema 5
B1_red =
       close<ema(close,5)
       ?1:0
B1_blue =
       close>ema(close,5)
       ?1:0

//2. sma 5
B2_red =
       close<sma(close,5)
       ?1:0
B2_blue =
       close>sma(close,5)
       ?1:0

//3. ema 10
B3_red =
       close<ema(close,10)
       ?1:0
B3_blue =
       close>ema(close,10)
       ?1:0

//4. sma 10
B4_red =
       close<sma(close,10)
       ?1:0
B4_blue =
       close>sma(close,10)
       ?1:0

//5. ema 20
B5_red =
       close<ema(close,20)
       ?1:0
B5_blue =
       close>ema(close,20)
       ?1:0

//6. sma 20
B6_red =
       close<sma(close,20)
       ?1:0
B6_blue =
       close>sma(close,20)
       ?1:0

//7. ema 30
B7_red =
       close<ema(close,30)
       ?1:0
B7_blue =
       close>ema(close,30)
       ?1:0

//8. sma 30
B8_red =
       close<sma(close,30)
       ?1:0
B8_blue =
       close>sma(close,30)
       ?1:0

//9. ema 50
B9_red =
       close<ema(close,50)
       ?1:0
B9_blue =
       close>ema(close,50)
       ?1:0
//10. sma 50
B10_red =
       close<sma(close,50)
       ?1:0
B10_blue =
       close>sma(close,50)
       ?1:0

//11. ema 100
B11_red =
       close<ema(close,100)
       ?1:0
B11_blue =
       close>ema(close,100)
       ?1:0

//12. sma 100
B12_red =
       close<sma(close,100)
       ?1:0
B12_blue =
       close>sma(close,100)
       ?1:0

//13. ema 200
B13_red =
       close<ema(close,200)
       ?1:0
B13_blue =
       close>ema(close,200)
       ?1:0

//14. sma 200
B14_red =
       close<sma(close,200)
       ?1:0
B14_blue =
       close>sma(close,200)
       ?1:0

//15. Ichimoku Cloud - Baseline
donchian(len) => avg(lowest(len), highest(len))
ichi_baseline = donchian(26)
B15_red =
       close<ichi_baseline
       ?1:0
B15_blue =
       close>ichi_baseline
       ?1:0

//16. VWMA 20
B16_red =
       close<vwma(close,20)
       ?1:0
B16_blue =
       close>vwma(close,20)
       ?1:0

//17. Hull 9
hma(src,len) => wma(2*wma(src, len/2)-wma(src, len), round(sqrt(len)))
B17_red =
       close<hma(close,9)
       ?1:0
B17_blue =
       close>hma(close,9)
       ?1:0

//Sum Signal B
B_red = B1_red + B2_red + B3_red + B4_red + B5_red + B6_red + B7_red + B8_red + B9_red + B10_red + B11_red + B12_red + B13_red + B14_red + B15_red + B16_red + B17_red
B_blue = B1_blue + B2_blue + B3_blue + B4_blue + B5_blue + B6_blue + B7_blue + B8_blue + B9_blue + B10_blue + B11_blue + B12_blue + B13_blue + B14_blue + B15_blue + B16_blue + B17_blue

//C. Pivot

///////////////
// FUNCTIONS //
///////////////

// Function outputs 1 when it's the first bar of the D/W/M/Y
is_newbar(res) =>
    ch = 0
    if(res == 'Y')
        t  = year(time('D'))
        ch := change(t) != 0 ? 1 : 0
    else
        t = time(res)
        ch := change(t) != 0 ? 1 : 0
    ch

// Rounding levels to min tick
nround(x) =>
    n = round(x / syminfo.mintick) * syminfo.mintick

////////////
// INPUTS //
////////////

pp_res = 'D'

/////////////////////
// Get HLC from HT //

// Calc Open
open_cur = 0.0
open_cur := is_newbar(pp_res) ? open : open_cur[1]

popen = 0.0
popen := is_newbar(pp_res) ? open_cur[1] : popen[1]

// Calc High
high_cur = 0.0
high_cur := is_newbar(pp_res) ? high : max(high_cur[1], high)

phigh = 0.0
phigh := is_newbar(pp_res) ? high_cur[1] : phigh[1]

// Calc Low
low_cur = 0.0
low_cur := is_newbar(pp_res) ? low : min(low_cur[1], low)

plow = 0.0
plow := is_newbar(pp_res) ? low_cur[1] : plow[1]

// Calc Close
pclose = 0.0
pclose := is_newbar(pp_res) ? close[1] : pclose[1]


////////////////////////////
// CALCULATE Pivot POINTS //
////////////////////////////

PP = 0.0
R1 = 0.0, R2 = 0.0, R3 = 0.0
S1 = 0.0, S2 = 0.0, S3 = 0.0

//if (pp_type == "Traditional")
TR_PP = (phigh + plow + pclose) / 3
TR_R1 = TR_PP     + (TR_PP   - plow)
TR_S1 = TR_PP     - (phigh - TR_PP)
TR_R2 = TR_PP     + (phigh - plow)
TR_S2 = TR_PP     - (phigh - plow)
TR_R3 = phigh  + 2 * (TR_PP   - plow)
TR_S3 = plow   - 2 * (phigh - TR_PP)

//Signal

C1_red =
       (close<TR_S1 and not cross(close,TR_S2))
       or
       (close<TR_S2 and not cross(close,TR_S3))
       or
       (close<TR_S3 and not cross(high,TR_S3))
       ?1:0
 
C1_blue =
       (close>TR_R1 and not cross(close,TR_R2))
       or
       (close>TR_R2 and not cross(close,TR_R3))
       or
       (close>TR_R3 and not cross(low,TR_R3))
       ?1:0

//if (pp_type == "Fibonacci")
FIB_PP = (phigh + plow + pclose) / 3
FIB_R1 = FIB_PP + (phigh - plow) * 0.382
FIB_S1 = FIB_PP - (phigh - plow) * 0.382
FIB_R2 = FIB_PP + (phigh - plow) * 0.618
FIB_S2 = FIB_PP - (phigh - plow) * 0.618
FIB_R3 = FIB_PP + (phigh - plow) * 1.000
FIB_S3 = FIB_PP - (phigh - plow) * 1.000
 
C2_red =
       (close<FIB_S1 and not cross(close,FIB_S2))
       or
       (close<FIB_S2 and not cross(close,FIB_S3))
       or
       (close<FIB_S3 and not cross(high,FIB_S3))
       ?1:0

C2_blue =
       (close>FIB_R1 and not cross(close,FIB_R2))
       or
       (close>FIB_R2 and not cross(close,FIB_R3))
       or
       (close>FIB_R3 and not cross(low,FIB_R3))
       ?1:0

//if (pp_type == "Woodie")
WO_PP = (phigh + plow + 2 * popen) / 4
WO_R1 = WO_PP + (WO_PP - plow)
WO_S1 = WO_PP - (phigh - WO_PP)
WO_R2 = WO_PP + (phigh - plow)
WO_S2 = WO_PP - (phigh - plow)
WO_R3 = phigh + 2 * (WO_PP - plow)
WO_S3 = plow  - 2 * (phigh - WO_PP)
    
C3_red =
       (close<WO_S1 and not cross(close,WO_S2))
       or
       (close<WO_S2 and not cross(close,WO_S3))
       or
       (close<WO_S3 and not cross(high,WO_S3))
       ?1:0

C3_blue =
       (close>WO_R1 and not cross(close,WO_R2))
       or
       (close>WO_R2 and not cross(close,WO_R3))
       or
       (close>WO_R3 and not cross(low,WO_R3))
       ?1:0


//if (pp_type == "Camarilla")
CA_PP = (phigh + plow + pclose) / 3
CA_R1 = pclose + (phigh - plow) * 1.1/12
CA_S1 = pclose - (phigh - plow) * 1.1/12
CA_R2 = pclose + (phigh - plow) * 1.1/6
CA_S2 = pclose - (phigh - plow) * 1.1/6
CA_R3 = pclose + (phigh - plow) * 1.1/4
CA_S3 = pclose - (phigh - plow) * 1.1/4

C4_red =
       (close<CA_S1 and not cross(close,CA_S2))
       or
       (close<CA_S2 and not cross(close,CA_S3))
       or
       (close<CA_S3 and not cross(high,CA_S3))
       ?1:0

C4_blue =
       (close>CA_R1 and not cross(close,CA_R2))
       or
       (close>CA_R2 and not cross(close,CA_R3))
       or
       (close>CA_R3 and not cross(low,CA_R3))
       ?1:0


//C Point
C_red = C1_red + C2_red + C3_red + C4_red

C_blue = C1_blue + C2_blue + C3_blue + C4_blue

//Sum point
Sum_red=A_red+B_red+C_red
Sum_blue=A_blue+B_blue+C_blue
sell_point=(Sum_red/32)*100
buy_point=(Sum_blue/32)*100

//Strong Sell
stsc=input(16, title="Strong Sell")
sts_label = 14
plotshape(sts_label, title='Strong Sell', text="Strong Sell", style=shape.labeldown, location=location.absolute, color=color.orange, textcolor=color.black, offset=-stsc, transp=0,show_last=1)

//Sell
sc=input(13, title="Strong Sell")
s_label = 14
plotshape(s_label, title='Sell', text="Sell", style=shape.labeldown, location=location.absolute, color=color.orange, textcolor=color.black, offset=-sc, transp=0,show_last=1)

//Neutral
ntc=input(10, title="Neutral")
nt_label = 14
plotshape(nt_label, title='Neutral', text="Neutral", style=shape.labeldown, location=location.absolute, color=color.orange, textcolor=color.black, offset=-ntc, transp=0,show_last=1)

//Buy
bc=input(7, title="Buy")
b_label = 14
plotshape(b_label, title='Buy', text="Buy", style=shape.labeldown, location=location.absolute, color=color.orange, textcolor=color.black, offset=-bc, transp=0,show_last=1)

//Strong Buy
stbc=input(4, title="Strong Buy")
stb_label = 14
plotshape(stb_label, title='Strong Buy', text="Strong Buy", style=shape.labeldown, location=location.absolute, color=color.orange, textcolor=color.black, offset=-stbc, transp=0,show_last=1)

//Market Level
sell =
       Sum_red>Sum_blue
       and sell_point>50
       ?12:na

Strong_sell =
       A_red>A_blue
       and B_red>B_blue
       and C_red>C_blue
       and sell_point>50
       and not crossunder(sell_point,75)
       ?12:na

buy =
       Sum_red>Sum_blue
       and buy_point>50
       ?12:na

Strong_buy =
       A_red<A_blue
       and B_red<B_blue
       and C_red<C_blue
       and buy_point>50
       and not crossunder(buy_point,75)
       ?12:na

neutral = not sell and not Strong_sell and not buy and not Strong_buy?12:na

//plot wise
plotshape(sell, title='Sell', style=shape.triangleup, location=location.absolute, color=color.red, offset=-sc, transp=40,show_last=1)
plotshape(Strong_sell, title='Strong Sell', style=shape.triangleup, location=location.absolute, color=color.red, offset=-stsc, transp=0,show_last=1)
plotshape(buy, title='Buy', style=shape.triangleup, location=location.absolute, color=color.blue, offset=-bc, transp=40,show_last=1)
plotshape(Strong_buy, title='Strong Buy', style=shape.triangleup, location=location.absolute, color=color.blue, textcolor=color.black, offset=-stbc, transp=0,show_last=1)
plotshape(neutral, title='Neutral', style=shape.triangleup, location=location.absolute, color=color.aqua, offset=-ntc, transp=0,show_last=1)

//plot
h16=hline(18, linestyle=hline.style_solid, linewidth=0)


//plot info
h10=hline(10, linestyle=hline.style_solid, linewidth=0)
h0=hline(0, linestyle=hline.style_solid, linewidth=0)

//Pivot
pvc=input(17, title="Pivot Info Column")
pivot_label = 5
pivot_buy = 1
pivot_neutral = 2
pivot_sell = 3
plotshape(pivot_label, title='Pivot Info', text="Pivot Info", style=shape.labeldown, location=location.absolute, color=color.orange, textcolor=color.black, offset=-pvc, transp=0,show_last=1)
pivot_sell_text = "Sell: " + tostring(C_red)
pivot_neutral_text = "Neutral: " + tostring(4-(C_red+C_blue))
pivot_buy_text = "Buy: " + tostring(C_blue)
label_pivot_sell = label.new(bar_index[pvc], pivot_sell, text=pivot_sell_text,  style= label.style_none)
label.delete(label_pivot_sell[1])
label_pivot_neutral = label.new(bar_index[pvc], pivot_neutral, text=pivot_neutral_text,  style= label.style_none)
label.delete(label_pivot_neutral[1])
label_pivot_buy = label.new(bar_index[pvc], pivot_buy, text=pivot_buy_text,  style= label.style_none)
label.delete(label_pivot_buy[1])

//Oscillators
osc=input(12, title="Oscillators Info Column")
Oscillators_label = 5
Oscillators_buy = 1
Oscillators_neutral = 2
Oscillators_sell = 3
plotshape(Oscillators_label, title='Oscillators Info', text="Oscillators Info", style=shape.labeldown, location=location.absolute, color=color.orange, textcolor=color.black, offset=-osc, transp=0,show_last=1)
Oscillators_sell_text = "Sell: " + tostring(A_red)
Oscillators_neutral_text = "Neutral: " + tostring(11-(A_red+A_blue))
Oscillators_buy_text = "Buy: " + tostring(A_blue)
label_Oscillators_sell = label.new(bar_index[osc], Oscillators_sell, text=pivot_sell_text,  style= label.style_none)
label.delete(label_Oscillators_sell[1])
label_Oscillators_neutral = label.new(bar_index[osc], Oscillators_neutral, text=Oscillators_neutral_text,  style= label.style_none)
label.delete(label_Oscillators_neutral[1])
label_Oscillators_buy = label.new(bar_index[osc], Oscillators_buy, text=Oscillators_buy_text,  style= label.style_none)
label.delete(label_Oscillators_buy[1])

//Moving Averages
mac=input(7, title="Moving Averages Info Column")
Moving_Averages_label = 5
Moving_Averages_buy = 1
Moving_Averages_neutral = 2
Moving_Averages_sell = 3
plotshape(Moving_Averages_label, title='Moving Averages Info', text="Moving Averages Info", style=shape.labeldown, location=location.absolute, color=color.orange, textcolor=color.black, offset=-mac, transp=0,show_last=1)
Moving_Averages_sell_text = "Sell: " + tostring(B_red)
Moving_Averages_neutral_text = "Neutral: " + tostring(17-(B_red+B_blue))
Moving_Averages_buy_text = "Buy: " + tostring(B_blue)
label_Moving_Averages_sell = label.new(bar_index[mac], Moving_Averages_sell, text=Moving_Averages_sell_text,  style= label.style_none)
label.delete(label_Moving_Averages_sell[1])
label_Moving_Averages_neutral = label.new(bar_index[mac], Moving_Averages_neutral, text=Moving_Averages_neutral_text,  style= label.style_none)
label.delete(label_Moving_Averages_neutral[1])
label_Moving_Averages_buy = label.new(bar_index[mac], Moving_Averages_buy, text=Moving_Averages_buy_text,  style= label.style_none)
label.delete(label_Moving_Averages_buy[1])

//Summary
sumc=input(2, title="Summary Info Column")
Summary_label = 5
Summary_buy = 1
Summary_neutral = 2
Summary_sell = 3
plotshape(Summary_label, title='Summary Info', text="Summary Info", style=shape.labeldown, location=location.absolute, color=color.orange, textcolor=color.black, offset=-sumc, transp=0,show_last=1)
Summary_sell_text = "Sell: " + tostring(Sum_red)
Summary_neutral_text = "Neutral: " + tostring(32-(Sum_red+Sum_blue))
Summary_buy_text = "Buy: " + tostring(Sum_blue)
label_Summary_sell = label.new(bar_index[sumc], Summary_sell, text=Summary_sell_text,  style= label.style_none)
label.delete(label_Summary_sell[1])
label_Summary_neutral = label.new(bar_index[sumc], Summary_neutral, text=Summary_neutral_text,  style= label.style_none)
label.delete(label_Summary_neutral[1])
label_Summary_buy = label.new(bar_index[sumc], Summary_buy, text=Summary_buy_text,  style= label.style_none)
label.delete(label_Summary_buy[1])

//Panel
panel_size=input(20, title="Panel Size")
bgcolor(color.lime, title="Panel", transp=0, show_last=panel_size)

//EOF

=== Ảnh minh họa ===
Forex nghỉ tết, chỉ còn BTC chạy nên mình dùng BTC minh họa, anh em mở chart 1M nhìn nó chạy hén, nó chỉ là info dùng kèm với beta3 cho mọi người biết thêm nhiều thông tin hơn về chart thôi :D
chrome_eRMxZt2qVM.png
 
 
Tặng anh em hàng mới nữa nhé.
Technical Analysis - Panel Info: đem cả chiếc đồng hồ TradingView lên chart của bạn :D
=== Code ===
Mã:
//@version=4
//Technical Analysis - Panel Info
//author: anhnguyen14

study(title="Technical Analysis - Panel Info", overlay=false)

//A. Oscillators
//1. Rsi
RSI(src,per) =>
    len = per
    up = rma(max(change(src), 0), len)
    down = rma(-min(change(src), 0), len)
    rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - 100 / (1 + up / down)
    RSI=rsi
rsi_Sig=RSI(close,14)

//RSI Signal
A1_red =
       rsi_Sig<30
       ?1:0
A1_blue =
       rsi_Sig>70
       ?1:0
//2. Stochastic
STOCH(src,perK,perD,perS) =>
    K = perK
    D = perD
    smooth = perS
    hh = highest(high, K)
    ll = lowest(low, K)
    k = sma((src - ll) / (hh - ll) * 100, smooth)
    d = sma(k, D)
    STOCH=k
stoch_Sig = STOCH(close,14,3,3)
//plot(stoch_Sig,color=color.green)

//STOCH Signal
A2_red =
       stoch_Sig<20
       ?1:0
A2_blue =
       stoch_Sig>80
       ?1:0

//3. CCI
CCI(src,per) =>
    lengthcci1 = per
    macci1 = sma(src, lengthcci1)
    cci1 = (src - macci1) / (0.015 * dev(src, lengthcci1))
    CCI = cci1
cci_Sig=CCI(close,20)
//plot(cci_Sig,color=color.blue)

//CCI Signal
A3_red =
       cci_Sig<-100
       ?1:0
A3_blue =
       cci_Sig>100
       ?1:0

//4. ADX
adxlen = 14
dilen = 14
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)

adxHigh(dilen, adxlen) =>
    [plus, minus] = dirmov(dilen)
    plus
   
adxLow(dilen, adxlen) =>
    [plus, minus] = dirmov(dilen)
    minus
   
ADX_Sig = ADX(dilen, adxlen)
di_sigHigh = adxHigh(dilen, adxlen)
di_sigLow = adxLow(dilen, adxlen)
//plot(ADX_Sig)

//ADX Signal
A4_red =
       di_sigLow>di_sigHigh
       and ADX_Sig>25
       ?1:0
A4_blue =
       di_sigHigh>di_sigLow
       and ADX_Sig>25
       ?1:0

//5. AO
ao = sma(hl2,5) - sma(hl2,34)

//AO Signal
A5_red =
       ao<0
       ?1:0
A5_blue =
       ao>0
       ?1:0
//6. momentum
mom = close - close[10]

//momentum Signal
A6_red =
       mom<0
       ?1:0
A6_blue =
       mom>0
       ?1:0

//7. MACD
fast_ma = ema(close, 12)
slow_ma = ema(close, 26)
macd = fast_ma - slow_ma
signal = ema(macd, 9)
hist = macd - signal

//MACD Signal
A7_red =
       hist < hist[1]
       ?1:0
A7_blue =
       hist > hist[1]
       ?1:0

//8. Stoch RSI
rsi1 = rsi(close, 14)
rsik = sma(stoch(rsi1, rsi1, rsi1, 14), 3)
rsid = sma(rsik, 3)
rsih0 = 80
rsih1 = 20

//Stoch RSI Signal
A8_red =
       rsik < rsih1
       ?1:0
A8_blue =
       rsik > rsih0
       ?1:0

//9. %R
upper = highest(14)
lower = lowest(14)
out = 100 * (close - upper) / (upper - lower)
rband1 = -20
rband0 = -80

// %R Signal
A9_red =
       out < rband0
       ?1:0
A9_blue =
       out > rband1
       ?1:0

//10. Bull bear
Length = 30
r1=iff(close[1]<open,max(open-close[1],high-low),high-low)
r2=iff(close[1]>open,max(close[1]-open,high-low),high-low)
bull=iff(close==open,iff(high-close==close-low,iff(close[1]>open,max(high-open,close-low),r1),iff(high-close>close-low,iff(close[1]<open, max(high-close[1],close-low), high-open),r1)),iff(close<open,iff(close[1]<open,max(high-close[1],close-low), max(high-open,close-low)),r1))
bear=iff(close==open,iff(high-close==close-low,iff(close[1]<open,max(open-low,high-close),r2),iff(high-close>close-low,r2,iff(close[1]>open,max(close[1]-low,high-close), open-low))),iff(close<open,r2,iff(close[1]>open,max(close[1]-low,high-close),max(open-low,high-close))))

// Bull bear Signal
A10_red =
       sma(bull-bear,Length)<0
       ?1:0
A10_blue =
       sma(bull-bear,Length)>0
       ?1:0

//11.UO
length7 = 7,
length14 = 14,
length28 = 28
average(bp, tr_, length) => sum(bp, length) / sum(tr_, length)
high_ = max(high, close[1])
low_ = min(low, close[1])
bp = close - low_
tr_ = high_ - low_
avg7 = average(bp, tr_, length7)
avg14 = average(bp, tr_, length14)
avg28 = average(bp, tr_, length28)
uoout = 100 * (4*avg7 + 2*avg14 + avg28)/7

// UO Signal
A11_red =
       uoout < 30
       ?1:0
A11_blue =
       uoout > 70
       ?1:0

//Sum Signal A
A_red = A1_red + A2_red + A3_red + A4_red + A5_red + A6_red + A7_red + A8_red + A9_red + A10_red + A11_red
A_blue = A1_blue + A2_blue + A3_blue + A4_blue + A5_blue + A6_blue + A7_blue + A8_blue + A9_blue + A10_blue + A11_blue

//B. Moving Averages
//1. ema 5
B1_red =
       close<ema(close,5)
       ?1:0
B1_blue =
       close>ema(close,5)
       ?1:0

//2. sma 5
B2_red =
       close<sma(close,5)
       ?1:0
B2_blue =
       close>sma(close,5)
       ?1:0

//3. ema 10
B3_red =
       close<ema(close,10)
       ?1:0
B3_blue =
       close>ema(close,10)
       ?1:0

//4. sma 10
B4_red =
       close<sma(close,10)
       ?1:0
B4_blue =
       close>sma(close,10)
       ?1:0

//5. ema 20
B5_red =
       close<ema(close,20)
       ?1:0
B5_blue =
       close>ema(close,20)
       ?1:0

//6. sma 20
B6_red =
       close<sma(close,20)
       ?1:0
B6_blue =
       close>sma(close,20)
       ?1:0

//7. ema 30
B7_red =
       close<ema(close,30)
       ?1:0
B7_blue =
       close>ema(close,30)
       ?1:0

//8. sma 30
B8_red =
       close<sma(close,30)
       ?1:0
B8_blue =
       close>sma(close,30)
       ?1:0

//9. ema 50
B9_red =
       close<ema(close,50)
       ?1:0
B9_blue =
       close>ema(close,50)
       ?1:0
//10. sma 50
B10_red =
       close<sma(close,50)
       ?1:0
B10_blue =
       close>sma(close,50)
       ?1:0

//11. ema 100
B11_red =
       close<ema(close,100)
       ?1:0
B11_blue =
       close>ema(close,100)
       ?1:0

//12. sma 100
B12_red =
       close<sma(close,100)
       ?1:0
B12_blue =
       close>sma(close,100)
       ?1:0

//13. ema 200
B13_red =
       close<ema(close,200)
       ?1:0
B13_blue =
       close>ema(close,200)
       ?1:0

//14. sma 200
B14_red =
       close<sma(close,200)
       ?1:0
B14_blue =
       close>sma(close,200)
       ?1:0

//15. Ichimoku Cloud - Baseline
donchian(len) => avg(lowest(len), highest(len))
ichi_baseline = donchian(26)
B15_red =
       close<ichi_baseline
       ?1:0
B15_blue =
       close>ichi_baseline
       ?1:0

//16. VWMA 20
B16_red =
       close<vwma(close,20)
       ?1:0
B16_blue =
       close>vwma(close,20)
       ?1:0

//17. Hull 9
hma(src,len) => wma(2*wma(src, len/2)-wma(src, len), round(sqrt(len)))
B17_red =
       close<hma(close,9)
       ?1:0
B17_blue =
       close>hma(close,9)
       ?1:0

//Sum Signal B
B_red = B1_red + B2_red + B3_red + B4_red + B5_red + B6_red + B7_red + B8_red + B9_red + B10_red + B11_red + B12_red + B13_red + B14_red + B15_red + B16_red + B17_red
B_blue = B1_blue + B2_blue + B3_blue + B4_blue + B5_blue + B6_blue + B7_blue + B8_blue + B9_blue + B10_blue + B11_blue + B12_blue + B13_blue + B14_blue + B15_blue + B16_blue + B17_blue

//C. Pivot

///////////////
// FUNCTIONS //
///////////////

// Function outputs 1 when it's the first bar of the D/W/M/Y
is_newbar(res) =>
    ch = 0
    if(res == 'Y')
        t  = year(time('D'))
        ch := change(t) != 0 ? 1 : 0
    else
        t = time(res)
        ch := change(t) != 0 ? 1 : 0
    ch

// Rounding levels to min tick
nround(x) =>
    n = round(x / syminfo.mintick) * syminfo.mintick

////////////
// INPUTS //
////////////

pp_res = 'D'

/////////////////////
// Get HLC from HT //

// Calc Open
open_cur = 0.0
open_cur := is_newbar(pp_res) ? open : open_cur[1]

popen = 0.0
popen := is_newbar(pp_res) ? open_cur[1] : popen[1]

// Calc High
high_cur = 0.0
high_cur := is_newbar(pp_res) ? high : max(high_cur[1], high)

phigh = 0.0
phigh := is_newbar(pp_res) ? high_cur[1] : phigh[1]

// Calc Low
low_cur = 0.0
low_cur := is_newbar(pp_res) ? low : min(low_cur[1], low)

plow = 0.0
plow := is_newbar(pp_res) ? low_cur[1] : plow[1]

// Calc Close
pclose = 0.0
pclose := is_newbar(pp_res) ? close[1] : pclose[1]


////////////////////////////
// CALCULATE Pivot POINTS //
////////////////////////////

PP = 0.0
R1 = 0.0, R2 = 0.0, R3 = 0.0
S1 = 0.0, S2 = 0.0, S3 = 0.0

//if (pp_type == "Traditional")
TR_PP = (phigh + plow + pclose) / 3
TR_R1 = TR_PP     + (TR_PP   - plow)
TR_S1 = TR_PP     - (phigh - TR_PP)
TR_R2 = TR_PP     + (phigh - plow)
TR_S2 = TR_PP     - (phigh - plow)
TR_R3 = phigh  + 2 * (TR_PP   - plow)
TR_S3 = plow   - 2 * (phigh - TR_PP)

//Signal

C1_red =
       (close<TR_S1 and not cross(close,TR_S2))
       or
       (close<TR_S2 and not cross(close,TR_S3))
       or
       (close<TR_S3 and not cross(high,TR_S3))
       ?1:0
 
C1_blue =
       (close>TR_R1 and not cross(close,TR_R2))
       or
       (close>TR_R2 and not cross(close,TR_R3))
       or
       (close>TR_R3 and not cross(low,TR_R3))
       ?1:0

//if (pp_type == "Fibonacci")
FIB_PP = (phigh + plow + pclose) / 3
FIB_R1 = FIB_PP + (phigh - plow) * 0.382
FIB_S1 = FIB_PP - (phigh - plow) * 0.382
FIB_R2 = FIB_PP + (phigh - plow) * 0.618
FIB_S2 = FIB_PP - (phigh - plow) * 0.618
FIB_R3 = FIB_PP + (phigh - plow) * 1.000
FIB_S3 = FIB_PP - (phigh - plow) * 1.000
 
C2_red =
       (close<FIB_S1 and not cross(close,FIB_S2))
       or
       (close<FIB_S2 and not cross(close,FIB_S3))
       or
       (close<FIB_S3 and not cross(high,FIB_S3))
       ?1:0

C2_blue =
       (close>FIB_R1 and not cross(close,FIB_R2))
       or
       (close>FIB_R2 and not cross(close,FIB_R3))
       or
       (close>FIB_R3 and not cross(low,FIB_R3))
       ?1:0

//if (pp_type == "Woodie")
WO_PP = (phigh + plow + 2 * popen) / 4
WO_R1 = WO_PP + (WO_PP - plow)
WO_S1 = WO_PP - (phigh - WO_PP)
WO_R2 = WO_PP + (phigh - plow)
WO_S2 = WO_PP - (phigh - plow)
WO_R3 = phigh + 2 * (WO_PP - plow)
WO_S3 = plow  - 2 * (phigh - WO_PP)
   
C3_red =
       (close<WO_S1 and not cross(close,WO_S2))
       or
       (close<WO_S2 and not cross(close,WO_S3))
       or
       (close<WO_S3 and not cross(high,WO_S3))
       ?1:0

C3_blue =
       (close>WO_R1 and not cross(close,WO_R2))
       or
       (close>WO_R2 and not cross(close,WO_R3))
       or
       (close>WO_R3 and not cross(low,WO_R3))
       ?1:0


//if (pp_type == "Camarilla")
CA_PP = (phigh + plow + pclose) / 3
CA_R1 = pclose + (phigh - plow) * 1.1/12
CA_S1 = pclose - (phigh - plow) * 1.1/12
CA_R2 = pclose + (phigh - plow) * 1.1/6
CA_S2 = pclose - (phigh - plow) * 1.1/6
CA_R3 = pclose + (phigh - plow) * 1.1/4
CA_S3 = pclose - (phigh - plow) * 1.1/4

C4_red =
       (close<CA_S1 and not cross(close,CA_S2))
       or
       (close<CA_S2 and not cross(close,CA_S3))
       or
       (close<CA_S3 and not cross(high,CA_S3))
       ?1:0

C4_blue =
       (close>CA_R1 and not cross(close,CA_R2))
       or
       (close>CA_R2 and not cross(close,CA_R3))
       or
       (close>CA_R3 and not cross(low,CA_R3))
       ?1:0


//C Point
C_red = C1_red + C2_red + C3_red + C4_red

C_blue = C1_blue + C2_blue + C3_blue + C4_blue

//Sum point
Sum_red=A_red+B_red+C_red
Sum_blue=A_blue+B_blue+C_blue
sell_point=(Sum_red/32)*100
buy_point=(Sum_blue/32)*100

//Strong Sell
stsc=input(16, title="Strong Sell")
sts_label = 14
plotshape(sts_label, title='Strong Sell', text="Strong Sell", style=shape.labeldown, location=location.absolute, color=color.orange, textcolor=color.black, offset=-stsc, transp=0,show_last=1)

//Sell
sc=input(13, title="Strong Sell")
s_label = 14
plotshape(s_label, title='Sell', text="Sell", style=shape.labeldown, location=location.absolute, color=color.orange, textcolor=color.black, offset=-sc, transp=0,show_last=1)

//Neutral
ntc=input(10, title="Neutral")
nt_label = 14
plotshape(nt_label, title='Neutral', text="Neutral", style=shape.labeldown, location=location.absolute, color=color.orange, textcolor=color.black, offset=-ntc, transp=0,show_last=1)

//Buy
bc=input(7, title="Buy")
b_label = 14
plotshape(b_label, title='Buy', text="Buy", style=shape.labeldown, location=location.absolute, color=color.orange, textcolor=color.black, offset=-bc, transp=0,show_last=1)

//Strong Buy
stbc=input(4, title="Strong Buy")
stb_label = 14
plotshape(stb_label, title='Strong Buy', text="Strong Buy", style=shape.labeldown, location=location.absolute, color=color.orange, textcolor=color.black, offset=-stbc, transp=0,show_last=1)

//Market Level
sell =
       Sum_red>Sum_blue
       and sell_point>50
       ?12:na

Strong_sell =
       A_red>A_blue
       and B_red>B_blue
       and C_red>C_blue
       and sell_point>50
       and not crossunder(sell_point,75)
       ?12:na

buy =
       Sum_red>Sum_blue
       and buy_point>50
       ?12:na

Strong_buy =
       A_red<A_blue
       and B_red<B_blue
       and C_red<C_blue
       and buy_point>50
       and not crossunder(buy_point,75)
       ?12:na

neutral = not sell and not Strong_sell and not buy and not Strong_buy?12:na

//plot wise
plotshape(sell, title='Sell', style=shape.triangleup, location=location.absolute, color=color.red, offset=-sc, transp=40,show_last=1)
plotshape(Strong_sell, title='Strong Sell', style=shape.triangleup, location=location.absolute, color=color.red, offset=-stsc, transp=0,show_last=1)
plotshape(buy, title='Buy', style=shape.triangleup, location=location.absolute, color=color.blue, offset=-bc, transp=40,show_last=1)
plotshape(Strong_buy, title='Strong Buy', style=shape.triangleup, location=location.absolute, color=color.blue, textcolor=color.black, offset=-stbc, transp=0,show_last=1)
plotshape(neutral, title='Neutral', style=shape.triangleup, location=location.absolute, color=color.aqua, offset=-ntc, transp=0,show_last=1)

//plot
h16=hline(18, linestyle=hline.style_solid, linewidth=0)


//plot info
h10=hline(10, linestyle=hline.style_solid, linewidth=0)
h0=hline(0, linestyle=hline.style_solid, linewidth=0)

//Pivot
pvc=input(17, title="Pivot Info Column")
pivot_label = 5
pivot_buy = 1
pivot_neutral = 2
pivot_sell = 3
plotshape(pivot_label, title='Pivot Info', text="Pivot Info", style=shape.labeldown, location=location.absolute, color=color.orange, textcolor=color.black, offset=-pvc, transp=0,show_last=1)
pivot_sell_text = "Sell: " + tostring(C_red)
pivot_neutral_text = "Neutral: " + tostring(4-(C_red+C_blue))
pivot_buy_text = "Buy: " + tostring(C_blue)
label_pivot_sell = label.new(bar_index[pvc], pivot_sell, text=pivot_sell_text,  style= label.style_none)
label.delete(label_pivot_sell[1])
label_pivot_neutral = label.new(bar_index[pvc], pivot_neutral, text=pivot_neutral_text,  style= label.style_none)
label.delete(label_pivot_neutral[1])
label_pivot_buy = label.new(bar_index[pvc], pivot_buy, text=pivot_buy_text,  style= label.style_none)
label.delete(label_pivot_buy[1])

//Oscillators
osc=input(12, title="Oscillators Info Column")
Oscillators_label = 5
Oscillators_buy = 1
Oscillators_neutral = 2
Oscillators_sell = 3
plotshape(Oscillators_label, title='Oscillators Info', text="Oscillators Info", style=shape.labeldown, location=location.absolute, color=color.orange, textcolor=color.black, offset=-osc, transp=0,show_last=1)
Oscillators_sell_text = "Sell: " + tostring(A_red)
Oscillators_neutral_text = "Neutral: " + tostring(11-(A_red+A_blue))
Oscillators_buy_text = "Buy: " + tostring(A_blue)
label_Oscillators_sell = label.new(bar_index[osc], Oscillators_sell, text=pivot_sell_text,  style= label.style_none)
label.delete(label_Oscillators_sell[1])
label_Oscillators_neutral = label.new(bar_index[osc], Oscillators_neutral, text=Oscillators_neutral_text,  style= label.style_none)
label.delete(label_Oscillators_neutral[1])
label_Oscillators_buy = label.new(bar_index[osc], Oscillators_buy, text=Oscillators_buy_text,  style= label.style_none)
label.delete(label_Oscillators_buy[1])

//Moving Averages
mac=input(7, title="Moving Averages Info Column")
Moving_Averages_label = 5
Moving_Averages_buy = 1
Moving_Averages_neutral = 2
Moving_Averages_sell = 3
plotshape(Moving_Averages_label, title='Moving Averages Info', text="Moving Averages Info", style=shape.labeldown, location=location.absolute, color=color.orange, textcolor=color.black, offset=-mac, transp=0,show_last=1)
Moving_Averages_sell_text = "Sell: " + tostring(B_red)
Moving_Averages_neutral_text = "Neutral: " + tostring(17-(B_red+B_blue))
Moving_Averages_buy_text = "Buy: " + tostring(B_blue)
label_Moving_Averages_sell = label.new(bar_index[mac], Moving_Averages_sell, text=Moving_Averages_sell_text,  style= label.style_none)
label.delete(label_Moving_Averages_sell[1])
label_Moving_Averages_neutral = label.new(bar_index[mac], Moving_Averages_neutral, text=Moving_Averages_neutral_text,  style= label.style_none)
label.delete(label_Moving_Averages_neutral[1])
label_Moving_Averages_buy = label.new(bar_index[mac], Moving_Averages_buy, text=Moving_Averages_buy_text,  style= label.style_none)
label.delete(label_Moving_Averages_buy[1])

//Summary
sumc=input(2, title="Summary Info Column")
Summary_label = 5
Summary_buy = 1
Summary_neutral = 2
Summary_sell = 3
plotshape(Summary_label, title='Summary Info', text="Summary Info", style=shape.labeldown, location=location.absolute, color=color.orange, textcolor=color.black, offset=-sumc, transp=0,show_last=1)
Summary_sell_text = "Sell: " + tostring(Sum_red)
Summary_neutral_text = "Neutral: " + tostring(32-(Sum_red+Sum_blue))
Summary_buy_text = "Buy: " + tostring(Sum_blue)
label_Summary_sell = label.new(bar_index[sumc], Summary_sell, text=Summary_sell_text,  style= label.style_none)
label.delete(label_Summary_sell[1])
label_Summary_neutral = label.new(bar_index[sumc], Summary_neutral, text=Summary_neutral_text,  style= label.style_none)
label.delete(label_Summary_neutral[1])
label_Summary_buy = label.new(bar_index[sumc], Summary_buy, text=Summary_buy_text,  style= label.style_none)
label.delete(label_Summary_buy[1])

//Panel
panel_size=input(20, title="Panel Size")
bgcolor(color.lime, title="Panel", transp=0, show_last=panel_size)

//EOF

=== Ảnh minh họa ===
Forex nghỉ tết, chỉ còn BTC chạy nên mình dùng BTC minh họa, anh em mở chart 1M nhìn nó chạy hén, nó chỉ là info dùng kèm với beta3 cho mọi người biết thêm nhiều thông tin hơn về chart thôi :D
chrome_eRMxZt2qVM.png
kHi lệnh Call hoặc Put phát ra, thì con só trong vùng bao nhiêu là hiệu quả nhất Bác??
 
 
kHi lệnh Call hoặc Put phát ra, thì con só trong vùng bao nhiêu là hiệu quả nhất Bác??
Trend tốt (xanh hoặc đỏ kéo dài) thì khi lực thuận trend từ dưới 50 cắt lên là vừa hết sóng hồi, sóng đẩy quay lại, lúc này là ngon nhất, khi số điểm tăng lên vượt qua 75 và bắt đầu giảm điểm thì vẫn vào được, nhưng giá sẽ ko đi mạnh nữa, khi điểm giảm xuống dưới 75 thì tức là sóng đẩy ko còn mạnh, sắp có hoặc đã có sóng hồi, 75 là số điểm tương đối :)
 
 
Trend tốt (xanh hoặc đỏ kéo dài) thì khi lực thuận trend từ dưới 50 cắt lên là vừa hết sóng hồi, sóng đẩy quay lại, lúc này là ngon nhất, khi số điểm tăng lên vượt qua 75 và bắt đầu giảm điểm thì vẫn vào được, nhưng giá sẽ ko đi mạnh nữa, khi điểm giảm xuống dưới 75 thì tức là sóng đẩy ko còn mạnh, sắp có hoặc đã có sóng hồi, 75 là số điểm tương đối :)
Cái điểm số này Bác làm thêm 1 đường dạng line để quan sát rễ hơn đc ko??
 
 
Hi. Thanks bác. Chúc bác năm mới an khang, thịnh vượng, gặp nhiều may mắn. Nhất là sẽ tìm ra đc chén thánh để ae ăn ké cửa của bác...
Mà nay bác rảnh dỗi chụp màn hình cho ae chiêm ngưỡng con marco nó hoạt động như nào.
Nói thật là e chưa hiểu kiểu bắn lệnh của con marco lắm
Bạn xem cái này để biết macro nó hoạt động thế nào, nhưng mà muốn có 1 con macro ngon thì phải tìm người biết code macro nha, code cặp mắt và ngón tay cho nó í, hhihih, và người đó ko phải là mình nha, mình ăn sẵn thôi, cái này mỗi máy code mỗi khác phụ thuộc vào bố cục cửa sổ của mỗi cá nhân :D
 
 
Cái đồng hồ đó, nó chén tất tần tật từ BO, Forex, Crypto đến Chứng Khoán, kakaka, xuất bản lên cộng đồng TradingView luôn :D nhưng nó chưa đưa vào thư viện công khai, không biết có cần thêm lượt thích để xuất hiện ko nữa :D
Nếu mình đánh theo tín hiệu từ cái cột màu kia, thì có backtest đc qus khứ ko bác??
Và backtest bằng cách nào? kiểm tra thêm cả chuỗi lệnh thua liên tiếp đc ko??
 
 

Đính kèm

  • dh2.png
    dh2.png
    204.2 KB · Xem: 31
Nếu mình đánh theo tín hiệu từ cái cột màu kia, thì có backtest đc qus khứ ko bác??
Và backtest bằng cách nào? kiểm tra thêm cả chuỗi lệnh thua liên tiếp đc ko??
hihih, không được á, cái này nó chạy live, không backtest được vì cột màu đó nó nhấp nháy theo tick :)
 
 
*** Cập nhật code Panel Info ***
Mã:
//@version=4
//A. Oscillators & B. Moving Averages base on TradingView's Technical Analysis by ThiagoSchmitz
//C.Pivot base on Ultimate Pivot Points Alerts [Modified] by elbartt
//D. Summary & Panel info by anhnguyen14
//Technical Analysis - Panel Info
//author: anhnguyen14

study(title="Technical Analysis - Panel Info", overlay=false)

//A. Oscillators
//1. Rsi
RSI(src,per) =>
    len = per
    up = rma(max(change(src), 0), len)
    down = rma(-min(change(src), 0), len)
    rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - 100 / (1 + up / down)
    RSI=rsi
rsi_Sig=RSI(close,14)

//RSI Signal
A1_red =
       rsi_Sig<30
       ?1:0
A1_blue =
       rsi_Sig>70
       ?1:0
//2. Stochastic
STOCH(src,perK,perD,perS) =>
    K = perK
    D = perD
    smooth = perS
    hh = highest(high, K)
    ll = lowest(low, K)
    k = sma((src - ll) / (hh - ll) * 100, smooth)
    d = sma(k, D)
    STOCH=k
stoch_Sig = STOCH(close,14,3,3)
//plot(stoch_Sig,color=color.green)

//STOCH Signal
A2_red =
       stoch_Sig<20
       ?1:0
A2_blue =
       stoch_Sig>80
       ?1:0

//3. CCI
CCI(src,per) =>
    lengthcci1 = per
    macci1 = sma(src, lengthcci1)
    cci1 = (src - macci1) / (0.015 * dev(src, lengthcci1))
    CCI = cci1
cci_Sig=CCI(close,20)
//plot(cci_Sig,color=color.blue)

//CCI Signal
A3_red =
       cci_Sig<-100
       ?1:0
A3_blue =
       cci_Sig>100
       ?1:0

//4. ADX
adxlen = 14
dilen = 14
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)

adxHigh(dilen, adxlen) =>
    [plus, minus] = dirmov(dilen)
    plus
    
adxLow(dilen, adxlen) =>
    [plus, minus] = dirmov(dilen)
    minus
    
ADX_Sig = ADX(dilen, adxlen)
di_sigHigh = adxHigh(dilen, adxlen)
di_sigLow = adxLow(dilen, adxlen)
//plot(ADX_Sig)

//ADX Signal
A4_red =
       di_sigLow>di_sigHigh
       and ADX_Sig>25
       ?1:0
A4_blue =
       di_sigHigh>di_sigLow
       and ADX_Sig>25
       ?1:0

//5. AO
ao = sma(hl2,5) - sma(hl2,34)

//AO Signal
A5_red =
       ao<0
       ?1:0
A5_blue =
       ao>0
       ?1:0
//6. momentum
mom = close - close[10]

//momentum Signal
A6_red =
       mom<0
       ?1:0
A6_blue =
       mom>0
       ?1:0

//7. MACD
fast_ma = ema(close, 12)
slow_ma = ema(close, 26)
macd = fast_ma - slow_ma
signal = ema(macd, 9)
hist = macd - signal

//MACD Signal
A7_red =
       hist < hist[1]
       ?1:0
A7_blue =
       hist > hist[1]
       ?1:0

//8. Stoch RSI
rsi1 = rsi(close, 14)
rsik = sma(stoch(rsi1, rsi1, rsi1, 14), 3)
rsid = sma(rsik, 3)
rsih0 = 80
rsih1 = 20

//Stoch RSI Signal
A8_red =
       rsik < rsih1
       ?1:0
A8_blue =
       rsik > rsih0
       ?1:0

//9. %R
upper = highest(14)
lower = lowest(14)
out = 100 * (close - upper) / (upper - lower)
rband1 = -20
rband0 = -80

// %R Signal
A9_red =
       out < rband0
       ?1:0
A9_blue =
       out > rband1
       ?1:0

//10. Bull bear
Length = 30
r1=iff(close[1]<open,max(open-close[1],high-low),high-low)
r2=iff(close[1]>open,max(close[1]-open,high-low),high-low)
bull=iff(close==open,iff(high-close==close-low,iff(close[1]>open,max(high-open,close-low),r1),iff(high-close>close-low,iff(close[1]<open, max(high-close[1],close-low), high-open),r1)),iff(close<open,iff(close[1]<open,max(high-close[1],close-low), max(high-open,close-low)),r1))
bear=iff(close==open,iff(high-close==close-low,iff(close[1]<open,max(open-low,high-close),r2),iff(high-close>close-low,r2,iff(close[1]>open,max(close[1]-low,high-close), open-low))),iff(close<open,r2,iff(close[1]>open,max(close[1]-low,high-close),max(open-low,high-close))))

// Bull bear Signal
A10_red =
       sma(bull-bear,Length)<0
       ?1:0
A10_blue =
       sma(bull-bear,Length)>0
       ?1:0

//11.UO
length7 = 7,
length14 = 14,
length28 = 28
average(bp, tr_, length) => sum(bp, length) / sum(tr_, length)
high_ = max(high, close[1])
low_ = min(low, close[1])
bp = close - low_
tr_ = high_ - low_
avg7 = average(bp, tr_, length7)
avg14 = average(bp, tr_, length14)
avg28 = average(bp, tr_, length28)
uoout = 100 * (4*avg7 + 2*avg14 + avg28)/7

// UO Signal
A11_red =
       uoout < 30
       ?1:0
A11_blue =
       uoout > 70
       ?1:0

//Sum Signal A
A_red = A1_red + A2_red + A3_red + A4_red + A5_red + A6_red + A7_red + A8_red + A9_red + A10_red + A11_red
A_blue = A1_blue + A2_blue + A3_blue + A4_blue + A5_blue + A6_blue + A7_blue + A8_blue + A9_blue + A10_blue + A11_blue

//B. Moving Averages
//1. ema 5
B1_red =
       close<ema(close,5)
       ?1:0
B1_blue =
       close>ema(close,5)
       ?1:0

//2. sma 5
B2_red =
       close<sma(close,5)
       ?1:0
B2_blue =
       close>sma(close,5)
       ?1:0

//3. ema 10
B3_red =
       close<ema(close,10)
       ?1:0
B3_blue =
       close>ema(close,10)
       ?1:0

//4. sma 10
B4_red =
       close<sma(close,10)
       ?1:0
B4_blue =
       close>sma(close,10)
       ?1:0

//5. ema 20
B5_red =
       close<ema(close,20)
       ?1:0
B5_blue =
       close>ema(close,20)
       ?1:0

//6. sma 20
B6_red =
       close<sma(close,20)
       ?1:0
B6_blue =
       close>sma(close,20)
       ?1:0

//7. ema 30
B7_red =
       close<ema(close,30)
       ?1:0
B7_blue =
       close>ema(close,30)
       ?1:0

//8. sma 30
B8_red =
       close<sma(close,30)
       ?1:0
B8_blue =
       close>sma(close,30)
       ?1:0

//9. ema 50
B9_red =
       close<ema(close,50)
       ?1:0
B9_blue =
       close>ema(close,50)
       ?1:0
//10. sma 50
B10_red =
       close<sma(close,50)
       ?1:0
B10_blue =
       close>sma(close,50)
       ?1:0

//11. ema 100
B11_red =
       close<ema(close,100)
       ?1:0
B11_blue =
       close>ema(close,100)
       ?1:0

//12. sma 100
B12_red =
       close<sma(close,100)
       ?1:0
B12_blue =
       close>sma(close,100)
       ?1:0

//13. ema 200
B13_red =
       close<ema(close,200)
       ?1:0
B13_blue =
       close>ema(close,200)
       ?1:0

//14. sma 200
B14_red =
       close<sma(close,200)
       ?1:0
B14_blue =
       close>sma(close,200)
       ?1:0

//15. Ichimoku Cloud - Baseline
donchian(len) => avg(lowest(len), highest(len))
ichi_baseline = donchian(26)
B15_red =
       close<ichi_baseline
       ?1:0
B15_blue =
       close>ichi_baseline
       ?1:0

//16. VWMA 20
B16_red =
       close<vwma(close,20)
       ?1:0
B16_blue =
       close>vwma(close,20)
       ?1:0

//17. Hull 9
hma(src,len) => wma(2*wma(src, len/2)-wma(src, len), round(sqrt(len)))
B17_red =
       close<hma(close,9)
       ?1:0
B17_blue =
       close>hma(close,9)
       ?1:0

//Sum Signal B
B_red = B1_red + B2_red + B3_red + B4_red + B5_red + B6_red + B7_red + B8_red + B9_red + B10_red + B11_red + B12_red + B13_red + B14_red + B15_red + B16_red + B17_red
B_blue = B1_blue + B2_blue + B3_blue + B4_blue + B5_blue + B6_blue + B7_blue + B8_blue + B9_blue + B10_blue + B11_blue + B12_blue + B13_blue + B14_blue + B15_blue + B16_blue + B17_blue

//C. Pivot

///////////////
// FUNCTIONS //
///////////////

// Function outputs 1 when it's the first bar of the D/W/M/Y
is_newbar(res) =>
    ch = 0
    if(res == 'Y')
        t  = year(time('D'))
        ch := change(t) != 0 ? 1 : 0
    else
        t = time(res)
        ch := change(t) != 0 ? 1 : 0
    ch

// Rounding levels to min tick
nround(x) =>
    n = round(x / syminfo.mintick) * syminfo.mintick

////////////
// INPUTS //
////////////

pp_res = 'D'

/////////////////////
// Get HLC from HT //

// Calc Open
open_cur = 0.0
open_cur := is_newbar(pp_res) ? open : open_cur[1]

popen = 0.0
popen := is_newbar(pp_res) ? open_cur[1] : popen[1]

// Calc High
high_cur = 0.0
high_cur := is_newbar(pp_res) ? high : max(high_cur[1], high)

phigh = 0.0
phigh := is_newbar(pp_res) ? high_cur[1] : phigh[1]

// Calc Low
low_cur = 0.0
low_cur := is_newbar(pp_res) ? low : min(low_cur[1], low)

plow = 0.0
plow := is_newbar(pp_res) ? low_cur[1] : plow[1]

// Calc Close
pclose = 0.0
pclose := is_newbar(pp_res) ? close[1] : pclose[1]


////////////////////////////
// CALCULATE Pivot POINTS //
////////////////////////////

PP = 0.0
R1 = 0.0, R2 = 0.0, R3 = 0.0
S1 = 0.0, S2 = 0.0, S3 = 0.0

//if (pp_type == "Traditional")
TR_PP = (phigh + plow + pclose) / 3
TR_R1 = TR_PP     + (TR_PP   - plow)
TR_S1 = TR_PP     - (phigh - TR_PP)
TR_R2 = TR_PP     + (phigh - plow)
TR_S2 = TR_PP     - (phigh - plow)
TR_R3 = phigh  + 2 * (TR_PP   - plow)
TR_S3 = plow   - 2 * (phigh - TR_PP)

//Signal

C1_red =
       (close<TR_S1 and not cross(close,TR_S2))
       or
       (close<TR_S2 and not cross(close,TR_S3))
       or
       (close<TR_S3 and not cross(high,TR_S3))
       ?1:0
 
C1_blue =
       (close>TR_R1 and not cross(close,TR_R2))
       or
       (close>TR_R2 and not cross(close,TR_R3))
       or
       (close>TR_R3 and not cross(low,TR_R3))
       ?1:0

//if (pp_type == "Fibonacci")
FIB_PP = (phigh + plow + pclose) / 3
FIB_R1 = FIB_PP + (phigh - plow) * 0.382
FIB_S1 = FIB_PP - (phigh - plow) * 0.382
FIB_R2 = FIB_PP + (phigh - plow) * 0.618
FIB_S2 = FIB_PP - (phigh - plow) * 0.618
FIB_R3 = FIB_PP + (phigh - plow) * 1.000
FIB_S3 = FIB_PP - (phigh - plow) * 1.000
 
C2_red =
       (close<FIB_S1 and not cross(close,FIB_S2))
       or
       (close<FIB_S2 and not cross(close,FIB_S3))
       or
       (close<FIB_S3 and not cross(high,FIB_S3))
       ?1:0

C2_blue =
       (close>FIB_R1 and not cross(close,FIB_R2))
       or
       (close>FIB_R2 and not cross(close,FIB_R3))
       or
       (close>FIB_R3 and not cross(low,FIB_R3))
       ?1:0

//if (pp_type == "Woodie")
WO_PP = (phigh + plow + 2 * popen) / 4
WO_R1 = WO_PP + (WO_PP - plow)
WO_S1 = WO_PP - (phigh - WO_PP)
WO_R2 = WO_PP + (phigh - plow)
WO_S2 = WO_PP - (phigh - plow)
WO_R3 = phigh + 2 * (WO_PP - plow)
WO_S3 = plow  - 2 * (phigh - WO_PP)
    
C3_red =
       (close<WO_S1 and not cross(close,WO_S2))
       or
       (close<WO_S2 and not cross(close,WO_S3))
       or
       (close<WO_S3 and not cross(high,WO_S3))
       ?1:0

C3_blue =
       (close>WO_R1 and not cross(close,WO_R2))
       or
       (close>WO_R2 and not cross(close,WO_R3))
       or
       (close>WO_R3 and not cross(low,WO_R3))
       ?1:0


//if (pp_type == "Camarilla")
CA_PP = (phigh + plow + pclose) / 3
CA_R1 = pclose + (phigh - plow) * 1.1/12
CA_S1 = pclose - (phigh - plow) * 1.1/12
CA_R2 = pclose + (phigh - plow) * 1.1/6
CA_S2 = pclose - (phigh - plow) * 1.1/6
CA_R3 = pclose + (phigh - plow) * 1.1/4
CA_S3 = pclose - (phigh - plow) * 1.1/4

C4_red =
       (close<CA_S1 and not cross(close,CA_S2))
       or
       (close<CA_S2 and not cross(close,CA_S3))
       or
       (close<CA_S3 and not cross(high,CA_S3))
       ?1:0

C4_blue =
       (close>CA_R1 and not cross(close,CA_R2))
       or
       (close>CA_R2 and not cross(close,CA_R3))
       or
       (close>CA_R3 and not cross(low,CA_R3))
       ?1:0


//C Point
C_red = C1_red + C2_red + C3_red + C4_red

C_blue = C1_blue + C2_blue + C3_blue + C4_blue

//Sum point
Sum_red=A_red+B_red+C_red
Sum_blue=A_blue+B_blue+C_blue
sell_point=(Sum_red/32)*10
buy_point=(Sum_blue/32)*10

//Strong Sell
stsc=input(16, title="Strong Sell")
sts_label = 24
plotshape(sts_label, title='Strong Sell', text="Strong Sell", style=shape.labeldown, location=location.absolute, color=color.orange, textcolor=color.black, offset=-stsc, transp=0,show_last=1)

//Sell
sc=input(13, title="Strong Sell")
s_label = 24
plotshape(s_label, title='Sell', text="Sell", style=shape.labeldown, location=location.absolute, color=color.orange, textcolor=color.black, offset=-sc, transp=0,show_last=1)

//Neutral
ntc=input(10, title="Neutral")
nt_label = 24
plotshape(nt_label, title='Neutral', text="Neutral", style=shape.labeldown, location=location.absolute, color=color.orange, textcolor=color.black, offset=-ntc, transp=0,show_last=1)

//Buy
bc=input(7, title="Buy")
b_label = 24
plotshape(b_label, title='Buy', text="Buy", style=shape.labeldown, location=location.absolute, color=color.orange, textcolor=color.black, offset=-bc, transp=0,show_last=1)

//Strong Buy
stbc=input(4, title="Strong Buy")
stb_label = 24
plotshape(stb_label, title='Strong Buy', text="Strong Buy", style=shape.labeldown, location=location.absolute, color=color.orange, textcolor=color.black, offset=-stbc, transp=0,show_last=1)

//Market Level
sell =
       Sum_red>Sum_blue
       and sell_point>5
       ?22:na

Strong_sell =
       A_red>A_blue
       and B_red>B_blue
       and C_red>C_blue
       and sell_point>5
       and not crossunder(sell_point,7.5)
       ?22:na

buy =
       Sum_red<Sum_blue
       and buy_point>5
       ?22:na

Strong_buy =
       A_red<A_blue
       and B_red<B_blue
       and C_red<C_blue
       and buy_point>5
       and not crossunder(buy_point,7.5)
       ?22:na

neutral = not sell and not Strong_sell and not buy and not Strong_buy?12:na

//plot wise
plotshape(sell, title='Sell', style=shape.triangleup, location=location.absolute, color=color.red, offset=-sc, transp=40,show_last=1)
plotshape(Strong_sell, title='Strong Sell', style=shape.triangleup, location=location.absolute, color=color.red, offset=-stsc, transp=0,show_last=1)
plotshape(buy, title='Buy', style=shape.triangleup, location=location.absolute, color=color.blue, offset=-bc, transp=40,show_last=1)
plotshape(Strong_buy, title='Strong Buy', style=shape.triangleup, location=location.absolute, color=color.blue, textcolor=color.black, offset=-stbc, transp=0,show_last=1)
plotshape(neutral, title='Neutral', style=shape.triangleup, location=location.absolute, color=color.aqua, offset=-ntc, transp=0,show_last=1)

//plot
h16=hline(28, linestyle=hline.style_solid, linewidth=0)


//plot info
h20=hline(20, linestyle=hline.style_solid, linewidth=0)
//h0=hline(0, linestyle=hline.style_solid, linewidth=0)

//Pivot
pvc=input(17, title="Pivot Info Column")
pivot_label = 15
pivot_buy = 11
pivot_neutral = 12
pivot_sell = 13
plotshape(pivot_label, title='Pivot Info', text="Pivot Info", style=shape.labeldown, location=location.absolute, color=color.orange, textcolor=color.black, offset=-pvc, transp=0,show_last=1)
pivot_sell_text = "Sell: " + tostring(C_red)
pivot_neutral_text = "Neutral: " + tostring(4-(C_red+C_blue))
pivot_buy_text = "Buy: " + tostring(C_blue)
label_pivot_sell = label.new(bar_index[pvc], pivot_sell, text=pivot_sell_text,  style= label.style_none)
label.delete(label_pivot_sell[1])
label_pivot_neutral = label.new(bar_index[pvc], pivot_neutral, text=pivot_neutral_text,  style= label.style_none)
label.delete(label_pivot_neutral[1])
label_pivot_buy = label.new(bar_index[pvc], pivot_buy, text=pivot_buy_text,  style= label.style_none)
label.delete(label_pivot_buy[1])

//Oscillators
osc=input(12, title="Oscillators Info Column")
Oscillators_label = 15
Oscillators_buy = 11
Oscillators_neutral = 12
Oscillators_sell = 13
plotshape(Oscillators_label, title='Oscillators Info', text="Oscillators Info", style=shape.labeldown, location=location.absolute, color=color.orange, textcolor=color.black, offset=-osc, transp=0,show_last=1)
Oscillators_sell_text = "Sell: " + tostring(A_red)
Oscillators_neutral_text = "Neutral: " + tostring(11-(A_red+A_blue))
Oscillators_buy_text = "Buy: " + tostring(A_blue)
label_Oscillators_sell = label.new(bar_index[osc], Oscillators_sell, text=pivot_sell_text,  style= label.style_none)
label.delete(label_Oscillators_sell[1])
label_Oscillators_neutral = label.new(bar_index[osc], Oscillators_neutral, text=Oscillators_neutral_text,  style= label.style_none)
label.delete(label_Oscillators_neutral[1])
label_Oscillators_buy = label.new(bar_index[osc], Oscillators_buy, text=Oscillators_buy_text,  style= label.style_none)
label.delete(label_Oscillators_buy[1])

//Moving Averages
mac=input(7, title="Moving Averages Info Column")
Moving_Averages_label = 15
Moving_Averages_buy = 11
Moving_Averages_neutral = 12
Moving_Averages_sell = 13
plotshape(Moving_Averages_label, title='Moving Averages Info', text="Moving Averages Info", style=shape.labeldown, location=location.absolute, color=color.orange, textcolor=color.black, offset=-mac, transp=0,show_last=1)
Moving_Averages_sell_text = "Sell: " + tostring(B_red)
Moving_Averages_neutral_text = "Neutral: " + tostring(17-(B_red+B_blue))
Moving_Averages_buy_text = "Buy: " + tostring(B_blue)
label_Moving_Averages_sell = label.new(bar_index[mac], Moving_Averages_sell, text=Moving_Averages_sell_text,  style= label.style_none)
label.delete(label_Moving_Averages_sell[1])
label_Moving_Averages_neutral = label.new(bar_index[mac], Moving_Averages_neutral, text=Moving_Averages_neutral_text,  style= label.style_none)
label.delete(label_Moving_Averages_neutral[1])
label_Moving_Averages_buy = label.new(bar_index[mac], Moving_Averages_buy, text=Moving_Averages_buy_text,  style= label.style_none)
label.delete(label_Moving_Averages_buy[1])

//Summary
sumc=input(2, title="Summary Info Column")
Summary_label = 15
Summary_buy = 11
Summary_neutral = 12
Summary_sell = 13
plotshape(Summary_label, title='Summary Info', text="Summary Info", style=shape.labeldown, location=location.absolute, color=color.orange, textcolor=color.black, offset=-sumc, transp=0,show_last=1)
Summary_sell_text = "Sell: " + tostring(Sum_red)
Summary_neutral_text = "Neutral: " + tostring(32-(Sum_red+Sum_blue))
Summary_buy_text = "Buy: " + tostring(Sum_blue)
label_Summary_sell = label.new(bar_index[sumc], Summary_sell, text=Summary_sell_text,  style= label.style_none)
label.delete(label_Summary_sell[1])
label_Summary_neutral = label.new(bar_index[sumc], Summary_neutral, text=Summary_neutral_text,  style= label.style_none)
label.delete(label_Summary_neutral[1])
label_Summary_buy = label.new(bar_index[sumc], Summary_buy, text=Summary_buy_text,  style= label.style_none)
label.delete(label_Summary_buy[1])

//Panel
panel_size=input(20, title="Panel Size")
bgcolor(color.lime, title="Panel", transp=75, show_last=panel_size)

//plot Summary histogram
h10=hline(10, linestyle=hline.style_solid)
h0=hline(0, linestyle=hline.style_solid)
col_sell=color.new(color.red,60)
col_buy=color.new(color.blue,60)
plot(sell_point, title="Sell points", style=plot.style_columns, color=col_sell, show_last=panel_size)
plot(buy_point, title="Buy points", style=plot.style_columns, color=col_buy, show_last=panel_size)
sell_point_text = tostring(sell_point*10) + "%"
buy_point_text = tostring(buy_point*10) + "%"
label_sell_point = label.new(bar_index, sell_point, text=sell_point_text,  style= label.style_none)
label.delete(label_sell_point[1])
label_buy_point = label.new(bar_index, buy_point, text=buy_point_text,  style= label.style_none)
label.delete(label_buy_point[1])

//EOF
=== Ảnh minh họa ===
chrome_jAtK7HGeG9.png
 
 

BÌNH LUẬN MỚI NHẤT

AdBlock Detected

We get it, advertisements are annoying!

Sure, ad-blocking software does a great job at blocking ads, but it also blocks useful features of our website. For the best site experience please disable your AdBlocker.

Back
Bên trên

Miễn trừ trách nhiệm

Tất cả nội dung trên website này đều vì mục đích cung cấp thông tin và không phải lời khuyên đầu tư.

Tại Việt Nam, giao dịch CFD forex có các rủi ro nhất định, trong đó bao gồm rủi ro về pháp lý. Độc giả nên tìm hiểu kỹ trước khi đưa ra quyết định tham gia.