HARSI  + Divergences
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © LordKaan
// All credit to © geneclash & VuManChu for their original Scripts
// This is open-source and open code, not to be private

//@version=5
indicator('HARSI  + Divergences', 'HARSI + Divergences', false, format.price, 2)

////////////////////////////////////////////////////////////////////////////////
//                                                                            //
// ====== ABOUT THIS INDICATOR                                                //
//                                                                            //
//  - RSI based Heikin Ashi candle oscillator                                 //  
//  - Divergence based on the VuManChu Cipher B                               //
//                                                                            //
// ====== ARTICLES and FURTHER READING                                        //
//                                                                            //
//  - https://www.investopedia.com/terms/h/heikinashi.asp                     //
//                                                                            //
//    "Heikin-Ashi is a candlestick pattern technique that aims to reduce     //
//    some of the market noise, creating a chart that highlights trend        //
//    direction better than typical candlestick charts"                       //
//                                                                            //
// ====== IDEA AND USE                                                        //  
//     - The use of the HA RSI indicator when in the OverSold and OverBought  //  
//       area combined to a Divergence & a OB/OS buy/sell                     //  
//       on the Cipher B by VuManChu.                                         //  
//       Can be usefull as a confluence at S/R levels.                        //  
//  Tip = 1 minute timeframe seems to work the best on FOREX                  //  
//                                                                            //  
//   Contributions :                                                          //  
//  -->  Total conditions for an alert and a dot to display, resumed :        //  
//   - Buy/Sell in OB/OS                                                      //  
//   - Divergence Buy/Sell                                                    //  
//   - RSI Overlay is in OB/OS on current bar (or was the bar before)         //  
//     when both Buy/Sell dots from VMC appears.                              //  
//                                                                            //  
// ====== DISCLAIMER                                                          //
//    For Tradingview & Pinescript moderators =                               //  
//    This follow a strategy where RSI Overlay from @JayRogers script shall be //
//    in OB/OS zone, while combining it with the VuManChu Cipher B Divergences //
//    Buy&Sell + Buy/sell alerts In OB/OS areas.                              //                                          
//    Any trade decisions you make are entirely your own responsibility.      //
//                                                                             //
//  Thanks to dynausmaux for the code
//  Thanks to falconCoin for https://www.tradingview.com/script/KVfgBvDd-Market-Cipher-B-Free-version-with-Buy-and-sell/ inspired me to start this.
//  Thanks to LazyBear for WaveTrend Oscillator https://www.tradingview.com/script/2KE8wTuF-Indicator-WaveTrend-Oscillator-WT/
//  Thanks to RicardoSantos for https://www.tradingview.com/script/3oeDh0Yq-RS-Price-Divergence-Detector-V2/                                                                     //
////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////
//                                                                            //
//                           ====== TOOLTIPS ======                           //
//                                                                            //
////////////////////////////////////////////////////////////////////////////////

string TT_HARSI = 'Period for the RSI calculations used to generate the' + 'candles. This seperate from the RSI plot/histogram length.'

string TT_PBIAS = 'Smoothing feature for the OPEN of the HARSI candles.' + '\n\nIncreases bias toward the prior open value which can' + ' help provide better visualisation of trend strength.' + '\n\n** By changing the Open values, High and Low can also' + ' be distorted - however Close will remain unchanged.'

string TT_SMRSI = 'This option smoothes the RSI in a manner similar to HA' + ' open, but uses the realtime rsi rather than the prior' + ' close value.'

string TT_STOCH = 'Uses the RSI generated by the above settings, and as such' + ' will be affected by the smoothing option.'

string TT_STFIT = 'Adjusts the vertical scaling of the stochastic, can help' + ' to prevent distortion of other data in the channel.' + '\n\nHas no impact cross conditions.'

////////////////////////////////////////////////////////////////////////////////
//                                                                            //
//                            ====== INPUTS ======                            //
//                                                                            //
////////////////////////////////////////////////////////////////////////////////


// -- Candle config

string GROUP_CAND = 'Config » HARSI Candles'
i_lenHARSI = input.int(10, 'Length', group=GROUP_CAND, minval=1, tooltip=TT_HARSI)
i_smoothing = input.int(5, 'Open Smoothing', group=GROUP_CAND, minval=1, maxval=100, tooltip=TT_PBIAS)
string INLINE_COL = 'Colour Pallette'
i_colUp = input.color(color.teal, 'Colour Pallette  ', group=GROUP_CAND, inline=INLINE_COL)
i_colDown = input.color(color.red, ' ', group=GROUP_CAND, inline=INLINE_COL)
i_colWick = input.color(color.gray, ' ', group=GROUP_CAND, inline=INLINE_COL)





// -- RSI plot config

string GROUP_PLOT = 'Config » RSI Plot'
i_source = input.source(ohlc4, 'Source', group=GROUP_PLOT)
i_lenRSI = input.int(7, 'Length', group=GROUP_PLOT, minval=1)
i_mode = input.bool(true, 'Smoothed Mode RSI?', group=GROUP_PLOT, tooltip=TT_SMRSI)
i_showPlot = input.bool(true, 'Show RSI Plot?', group=GROUP_PLOT)
i_showHist = input.bool(true, 'Show RSI Histogram?', group=GROUP_PLOT)



// -- Channel OB/OS config

string GROUP_CHAN = 'Config » OB/OS Boundaries'
i_upper = input.int(50, 'OB', group=GROUP_CHAN, inline='OB', minval=1, maxval=50)
i_upperx = input.int(30, 'OB Extreme', group=GROUP_CHAN, inline='OB', minval=1, maxval=50)

i_lower = input.int(-50, 'OS', group=GROUP_CHAN, inline='OS', minval=-50, maxval=-1)
i_lowerx = input.int(-30, 'OS Extreme', group=GROUP_CHAN, inline='OS', minval=-50, maxval=-1)

// Settins

// WaveTrend
wtShow = input(true, title='Show WaveTrend')
wtBuyShow = input(true, title='Show Buy dots')
wtGoldShow = input(true, title='Show Gold dots')
wtSellShow = input(true, title='Show Sell dots')
wtDivShow = input(true, title='Show Div. dots')
vwapShow = input(true, title='Show Fast WT')
wtChannelLen = input(9, title='WT Channel Length')
wtAverageLen = input(12, title='WT Average Length')
wtMASource = input(hlc3, title='WT MA Source')
wtMALen = input(3, title='WT MA Length')

// WaveTrend Overbought & Oversold lines
obLevel = input(53, title='WT Overbought Level 1')
obLevel2 = input(60, title='WT Overbought Level 2')
obLevel3 = input(100, title='WT Overbought Level 3')
osLevel = input(-53, title='WT Oversold Level 1')
osLevel2 = input(-60, title='WT Oversold Level 2')
osLevel3 = input(-75, title='WT Oversold Level 3')

// Divergence WT
wtShowDiv = input(true, title='Show WT Regular Divergences')
wtShowHiddenDiv = input(false, title='Show WT Hidden Divergences')
showHiddenDiv_nl = input(true, title='Not apply OB/OS Limits on Hidden Divergences')
wtDivOBLevel = input(45, title='WT Bearish Divergence min')
wtDivOSLevel = input(-65, title='WT Bullish Divergence min')

// Divergence extra range
wtDivOBLevel_addshow = input(true, title='Show 2nd WT Regular Divergences')
wtDivOBLevel_add = input(15, title='WT 2nd Bearish Divergence')
wtDivOSLevel_add = input(-40, title='WT 2nd Bullish Divergence 15 min')

// RSI+MFI
rsiMFIShow = input(true, title='Show MFI')
rsiMFIperiod = input(60, title='MFI Period')
rsiMFIMultiplier = input.float(150, title='MFI Area multiplier')
rsiMFIPosY = input(2.5, title='MFI Area Y Pos')

// RSI
rsiShow = input(false, title='Show RSI')
rsiSRC = input(close, title='RSI Source')
rsiLen = input(14, title='RSI Length')
rsiOversold = input.int(30, title='RSI Oversold', minval=29, maxval=100)
rsiOverbought = input.int(60, title='RSI Overbought', minval=0, maxval=60)

// Divergence RSI
rsiShowDiv = input(false, title='Show RSI Regular Divergences')
rsiShowHiddenDiv = input(false, title='Show RSI Hidden Divergences')
rsiDivOBLevel = input(60, title='RSI Bearish Divergence min')
rsiDivOSLevel = input(30, title='RSI Bullish Divergence min')


// macd Colors
macdWTColorsShow = input(false, title='Show MACD Colors')
macdWTColorsTF = input('240', title='MACD Colors MACD TF')

//darkMode = input(false, title='Dark mode')


// Colors
colorRed = #ff0000
colorPurple = #e600e6
colorGreen = #3fff00
colorOrange = #e2a400
colorYellow = #ffe500
colorWhite = #ffffff
colorPink = #ff00f0
colorBluelight = #31c0ff

colorWT1 = #49536195
colorWT2 = #7b9fd596

colorWT2_ = #131722

colormacdWT1a = #4caf58
colormacdWT1b = #af4c4c
colormacdWT1c = #7ee57e
colormacdWT1d = #ff3535

colormacdWT2a = #305630
colormacdWT2b = #310101
colormacdWT2c = #132213
colormacdWT2d = #770000


////////////////////////////////////////////////////////////////////////////////
//                                                                            //
//                          ====== FUNCTIONS ======                           //
//                                                                            //
////////////////////////////////////////////////////////////////////////////////


// FUNCTIONS 


//  zero median rsi helper function, just subtracts 50.
f_zrsi(_source, _length) =>
    ta.rsi(_source, _length) - 50

//  zero median stoch helper function, subtracts 50 and includes % scaling
f_zstoch(_source, _length, _smooth, _scale) =>
    float _zstoch = ta.stoch(_source, _source, _source, _length) - 50
    float _smoothed = ta.sma(_zstoch, _smooth)
    float _scaled = _smoothed / 100 * _scale
    _scaled

//  mode selectable rsi function for standard, or smoothed output
f_rsi(_source, _length, _mode) =>

    //  get base rsi
    float _zrsi = f_zrsi(_source, _length)

    //  smoothing in a manner similar to HA open, but rather using the realtime
    //  rsi in place of the prior close value.
    var float _smoothed = na
    _smoothed := na(_smoothed[1]) ? _zrsi : (_smoothed[1] + _zrsi) / 2

    //  return the requested mode
    _mode ? _smoothed : _zrsi

//  RSI Heikin-Ashi generation function
f_rsiHeikinAshi(_length) =>

    //  get close rsi
    float _closeRSI = f_zrsi(close, _length)

    //  emulate "open" simply by taking the previous close rsi value
    float _openRSI = nz(_closeRSI[1], _closeRSI)

    //  the high and low are tricky, because unlike "high" and "low" by
    //  themselves, the RSI results can overlap each other. So first we just go
    //  ahead and get the raw results for high and low, and then..
    float _highRSI_raw = f_zrsi(high, _length)
    float _lowRSI_raw = f_zrsi(low, _length)
    //  ..make sure we use the highest for high, and lowest for low
    float _highRSI = math.max(_highRSI_raw, _lowRSI_raw)
    float _lowRSI = math.min(_highRSI_raw, _lowRSI_raw)

    //  ha calculation for close
    float _close = (_openRSI + _highRSI + _lowRSI + _closeRSI) / 4

    //  ha calculation for open, standard, and smoothed/lagged
    var float _open = na
    _open := na(_open[i_smoothing]) ? (_openRSI + _closeRSI) / 2 : (_open[1] * i_smoothing + _close[1]) / (i_smoothing + 1)

    //  ha high and low min-max selections
    float _high = math.max(_highRSI, math.max(_open, _close))
    float _low = math.min(_lowRSI, math.min(_open, _close))

    //  return the OHLC values
    [_open, _high, _low, _close]






// Divergences 
f_top_fractal(src) =>
    src[4] < src[2] and src[3] < src[2] and src[2] > src[1] and src[2] > src[0]
f_bot_fractal(src) =>
    src[4] > src[2] and src[3] > src[2] and src[2] < src[1] and src[2] < src[0]
f_fractalize(src) =>
    f_top_fractal(src) ? 1 : f_bot_fractal(src) ? -1 : 0

f_findDivs(src, topLimit, botLimit, useLimits) =>
    fractalTop = f_fractalize(src) > 0 and (useLimits ? src[2] >= topLimit : true) ? src[2] : na
    fractalBot = f_fractalize(src) < 0 and (useLimits ? src[2] <= botLimit : true) ? src[2] : na
    highPrev = ta.valuewhen(fractalTop, src[2], 0)[2]
    highPrice = ta.valuewhen(fractalTop, high[2], 0)[2]
    lowPrev = ta.valuewhen(fractalBot, src[2], 0)[2]
    lowPrice = ta.valuewhen(fractalBot, low[2], 0)[2]
    bearSignal = fractalTop and high[2] > highPrice and src[2] < highPrev
    bullSignal = fractalBot and low[2] < lowPrice and src[2] > lowPrev
    bearDivHidden = fractalTop and high[2] < highPrice and src[2] > highPrev
    bullDivHidden = fractalBot and low[2] > lowPrice and src[2] < lowPrev
    [fractalTop, fractalBot, lowPrev, bearSignal, bullSignal, bearDivHidden, bullDivHidden]

// RSI+MFI
f_rsimfi(_period, _multiplier, _tf) =>
    request.security(syminfo.tickerid, _tf, ta.sma((close - open) / (high - low) * _multiplier, _period) - rsiMFIPosY)

// WaveTrend
f_wavetrend(src, chlen, avg, malen, tf) =>
    tfsrc = request.security(syminfo.tickerid, tf, src)
    esa = ta.ema(tfsrc, chlen)
    de = ta.ema(math.abs(tfsrc - esa), chlen)
    ci = (tfsrc - esa) / (0.015 * de)
    wt1 = request.security(syminfo.tickerid, tf, ta.ema(ci, avg))
    wt2 = request.security(syminfo.tickerid, tf, ta.sma(wt1, malen))
    wtVwap = wt1 - wt2
    wtOversold = wt2 <= osLevel
    wtOverbought = wt2 >= obLevel
    wtCross = ta.cross(wt1, wt2)
    wtCrossUp = wt2 - wt1 <= 0
    wtCrossDown = wt2 - wt1 >= 0
    wtCrosslast = ta.cross(wt1[2], wt2[2])
    wtCrossUplast = wt2[2] - wt1[2] <= 0
    wtCrossDownlast = wt2[2] - wt1[2] >= 0
    [wt1, wt2, wtOversold, wtOverbought, wtCross, wtCrossUp, wtCrossDown, wtCrosslast, wtCrossUplast, wtCrossDownlast, wtVwap]


// MACD
f_macd(src, fastlen, slowlen, sigsmooth, tf) =>
    fast_ma = request.security(syminfo.tickerid, tf, ta.ema(src, fastlen))
    slow_ma = request.security(syminfo.tickerid, tf, ta.ema(src, slowlen))
    macd = fast_ma - slow_ma
    signal = request.security(syminfo.tickerid, tf, ta.sma(macd, sigsmooth))
    hist = macd - signal
    [macd, signal, hist]

// MACD Colors on WT    
f_macdWTColors(tf) =>
    hrsimfi = f_rsimfi(rsiMFIperiod, rsiMFIMultiplier, tf)
    [macd, signal, hist] = f_macd(close, 28, 42, 9, macdWTColorsTF)
    macdup = macd >= signal
    macddown = macd <= signal
    macdWT1Color = macdup ? hrsimfi > 0 ? colormacdWT1c : colormacdWT1a : macddown ? hrsimfi < 0 ? colormacdWT1d : colormacdWT1b : na
    macdWT2Color = macdup ? hrsimfi < 0 ? colormacdWT2c : colormacdWT2a : macddown ? hrsimfi < 0 ? colormacdWT2d : colormacdWT2b : na
    [macdWT1Color, macdWT2Color]

// Get higher timeframe candle
f_getTFCandle(_tf) =>
    _open = request.security(ticker.heikinashi(syminfo.tickerid), _tf, open, barmerge.gaps_off, barmerge.lookahead_on)
    _close = request.security(ticker.heikinashi(syminfo.tickerid), _tf, close, barmerge.gaps_off, barmerge.lookahead_on)
    _high = request.security(ticker.heikinashi(syminfo.tickerid), _tf, high, barmerge.gaps_off, barmerge.lookahead_on)
    _low = request.security(ticker.heikinashi(syminfo.tickerid), _tf, low, barmerge.gaps_off, barmerge.lookahead_on)
    hl2 = (_high + _low) / 2.0
    newBar = ta.change(_open)
    candleBodyDir = _close > _open
    [candleBodyDir, newBar]


  




    
////////////////////////////////////////////////////////////////////////////////
//                                                                            //
//                   ====== SERIES, LINES and LABELS ======                   //
//                                                                            //
////////////////////////////////////////////////////////////////////////////////

// CALCULATE INDICATORS {

// RSI
rsi = ta.rsi(rsiSRC, rsiLen)
rsiColor = rsi <= rsiOversold ? colorGreen : rsi >= rsiOverbought ? colorRed : colorPurple


// Calculates WaveTrend
[wt1, wt2, wtOversold, wtOverbought, wtCross, wtCrossUp, wtCrossDown, wtCross_last, wtCrossUp_last, wtCrossDown_last, wtVwap] = f_wavetrend(wtMASource, wtChannelLen, wtAverageLen, wtMALen, timeframe.period)


// macd colors
[macdWT1Color, macdWT2Color] = f_macdWTColors(macdWTColorsTF)

// WT Divergences
[wtFractalTop, wtFractalBot, wtLow_prev, wtBearDiv, wtBullDiv, wtBearDivHidden, wtBullDivHidden] = f_findDivs(wt2, wtDivOBLevel, wtDivOSLevel, true)

[wtFractalTop_add, wtFractalBot_add, wtLow_prev_add, wtBearDiv_add, wtBullDiv_add, wtBearDivHidden_add, wtBullDivHidden_add] = f_findDivs(wt2, wtDivOBLevel_add, wtDivOSLevel_add, true)
[wtFractalTop_nl, wtFractalBot_nl, wtLow_prev_nl, wtBearDiv_nl, wtBullDiv_nl, wtBearDivHidden_nl, wtBullDivHidden_nl] = f_findDivs(wt2, 0, 0, false)

wtBearDivHidden_ = showHiddenDiv_nl ? wtBearDivHidden_nl : wtBearDivHidden
wtBullDivHidden_ = showHiddenDiv_nl ? wtBullDivHidden_nl : wtBullDivHidden

wtBearDivColor = wtShowDiv and wtBearDiv or wtShowHiddenDiv and wtBearDivHidden_ ? colorRed : na
wtBullDivColor = wtShowDiv and wtBullDiv or wtShowHiddenDiv and wtBullDivHidden_ ? colorGreen : na

wtBearDivColor_add = wtShowDiv and wtDivOBLevel_addshow and wtBearDiv_add or wtShowHiddenDiv and wtDivOBLevel_addshow and wtBearDivHidden_add ? #9a0202 : na
wtBullDivColor_add = wtShowDiv and wtDivOBLevel_addshow and wtBullDiv_add or wtShowHiddenDiv and wtDivOBLevel_addshow and wtBullDivHidden_add ? #1b5e20 : na

// RSI Divergences
[rsiFractalTop, rsiFractalBot, rsiLow_prev, rsiBearDiv, rsiBullDiv, rsiBearDivHidden, rsiBullDivHidden] = f_findDivs(rsi, rsiDivOBLevel, rsiDivOSLevel, true)
[rsiFractalTop_nl, rsiFractalBot_nl, rsiLow_prev_nl, rsiBearDiv_nl, rsiBullDiv_nl, rsiBearDivHidden_nl, rsiBullDivHidden_nl] = f_findDivs(rsi, 0, 0, false)

rsiBearDivHidden_ = showHiddenDiv_nl ? rsiBearDivHidden_nl : rsiBearDivHidden
rsiBullDivHidden_ = showHiddenDiv_nl ? rsiBullDivHidden_nl : rsiBullDivHidden

rsiBearDivColor = rsiShowDiv and rsiBearDiv or rsiShowHiddenDiv and rsiBearDivHidden_ ? colorRed : na
rsiBullDivColor = rsiShowDiv and rsiBullDiv or rsiShowHiddenDiv and rsiBullDivHidden_ ? colorGreen : na

// Buy signal.
buySignal = wtCross and wtCrossUp and wtOversold

buySignalDiv = wtShowDiv and wtBullDiv or wtShowDiv and wtBullDiv_add or rsiShowDiv and rsiBullDiv

buySignalDiv_color = wtBullDiv ? colorGreen : wtBullDiv_add ? color.new(colorGreen, 60) : rsiShowDiv ? colorGreen : na

// Sell signal
sellSignal = wtCross and wtCrossDown and wtOverbought

sellSignalDiv = wtShowDiv and wtBearDiv or wtShowDiv and wtBearDiv_add or rsiShowDiv and rsiBearDiv

sellSignalDiv_color = wtBearDiv ? colorRed : wtBearDiv_add ? color.new(colorRed, 60) : rsiBearDiv ? colorRed : na


//  standard, or ha smoothed rsi for the line plot and/or histogram
float RSI = f_rsi(i_source, i_lenRSI, i_mode)


//  get OHLC values to use in the plotcandle()
[O, H, L, C] = f_rsiHeikinAshi(i_lenHARSI)

//  shadow, invisible
color colShadow = color.rgb(0, 0, 0, 100)
color colNone = color.rgb(0, 0, 0, 100)

//  rsi color
//color colRSI        = RSI >=30 ? color.red : color.gray
color colRSI = RSI < -31 ? color.lime : RSI > 31 ? color.red : color.gray


cross_up = RSI[1] > 30
cross_down = RSI[1] < -30

//  candle body colouring
color bodyColour = C > O ? i_colUp : i_colDown
color wickColour = i_colWick

////////////////////////////////////////////////////////////////////////////////
//                                                                            //
//                     ====== DRAWING and PLOTTING ======                     //
//                                                                            //
////////////////////////////////////////////////////////////////////////////////



// WT Areas
plot(wtShow ? wt1 : na, style=plot.style_area, title='WT Wave 1', color=macdWTColorsShow ? macdWT1Color : colorWT1, transp=20)

// WT Div

plot(series=wtFractalTop ? wt2[2] : na, title='WT Bearish Divergence', color=wtBearDivColor, linewidth=2, offset=-2)
plot(series=wtFractalBot ? wt2[2] : na, title='WT Bullish Divergence', color=wtBullDivColor, linewidth=2, offset=-2)

// WT 2nd Div
plot(series=wtFractalTop_add ? wt2[2] : na, title='WT 2nd Bearish Divergence', color=wtBearDivColor_add, linewidth=2, offset=-2)
plot(series=wtFractalBot_add ? wt2[2] : na, title='WT 2nd Bullish Divergence', color=wtBullDivColor_add, linewidth=2, offset=-2)


plotchar(cross_down[1] and wtBuyShow and buySignal  ? -107 : na, title='Buy circle', char='·', color=color.new(colorGreen, 10), location=location.absolute, size=size.small)
plotchar(cross_up[1] and wtSellShow and sellSignal ? 105 : na, title='Sell circle', char='·', color=color.new(colorRed, 10), location=location.absolute, size=size.small)

plotchar(cross_down[1] and wtDivShow and buySignalDiv and wtBuyShow and buySignal[2] ? -106 : na, title='Divergence buy circle', char='•', color=buySignalDiv_color, location=location.absolute, size=size.small, offset=-2, transp=10)
plotchar(cross_up[1] and wtDivShow and sellSignalDiv and wtSellShow and sellSignal[2] ? 106 : na, title='Divergence sell circle', char='•', color=sellSignalDiv_color, location=location.absolute, size=size.small, offset=-2, transp=10)




//  zero median RSI channel hlines
upperx = hline(i_upperx, 'OB Extreme', color.new(color.red, 10))
//upper = hline(i_upper, 'OB', color.new(color.silver, 80))
//median  = hline( 0,         "Median",       color.orange, hline.style_dotted )
//lower = hline(i_lower, 'OS', color.new(color.silver, 80))
lowerx = hline(i_lowerx, 'OS Extreme', color.new(color.green, 10))



//  make our HA rsi candles
plotcandle(O, H, L, C, 'HARSI', bodyColour, wickColour, bordercolor=bodyColour)

//  RSI overlay plot
// plot(i_showPlot ? RSI : na, 'RSI Shadow', colShadow, 3)
// plot_rsi = plot(i_showPlot ? RSI : na, 'RSI Overlay', colRSI, 1)


//Alerts
alertcondition((cross_down[1] and wtBuyShow and buySignal[2] and wtDivShow and buySignalDiv) or (cross_up[1] and wtSellShow and sellSignal[2] and wtDivShow and sellSignalDiv), title='Buy/Sell Signal', message='Buy/Sell Signal')
