# 聊一个大资金情绪模型

SZSE:002354   天娱数科

**大资金情绪**

- 当0轴下方出现紫红色的柱子时，开始关注并观察周围的看涨反转。
- 当第一天在0轴上方出现红色柱子时，是确认看涨趋势的信号。
- 上涨趋势中间有回撤，开始做T+0交易，降低成本。
- 当柱线（大资金能量）在回撤后期突破前期高点，开始加仓，做短线多头中继，此时是最好的买入点！

- B：波段买，绿色
- S：波段卖，红色

- 看涨趋势：红色
- 确认看涨趋势：栗色
- 看涨回撤：蓝色
- 看跌趋势：绿色
- 看跌回撤：紫红色

**大资金情绪源代码**

```pine
// This source code is subject to the terms of the Mozilla Public License 2.0 at mozilla.org/MPL/2.0/
//@version=4

study(" L3 Banker Fund Sentiment", overlay=false, max_bars_back=5000, max_labels_count=500)

//func
xrf(values, length) =>
r_val = float(na)
if length >= 1
for i = 0 to length by 1
if na(r_val) or not na(values)
r_val := values
r_val
r_val

//banker fund trend
diff = ema(close,3)-ema(close,8)
dea = ema(diff,3)
macd = 2*(diff-dea)
x1 = ema(diff,5)*5
x2 = ((ema(close,3)-ema(close,8)))*5
x3 = iff(x2>0,x2,0)
plot(x3, color=x2>0?color.red:na)
x4 = iff(x2<0,x2,0)
plot(x4, color=x2<0?color.green:na)
plotcandle(0,x2,0,x2, color=x2>0?color.red:na, bordercolor = x2>0?color.red:na)
plotcandle(0,x2,0,x2, color=x2>0 and x2<x1 and x2<xrf(x2,1)?color.aqua:na, bordercolor = x2>0 and x2<x1 and x2<xrf(x2,1)?color.aqua:na)
plotcandle(0,x2,0,x2, color=x2<0?color.green:na, bordercolor = x2<0?color.green:na)
plotcandle(0,x2,0,x2, color=x2<0 and x2>x1 and x2>xrf(x2,1)?color.fuchsia:na, bordercolor = x2<0 and x2>x1 and x2>xrf(x2,1)?color.fuchsia:na)
banker_fund1 = x1
plot(banker_fund1, color=color.yellow, linewidth = 2)
banker_fund2 = x2
plot(banker_fund1, color=color.blue, linewidth = 2)
//volume info
va = iff(close>xrf(close,1),volume,-volume)
obv1 = sum(iff(close==xrf(close,1),0,va),4000)
obv2 = ema(obv1,3)-sma(obv1,9)
obv3 = ema(iff(obv2>0,obv2,0),3)
mac3 = sma(close,3)
plotcandle(0,x2,0,x2, color=obv3>xrf(obv3,1) and mac3>xrf(mac3,1)?color.maroon:na, bordercolor = obv3>xrf(obv3,1) and mac3>xrf(mac3,1)?color.maroon:na)

//labels
long = (crossover(banker_fund2,banker_fund1) and banker_fund1<-0.25)
short = (crossunder(banker_fund2,banker_fund1) and banker_fund2>0.25)

l_ls = short ?
label.new (bar_index, x2, "S", color=color.red, textcolor=color.white, style=label.style_labeldown, yloc=yloc.price, size=size.small) :
long ?
label.new (bar_index, x2, "B", color=color.green, textcolor=color.white, style=label.style_labelup, yloc=yloc.price, size=size.small) :
na

// plot divergence
lbR = input(title='Pivot Lookback Right', defval=5)
lbL = input(title='Pivot Lookback Left', defval=5)
rangeUpper = input(title='Max of Lookback Range', defval=60)
rangeLower = input(title='Min of Lookback Range', defval=5)
plotBull = input(title='Plot Bullish', defval=true)
plotHiddenBull = input(title='Plot Hidden Bullish', defval=false)
plotBear = input(title='Plot Bearish', defval=true)
plotHiddenBear = input(title='Plot Hidden Bearish', defval=false)

bearColor = color.new(color.fuchsia, 50)
bullColor = color.new(color.yellow, 50)
hiddenBullColor = color.green
hiddenBearColor = color.red
textColor = color.white
noneColor = color.new(color.white, 100)

osc = x2

plFound = na(pivotlow(osc, lbL, lbR)) ? false : true
phFound = na(pivothigh(osc, lbL, lbR)) ? false : true

_inRange(cond) =>
rangeLower <= bars and bars <= rangeUpper

//------------------------------------------------------------------------------
// Regular Bullish

// Osc: Higher Low
oscHL = osc > valuewhen(plFound, osc, 1) and _inRange(plFound)

// Price: Lower Low
priceLL = low < valuewhen(plFound, low, 1)

bullCond = plotBull and priceLL and oscHL and plFound

plot(plFound ? osc : na, offset=-lbR, title='Regular Bullish', linewidth=2, color=bullCond ? bullColor : noneColor, transp=0)

plotshape(bullCond ? osc : na, offset=-lbR, title='Regular Bullish Label', text=' confirmed bullish ', style=shape.labelup, location=location.absolute, color=bullColor, textcolor=color.new(textColor, 0), transp=0)

alertcondition(bullCond, title='Regular bullish divergence found', message='Check charts for a regular bullish divergence found')

//------------------------------------------------------------------------------
// Hidden Bullish

// Osc: Lower Low
oscLL = osc < valuewhen(plFound, osc, 1) and _inRange(plFound)

// Price: Higher Low
priceHL = low > valuewhen(plFound, low, 1)

hiddenBullCond = plotHiddenBull and priceHL and oscLL and plFound

plot(plFound ? osc : na, offset=-lbR, title='Hidden Bullish', linewidth=2, color=hiddenBullCond ? hiddenBullColor : noneColor, transp=0)

plotshape(hiddenBullCond ? osc : na, offset=-lbR, title='Hidden Bullish Label', text=' unconfirmed bullish ', style=shape.labelup, location=location.absolute, color=bullColor, textcolor=color.new(textColor, 0), transp=0)

alertcondition(hiddenBullCond, title='Hidden bullish divergence found', message='Check charts for a hidden bullish divergence found')

//------------------------------------------------------------------------------
// Regular Bearish

// Osc: Lower High
oscLH = osc < valuewhen(phFound, osc, 1) and _inRange(phFound)

// Price: Higher High
priceHH = high > valuewhen(phFound, high, 1)

bearCond = plotBear and priceHH and oscLH and phFound

plot(phFound ? osc : na, offset=-lbR, title='Regular Bearish', linewidth=2, color=bearCond ? bearColor : noneColor, transp=0)

plotshape(bearCond ? osc : na, offset=-lbR, title='Regular Bearish Label', text=' confirmed bearish ', style=shape.labeldown, location=location.absolute, color=bearColor, textcolor=color.new(textColor, 0), transp=0)

alertcondition(bearCond, title='Regular bearish divergence found', message='Check charts for a regular bearish divergence found')

//------------------------------------------------------------------------------
// Hidden Bearish

// Osc: Higher High
oscHH = osc > valuewhen(phFound, osc, 1) and _inRange(phFound)

// Price: Lower High
priceLH = high < valuewhen(phFound, high, 1)

hiddenBearCond = plotHiddenBear and priceLH and oscHH and phFound

plot(phFound ? osc : na, offset=-lbR, title='Hidden Bearish', linewidth=2, color=hiddenBearCond ? hiddenBearColor : noneColor, transp=0)

plotshape(hiddenBearCond ? osc : na, offset=-lbR, title='Hidden Bearish Label', text=' unconfirmed bearish ', style=shape.labeldown, location=location.absolute, color=bearColor, textcolor=color.new(textColor, 0), transp=0)

alertcondition(hiddenBearCond, title='Hidden bearish divergence found', message='Check charts for a hidden bearish divergence found')
```

Avoid losing contact！Don't miss out! The first and most important thing to do is to join my Discord chat now! Click here to start your adventure: discord.com/invite/ZTGpQJq 防止失联，请立即行动，加入本猫聊天群: discord.com/invite/ZTGpQJq