Đoản khúc cuộc đời

tks rất nhiều bạn nhé

1 Likes

Anh vẫn thế
Đa đoan đời thi sĩ
Đem đa tình nhốt lại bởi văn chương
(St)

4 Likes

Hôm nay mùng tám tháng ba,
Em ngồi tựa cửa chờ hoa của người.
Hôm nay chỉ biết chờ quà,
Thầm nghĩ anh có quét nhà cho không?

2 Likes

Em không biết làm thơ, em xin bác chia sẻ đánh sóng của bác với ạ.

3 Likes

Sử dụng:

Kết hợp với chỉ báo mới và chỉ báo cập nhật ở bình luận bên dưới.

4 Likes

Chỉ báo RSI cập nhật


//@version=5
indicator(title='RSI and EMA', shorttitle='RSI EMA', overlay=false)
src = input(close, 'Source')
len = input.int(14, 'RSI Length', minval=2)
lenema = input.int(12, 'EMA Length', minval=2)
ob = input.float(75, 'Overbought Input', minval=0, step=1)
os = input.float(25, 'Oversold Input', minval=0, step=1)
pan = input(true, ' Show Information Panel')
off = input.int(50, '  Panel Position Offset', minval=0)
dec = input.int(1, 'Decimals', minval=0, maxval=10)
bg = input(false, 'Invisible Background')
bgcolor(color.white)
lbR = input(title="Pivot Lookback Right", defval=5, display = display.data_window)
lbL = input(title="Pivot Lookback Left", defval=5, display = display.data_window)
rangeUpper = input(title="Max of Lookback Range", defval=60, display = display.data_window)
rangeLower = input(title="Min of Lookback Range", defval=5, display = display.data_window)
plotBull = input(title="Plot Bullish", defval=true, display = display.data_window)
plotHiddenBull = input(title="Plot Hidden Bullish", defval=true, display = display.data_window)
plotBear = input(title="Plot Bearish", defval=true, display = display.data_window)
plotHiddenBear = input(title="Plot Hidden Bearish", defval=true, display = display.data_window)
bearColor = color.new(color.red, 30)
bullColor = color.new(color.green, 30)
hiddenBullColor = color.new(color.green, 30)
hiddenBearColor = color.new(color.red, 30)
textColor = color.black
noneColor = color.new(color.white, 100)
osc = ta.rsi(src, len)
plFound = na(ta.pivotlow(osc, lbL, lbR)) ? false : true
phFound = na(ta.pivothigh(osc, lbL, lbR)) ? false : true
_inRange(cond) =>
	bars = ta.barssince(cond == true)
	rangeLower <= bars and bars <= rangeUpper

reverse(Level) =>
    x1 = (len - 1) * (ta.rma(math.max(nz(src[1], src) - src, 0), len) * Level / (100 - Level) - ta.rma(math.max(src - nz(src[1], src), 0), len))
    x1 >= 0 ? src + x1 : src + x1 * (100 - Level) / Level

rsi = ta.rsi(src, len)
ma = ta.ema(rsi, lenema)
revma = reverse(ma)
revob = reverse(ob)
revos = reverse(os)

rr(input) =>
    alpha = 1 / len
    up1 = ta.rma(math.max(ta.change(src), 0), len)
    down1 = ta.rma(-math.min(ta.change(src), 0), len)
    up = alpha * math.max(input - src[1], 0) + (1 - alpha) * nz(up1[1])
    down = alpha * -math.min(input - src[1], 0) + (1 - alpha) * nz(down1[1])
    rsia = down == 0 ? 100 : up == 0 ? 0 : 100 - 100 / (1 + up / down)

labelstyle = label.style_label_center
labelstyle2 = label.style_label_down
labelc = bg ? color.new(color.white, 50) : color.new(color.black, 45)

Round(src, digits) =>
    p = math.pow(10, digits)
    math.round(math.abs(src) * p) / p * math.sign(src)

xp(offset) =>
    time + math.round(ta.change(time) * offset)

lable1(offset, P, T, s, color_PnL) =>
    label PnL_Label = na
    PnL_Label := label.new(xp(offset), P, text=T, color=color_PnL, textcolor=color.white, style=s, yloc=yloc.price, xloc=xloc.bar_time, size=size.normal)
    label.delete(PnL_Label[1])

ud() =>
    if rsi < ma
        'Cross up EMA'
    else
        'Cross down EMA'

if pan
    lable1(off,50, 'RSI ' + ud() + ' Price : ' + str.tostring(Round(revma, dec)) + '\n\n' + str.tostring(Round(ob, dec)) + ' Overbought Price : ' + str.tostring(Round(revob, dec)) + '\n\n' + str.tostring(Round(os, dec)) + ' Oversold Price : ' + str.tostring(Round(revos, dec)), labelstyle,labelc)

bullzoneband = hline(70, 'Bull Lower Zone', color=color.rgb(54, 58, 69, 36), linewidth=1, linestyle=hline.style_solid)
upband = hline(80, 'Bull Uppe Zoner', color=color.rgb(54, 58, 69, 36), linewidth=1, linestyle=hline.style_solid)
fill(upband, bullzoneband, color=color.new(color.green,70))

bearzoneband = hline(30, 'Bear Upper Zone', color=color.rgb(255, 82, 82, 29), linewidth=1, linestyle=hline.style_solid)
downband = hline(20, 'Bear Lower Zone', color=color.rgb(255, 82, 82, 29), linewidth=1, linestyle=hline.style_solid)
fill(bearzoneband, downband, color=color.new(color.blue,70))

plot(rsi, color=color.new(color.orange, 0), linewidth=2)
plot(ma, 'EMA', color=color.new(color.purple, 0), style=plot.style_line, linewidth=1)

oscHL = osc[lbR] > ta.valuewhen(plFound, osc[lbR], 1) and _inRange(plFound[1])
priceLL = low[lbR] < ta.valuewhen(plFound, low[lbR], 1)
bullCondAlert = priceLL and oscHL and plFound
bullCond = plotBull and bullCondAlert

plot(
     plFound ? osc[lbR] : na,
     offset=-lbR,
     title="Regular Bullish",
     linewidth=2,
     color=(bullCond ? bullColor : noneColor)
     )

plotshape(
	 bullCond ? osc[lbR] : na,
	 offset=-lbR,
	 title="Regular Bullish Label",
	 text=" Bull ",
	 style=shape.labelup,
	 location=location.absolute,
	 color=bullColor,
	 textcolor=textColor
	 )

oscLL = osc[lbR] < ta.valuewhen(plFound, osc[lbR], 1) and _inRange(plFound[1])
priceHL = low[lbR] > ta.valuewhen(plFound, low[lbR], 1)
hiddenBullCondAlert = priceHL and oscLL and plFound
hiddenBullCond = plotHiddenBull and hiddenBullCondAlert

plot(
	 plFound ? osc[lbR] : na,
	 offset=-lbR,
	 title="Hidden Bullish",
	 linewidth=2,
	 color=(hiddenBullCond ? hiddenBullColor : noneColor)
	 )

plotshape(
	 hiddenBullCond ? osc[lbR] : na,
	 offset=-lbR,
	 title="Hidden Bullish Label",
	 text=" H Bull ",
	 style=shape.labelup,
	 location=location.absolute,
	 color=bullColor,
	 textcolor=textColor
	 )

oscLH = osc[lbR] < ta.valuewhen(phFound, osc[lbR], 1) and _inRange(phFound[1])
priceHH = high[lbR] > ta.valuewhen(phFound, high[lbR], 1)
bearCondAlert = priceHH and oscLH and phFound
bearCond = plotBear and bearCondAlert

plot(
	 phFound ? osc[lbR] : na,
	 offset=-lbR,
	 title="Regular Bearish",
	 linewidth=2,
	 color=(bearCond ? bearColor : noneColor)
	 )

plotshape(
	 bearCond ? osc[lbR] : na,
	 offset=-lbR,
	 title="Regular Bearish Label",
	 text=" Bear ",
	 style=shape.labeldown,
	 location=location.absolute,
	 color=bearColor,
	 textcolor=textColor
	 )

oscHH = osc[lbR] > ta.valuewhen(phFound, osc[lbR], 1) and _inRange(phFound[1])
priceLH = high[lbR] < ta.valuewhen(phFound, high[lbR], 1)
hiddenBearCondAlert = priceLH and oscHH and phFound
hiddenBearCond = plotHiddenBear and hiddenBearCondAlert

plot(
	 phFound ? osc[lbR] : na,
	 offset=-lbR,
	 title="Hidden Bearish",
	 linewidth=2,
	 color=(hiddenBearCond ? hiddenBearColor : noneColor)
	 )

plotshape(
	 hiddenBearCond ? osc[lbR] : na,
	 offset=-lbR,
	 title="Hidden Bearish Label",
	 text=" H Bear ",
	 style=shape.labeldown,
	 location=location.absolute,
	 color=bearColor,
	 textcolor=textColor
	 )

////
6 Likes

Chỉ báo Williams, RSI stochastic, RSI, Stochastic.


//@version=5
indicator('Williams %R, RSI, Stochastic and Stochastic RSI', shorttitle='Willy, RSI, Stochastic', overlay=false)

source = input(title='Source', defval=close)
showWilly = input(title='Show Williams %R', defval=true)
oscillator = input.string(title='Indicator', options=['RSI', 'Stochastic', 'Stochastic RSI', 'None'], defval='Stochastic')
showDivergence = input(title='Show divergence', defval=true)
showHiddneDivergence = input(title='Show hidden divergence', defval=true)
showMidline = input(title='Show midline', defval=true)

// Divergence
lbR = input(title='Div Pivot Lookback Right', defval=5)
lbL = input(title='Div Pivot Lookback Left', defval=5)
rangeUpper = input(title='Div Max of Lookback Range', defval=60)
rangeLower = input(title='Div Min of Lookback Range', defval=5)
delayPlotTilClosed = input(title='Div Delay plot until candle is closed', defval=false)

// (mab) Colors
col_darkSpringGreen = #137547
col_lightGreen = #0f7506
col_rubyRed = #f01c2db2
col_redPigment = #ef101083
col_outrageousOrange = #ca2c00
col_mysticMaroon = #bc387d
col_darkBluePurple = #311b92
col_GreenBlueCrayola = #2761ff
col_vividSkyBlue = #0066ff
col_maximumYellowRed = #fec149
col_navajo_white = #FEDB9B
col_seeshell = #000000
col_none = color.new(color.white, 100)

bullColor = col_darkSpringGreen
bearColor = col_rubyRed


// Select the second oscillator
isRsi = oscillator == 'RSI'
isStochastic = oscillator == 'Stochastic'
isStochasticRsi = oscillator == 'Stochastic RSI'
isNone = oscillator == 'None'

// Repaint
repaint = not delayPlotTilClosed or barstate.ishistory or barstate.isconfirmed

// Location for labels
labelLocation = time + 6 * (time[1] - time[51]) / 50

// Offset for lines and background
plotOffset = 50

// Draw line to separate Willy and second oscillator
plot(showWilly and not isNone ? 0.0 : na, title='Separator line', color=color.new(#fa00ed, 0), style=plot.style_linebr, linewidth=2, join=true)
plot(showWilly and not isNone ? 0.0 : na, title='Separator line', color=color.new(#fa00ed, 0), style=plot.style_linebr, linewidth=2, join=true, show_last=plotOffset, offset=plotOffset - 1)

// Check if condition is true in range (helper function)
_inRange(cond) =>
    bars = ta.barssince(cond == true)
    rangeLower <= bars and bars <= rangeUpper


//
// Willy - this is a Williams %R with 13 ema like it is used by TRI
//
willyLength = input.int(title='Willy length', defval=34, minval=1)
willyEma = input.int(title='Willy EMA', defval=13, minval=1)
willyOversold = input.float(title='Willy oversold', defval=-80.0, maxval=0.0)
willyOverbought = input.float(title='Willy overbought', defval=-20.0, maxval=0.0)

willyColor1 = col_vividSkyBlue
willyColor2 = col_outrageousOrange
willyColorBackground = col_GreenBlueCrayola
willyStupidOverboughtColor = col_outrageousOrange
willyStupidOversoldColor = col_lightGreen

// Calculate willy
willyUpper = ta.highest(willyLength)
willyLower = ta.lowest(willyLength)
willyValue1 = -100 * (willyUpper - close) / (willyUpper - willyLower)
willyValue2 = ta.ema(willyValue1, willyEma)
isWillyStupidOverbought = willyValue2 > willyOverbought
isWillyStupidOversold = willyValue2 < willyOversold
willyMidline = (willyOversold + willyOverbought) / 2.0

// Highlight when Willy is stupid
bandHighlight1 = plot(showWilly and isWillyStupidOverbought ? 0.0 : na, title='Willy band 1', display=display.none)
bandHighlight2 = plot(showWilly and isWillyStupidOverbought ? willyOverbought : na, title='Willy band 2', display=display.none)
bandHighlight3 = plot(showWilly and isWillyStupidOversold ? willyOversold : na, title='Willy band 3', display=display.none)
bandHighlight4 = plot(showWilly and isWillyStupidOversold ? -100.0 : na, title='Willy band 4', display=display.none)

fill(bandHighlight1, bandHighlight2, color=willyStupidOverboughtColor, title='Willy stupid overbought', transp=50)
fill(bandHighlight3, bandHighlight4, color=willyStupidOversoldColor, title='Willy stupid oversold', transp=50)

// Plot Willy
plot(showWilly ? willyValue1 : na, title='Willy', color=willyColor1, linewidth=2)
plot(showWilly ? willyValue2 : na, title='Willy EMA', color=willyColor2, linewidth=1, display=display.none)
willyBand1 = plot(showWilly ? willyOversold : na, title='Willy oversold line', color=color.new(col_seeshell, 0), style=plot.style_line, linewidth=1, join=true)
willyBand1_O = plot(showWilly ? willyOversold : na, title='Willy oversold line', color=color.new(col_seeshell, 0), style=plot.style_line, linewidth=1, join=true, show_last=plotOffset, offset=plotOffset - 1)
willyBand2 = plot(showWilly ? willyOverbought : na, title='Willy overbought line', color=color.new(col_seeshell, 0), style=plot.style_line, linewidth=1, join=true)
willyBand2_O = plot(showWilly ? willyOverbought : na, title='Willy overbought line', color=color.new(col_seeshell, 0), style=plot.style_line, linewidth=1, join=true, show_last=plotOffset, offset=plotOffset - 1)
plot(showWilly ? willyMidline : na, title='Midline', color=color.new(color.green, 0), style=plot.style_line, linewidth=2, join=true)
plot(showWilly ? willyMidline : na, title='Midline', color=color.new(color.green, 0), style=plot.style_line, linewidth=2, join=true, show_last=plotOffset, offset=plotOffset - 1)

fill(willyBand1, willyBand2, color=willyColorBackground, title='Willy background', transp=90)
fill(willyBand1_O, willyBand2_O, color=willyColorBackground, title='Willy background', show_last=1, transp=90)

// Label willy indicator
if barstate.islast and showWilly
    labelW = label.new(labelLocation, willyMidline, xloc=xloc.bar_time, text='Willy', textcolor=willyColor1, style=label.style_none, textalign=text.align_left)
    label.delete(labelW[1])

//
// Find Willy divergence
//
// Find pivot
willyPlFound = na(ta.pivotlow(willyValue1, lbL, lbR)) ? false : true
willyPhFound = na(ta.pivothigh(willyValue1, lbL, lbR)) ? false : true

// Willy: Higher high
willyHH = willyValue1[lbR] > ta.valuewhen(willyPhFound, willyValue1[lbR], 1) and _inRange(willyPhFound[1])

// Willy: Lower high
willyLH = willyValue1[lbR] < ta.valuewhen(willyPhFound, willyValue1[lbR], 1) and _inRange(willyPhFound[1])

// Willy: Higher low
willyHL = willyValue1[lbR] > ta.valuewhen(willyPlFound, willyValue1[lbR], 1) and _inRange(willyPlFound[1])

// Willy: Lower low
willyLL = willyValue1[lbR] < ta.valuewhen(willyPlFound, willyValue1[lbR], 1) and _inRange(willyPlFound[1])

// Price: Lower Low
willyPriceLL = low[lbR] < ta.valuewhen(willyPlFound, low[lbR], 1)

// Price: Higher low
willyPriceHL = low[lbR] > ta.valuewhen(willyPlFound, low[lbR], 1)

// Price: Higher high
willyPriceHH = high[lbR] > ta.valuewhen(willyPhFound, high[lbR], 1)

// Price: Lower high
willyPriceLH = high[lbR] < ta.valuewhen(willyPhFound, high[lbR], 1)

// Regular bullish condition
willyBullCond = showDivergence and willyPriceLL and willyHL and willyPlFound and repaint

// Regular bearish condition
willyBearCond = showDivergence and willyPriceHH and willyLH and willyPhFound and repaint

// Hidden bullish condition
willyHiddenBullCond = showHiddneDivergence and willyPriceHL and willyLL and willyPlFound and repaint

// Hidden bearish cndition
willyHiddenBearCond = showHiddneDivergence and willyPriceLH and willyHH and willyPhFound and repaint

// Plot divergence

plot(showWilly and willyPlFound ? willyValue1[lbR] : na, offset=-lbR, title='Regular Bullish', linewidth=2, color=willyBullCond ? bullColor : col_none, transp=20)
plotshape(showWilly and willyBullCond ? willyValue1[lbR] : na, offset=-lbR, title='Regular Bullish Label', text=' Bull ', style=shape.labelup, location=location.absolute, color=bullColor, textcolor=color.new(col_seeshell, 0), transp=0)

plot(showWilly and willyPhFound ? willyValue1[lbR] : na, offset=-lbR, title='Regular Bearish', linewidth=2, color=willyBearCond ? bearColor : col_none, transp=0)
plotshape(showWilly and willyBearCond ? willyValue1[lbR] : na, offset=-lbR, title='Regular Bearish Label', text=' Bear ', style=shape.labeldown, location=location.absolute, color=bearColor, textcolor=color.new(col_seeshell, 0), transp=0)

plot(showWilly and willyPlFound ? willyValue1[lbR] : na, offset=-lbR, title='Hidden Bullish', linewidth=2, color=willyHiddenBullCond ? bullColor : col_none, transp=20)
plotshape(showWilly and willyHiddenBullCond ? willyValue1[lbR] : na, offset=-lbR, title='Hidden Bullish Label', text=' H Bull ', style=shape.labelup, location=location.absolute, color=bullColor, textcolor=color.new(col_seeshell, 20), transp=20)

plot(showWilly and willyPhFound ? willyValue1[lbR] : na, offset=-lbR, title='Hidden Bearish', linewidth=2, color=willyHiddenBearCond ? bearColor : col_none, transp=20)

plotshape(showWilly and willyHiddenBearCond ? willyValue1[lbR] : na, offset=-lbR, title='Hidden Bearish Label', text=' H Bear ', style=shape.labeldown, location=location.absolute, color=bearColor, textcolor=color.new(col_seeshell, 20), transp=20)


//
// RSI
//
showRsi2 = input(title='Show RSI 2', defval=false)
rsiLength1 = input.int(title='RSI 1 length', defval=14, minval=1)
rsiLength2 = input.int(title='RSI 2 length', defval=7, minval=1)
rsiOversold = input.float(title='RSI oversold', defval=30.0, minval=0.0)
rsiOverbought = input.float(title='RSI overbought', defval=70.0, minval=0.0)

rsiColor1 = col_maximumYellowRed
rsiColor2 = col_redPigment
rsiColorBackground = col_darkBluePurple

rsiValue1 = ta.rsi(source, rsiLength1)
rsiValue2 = ta.rsi(source, rsiLength2)


//
// Stochastic
//
stocPeriod = input.int(title='Stochastic period', defval=14, minval=1)
stocSmoothK = input.int(title='Stochastic smooth K', defval=10, minval=1)
stocSmoothD = input.int(title='Stochastic smooth D', defval=3, minval=1)
stocOversold = input.float(title='Stochastic oversold', defval=20.0, minval=0.0)
stocOverbought = input.float(title='Stochastic overbought', defval=80.0, minval=0.0)

stocColor1 = col_GreenBlueCrayola
stocColor2 = col_redPigment
stocColorBackground = col_mysticMaroon

stocValueK = ta.sma(ta.stoch(close, high, low, stocPeriod), stocSmoothK)
stocValueD = ta.sma(stocValueK, stocSmoothD)


//
// Stochastic RSI
//
stocRsiPeriod = input.int(title='Stochastic RSI period', defval=14, minval=1)
stocRsiSmoothK = input.int(title='Stochastic RSI smooth K', defval=10, minval=1)
stocRsiSmoothD = input.int(title='Stochastic RSI smooth D', defval=3, minval=1)
stocRsiLength = input.int(title='Stochastic RSI length', defval=14, minval=1)
stocRsiOversold = input.float(title='Stochastic RSI oversold', defval=20.0, minval=0.0)
stocRsiOverbought = input.float(title='Stochastic RSI overbought', defval=80.0, minval=0.0)

stocRsiColor1 = col_vividSkyBlue
stocRsiColor2 = col_outrageousOrange
stocRsiColorBackground = col_navajo_white

stocRsi = ta.rsi(source, stocRsiLength)
stocRsiValueK = ta.sma(ta.stoch(stocRsi, stocRsi, stocRsi, stocRsiPeriod), stocRsiSmoothK)
stocRsiValueD = ta.sma(stocRsiValueK, stocRsiSmoothD)


//
// Assign the values of the selected oscillator
//
float oscillatorValue1 = na
float oscillatorValue2 = na
float oversold = na
float overbought = na
float midline = na
color oscillatorColor1 = na
color oscillatorColor2 = na
color backgroundColor = na

oscillatorValue1 := isNone ? na : isRsi ? rsiValue1 : isStochastic ? stocValueK : isStochasticRsi ? stocRsiValueK : na
oscillatorValue2 := isNone ? na : isRsi and showRsi2 ? rsiValue2 : isStochastic ? stocValueD : isStochasticRsi ? stocRsiValueD : na
oversold := isNone ? na : isRsi ? rsiOversold : isStochastic ? stocOversold : isStochasticRsi ? stocRsiOversold : na
overbought := isNone ? na : isRsi ? rsiOverbought : isStochastic ? stocOverbought : isStochasticRsi ? stocRsiOverbought : na
oscillatorColor1 := isNone ? na : isRsi ? rsiColor1 : isStochastic ? stocColor1 : isStochasticRsi ? stocRsiColor1 : na
oscillatorColor2 := isNone ? na : isRsi ? rsiColor2 : isStochastic ? stocColor2 : isStochasticRsi ? stocRsiColor2 : na
backgroundColor := isNone ? na : isRsi ? rsiColorBackground : isStochastic ? stocColorBackground : isStochasticRsi ? stocRsiColorBackground : na
midline := isNone ? na : showMidline ? (overbought + oversold) / 2 : na

// Plot the oscillator
plot(oscillatorValue1, title='Indicator 1', color=oscillatorColor1, linewidth=2)
plot(oscillatorValue2, title='Indicator 2', color=oscillatorColor2, linewidth=1)
band1 = plot(oversold, title='Oversold line', color=color.new(col_seeshell, 0), style=plot.style_line, linewidth=1, join=true)
band1_O = plot(oversold, title='Oversold line', color=color.new(col_seeshell, 0), style=plot.style_line, linewidth=1, join=true, show_last=plotOffset, offset=plotOffset - 1)
band2 = plot(overbought, title='Overbought line', color=color.new(col_seeshell, 0), style=plot.style_line, linewidth=1, join=true)
band2_O = plot(overbought, title='Overbought line', color=color.new(col_seeshell, 0), style=plot.style_line, linewidth=1, join=true, show_last=plotOffset, offset=plotOffset - 1)
plot(midline, title='Midline', color=color.new(color.green, 0), style=plot.style_line, linewidth=2, join=true)
plot(midline, title='Midline', color=color.new(color.green, 0), style=plot.style_line, linewidth=2, join=true, show_last=plotOffset, offset=plotOffset - 1)

fill(band1, band2, color=backgroundColor, title='Background', transp=90)
fill(band1_O, band2_O, color=backgroundColor, title='Background', show_last=1, transp=90)

// Label the oscillator
if barstate.islast and not isNone
    labelI = label.new(labelLocation, midline, xloc=xloc.bar_time, text=oscillator, textcolor=oscillatorColor1, style=label.style_none, textalign=text.align_left)
    label.delete(labelI[1])


//
// Find divergence in second oscillator
//
// Find pivot
oscillatorPlFound = na(ta.pivotlow(oscillatorValue1, lbL, lbR)) ? false : true
oscillatorPhFound = na(ta.pivothigh(oscillatorValue1, lbL, lbR)) ? false : true

// Second oscillator: Higher high
oscillatorHH = oscillatorValue1[lbR] > ta.valuewhen(oscillatorPhFound, oscillatorValue1[lbR], 1) and _inRange(oscillatorPhFound[1])

// Second oscillator: Lower high
oscillatorLH = oscillatorValue1[lbR] < ta.valuewhen(oscillatorPhFound, oscillatorValue1[lbR], 1) and _inRange(oscillatorPhFound[1])

// Second oscillator: Higher low
oscillatorHL = oscillatorValue1[lbR] > ta.valuewhen(oscillatorPlFound, oscillatorValue1[lbR], 1) and _inRange(oscillatorPlFound[1])

// Second oscillator: Lower low
oscillatorLL = oscillatorValue1[lbR] < ta.valuewhen(oscillatorPlFound, oscillatorValue1[lbR], 1) and _inRange(oscillatorPlFound[1])

// Price: Lower Low
oscillatorPriceLL = low[lbR] < ta.valuewhen(oscillatorPlFound, low[lbR], 1)

// Price: Higher low
oscillatorPriceHL = low[lbR] > ta.valuewhen(oscillatorPlFound, low[lbR], 1)

// Price: Higher high
oscillatorPriceHH = high[lbR] > ta.valuewhen(oscillatorPhFound, high[lbR], 1)

// Price: Lower high
oscillatorPriceLH = high[lbR] < ta.valuewhen(oscillatorPhFound, high[lbR], 1)

// Regular bullish condition
oscillatorBullCond = showDivergence and oscillatorPriceLL and oscillatorHL and oscillatorPlFound and repaint

// Regular bearish condition
oscillatorBearCond = showDivergence and oscillatorPriceHH and oscillatorLH and oscillatorPhFound and repaint

// Hidden bullish condition
oscillatorHiddenBullCond = showHiddneDivergence and oscillatorPriceHL and oscillatorLL and oscillatorPlFound and repaint

// Hidden bearish cndition
oscillatorHiddenBearCond = showHiddneDivergence and oscillatorPriceLH and oscillatorHH and oscillatorPhFound and repaint

// Plot divergence

plot(oscillatorPlFound ? oscillatorValue1[lbR] : na, offset=-lbR, title='Regular Bullish', linewidth=3, color=oscillatorBullCond ? bullColor : col_none, transp=20)
plotshape(oscillatorBullCond ? oscillatorValue1[lbR] : na, offset=-lbR, title='Regular Bullish Label', text=' Bull ', style=shape.labelup, location=location.absolute, color=bullColor, textcolor=color.new(col_seeshell, 0), transp=0)

plot(oscillatorPhFound ? oscillatorValue1[lbR] : na, offset=-lbR, title='Regular Bearish', linewidth=2, color=oscillatorBearCond ? bearColor : col_none, transp=20)
plotshape(oscillatorBearCond ? oscillatorValue1[lbR] : na, offset=-lbR, title='Regular Bearish Label', text=' Bear ', style=shape.labeldown, location=location.absolute, color=bearColor, textcolor=color.new(col_seeshell, 0), transp=0)

plot(oscillatorPlFound ? oscillatorValue1[lbR] : na, offset=-lbR, title='Hidden Bullish', linewidth=2, color=oscillatorHiddenBullCond ? bullColor : col_none, transp=20)
plotshape(oscillatorHiddenBullCond ? oscillatorValue1[lbR] : na, offset=-lbR, title='Hidden Bullish Label', text=' H Bull ', style=shape.labelup, location=location.absolute, color=bullColor, textcolor=color.new(col_seeshell, 20), transp=20)

plot(oscillatorPhFound ? oscillatorValue1[lbR] : na, offset=-lbR, title='Hidden Bearish', linewidth=2, color=oscillatorHiddenBearCond ? bearColor : col_none, transp=20)

plotshape(oscillatorHiddenBearCond ? oscillatorValue1[lbR] : na, offset=-lbR, title='Hidden Bearish Label', text=' H Bear ', style=shape.labeldown, location=location.absolute, color=bearColor, textcolor=color.new(col_seeshell, 20), transp=20)


6 Likes

Ví dụ sau mua breakup:
Khung 1h đảo trend trước khung 4h một ít, chỉ báo RSI - Williams - Stochastic hai khung giờ đều trên 50 và hướng lên là điểm vào lệnh mua. Điểm bán theo tỉ lệ rủi ro cơ hội 1-1 hoặc 1-1.5 hoặc 1-2 hoặc 1-2.5 hoặc 1-3,… tùy theo điểm vào đang ở vùng thấp hay cao và kênh xu hướng, xem các mũi tên chỉ điểm cao của kênh xu hướng các khung giờ.

8 Likes

Em cảm ơn bác rất nhiều ạ! Trên biểu đồ em thấy có thêm chỉ báo xu hướng của bác và hai đường nữa, em kiểm tra gần giống với sự giao cắt của hai đường MA 8-20 phải không bác? Em thử hai đường đó thấy giống với hình của bác.

2 Likes

Gần đúng, dùng SMA hoặc EMA 9-20 lệch nhau một ít so với 8-20.

2 Likes

Vâng ạ.

Hi anh, anh xem lại bị lỗi này không add được chart ạ. Em cảm ơn.
“Warning at 320:1 The transp argument is deprecated. We recommend using color.new() or color.rgb() functions to specify the transparency of the plots instead. Additionally, note that transp has no effect in plots where the color is calculated at runtime”

nó chỉ là warning thôi, k ảnh hưởng gì đâu bác. Vẫn dùng bình thường nhé

3 Likes

Em add được chart rồi bác.

Cám ơn bác Nam về Agr :sunglasses:

1 Likes

Nam ơi chú không liên lạc được với cháu, Nam cho chú cách liên lạc nhé. Chú thả tim được lúc thì mờ mắt.

Em cứ ngồi ngắm hoa
Em cứ ca cứ hát
Anh sẽ lo rửa bát
Anh sẽ lo quét nhà

Anh nhặt rau vo gạo
Em ung dung đọc báo
Anh tay nấu tay xào
Anh tự làm không sao
Đừng lo gì em nhé
(St)

3 Likes

Phải chăng sẽ hết đơn côi?
Cùng nhau chia sẻ, có thôi buồn phiền?
Chồng người bên vợ bên con,
Chồng em lướt chứng chỉ còn xương khô.
Xin anh đừng nhớ nỗi đau,
Về đây đói no cùng nhau ngàn đời.

4 Likes

Nếu có một ngày mệt mỏi lúc chiều rơi
Em hãy tin rằng niềm tin đang đón đợi
Hãy lái con thuyền đi qua cơn sóng mới
Giông tố qua đi bầu trời sẽ rạng ngời
(St)

5 Likes

Tôi cũng có đọc nhưng chưa hiểu nhiều, còn rất lơ mơ nên xem vẽ sóng của các cụ chưa thực hành ra bên ngoài được. T cứ hình dung là 1 sóng 12345 sau đó sóng chỉnh abc kết thúc rồi lại tiếp tục sóng ngắn tiếp theo. Cái khó nhất là xác định sóng bắt đầu từ đâu, kết thúc từ đâu …