Big Poppa Code Strat & Momentum Strategy Indicator
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © BigPoppaCode

//@version=5


indicator(title='Big Poppa Codes ATR Levels, Strat Price Action & Momentum Strategy', shorttitle='ATR Levels, Strat & Momentum Strategy', overlay=true)

// Global Variables
stockTicker = ticker.new(syminfo.prefix, syminfo.ticker, session.extended)
price = close
timeFrame = 'D'
openPrice = request.security(stockTicker, timeFrame, open, gaps = barmerge.gaps_off, lookahead = barmerge.lookahead_on, ignore_invalid_symbol = true) 
day_high = request.security(stockTicker, timeFrame, high, gaps=barmerge.gaps_off, lookahead=barmerge.lookahead_on)
day_low = request.security(stockTicker, timeFrame, low, gaps=barmerge.gaps_off, lookahead=barmerge.lookahead_on)
atr = request.security(symbol = stockTicker, timeframe = "D", expression = ta.atr(14), gaps = barmerge.gaps_off, lookahead = barmerge.lookahead_on, ignore_invalid_symbol = true)
trueRange = day_high - day_low
trueRangePercent = trueRange / atr * 100
vwap = ta.vwap(source = close)
vwma = ta.vwma(source = close, length = 21)
hull = ta.wma(2 * ta.wma(close, 7) - ta.wma(close, 14), math.round(math.sqrt(14)))
currentHULL = hull[0]
previousHULL = hull[2]
youngKobeEMA = ta.ema(source = close, length = 8)
savageModeEMA = ta.ema(source = close, length = 21)
drizzyEMA = ta.ema(source = close, length = 34)
jayZEMA = ta.ema(source = close, length = 55)
bullishTrend = price >= youngKobeEMA and youngKobeEMA >= savageModeEMA and savageModeEMA >= drizzyEMA and drizzyEMA >= jayZEMA and price >= vwma or (currentHULL >= previousHULL and price >= vwma and price >= youngKobeEMA and price >= vwap)
bearishTrend = price <= youngKobeEMA and youngKobeEMA <= savageModeEMA and savageModeEMA <= drizzyEMA and drizzyEMA <= jayZEMA and price <= vwma or (currentHULL <= previousHULL and price <= vwma and price <= youngKobeEMA and price <= vwap)
trendColor = color.new(color.orange, 75)
if bullishTrend
    trendColor := color.new(color.green, 75)
    trendColor
else if bearishTrend
    trendColor := color.new(color.red, 75)
    trendColor
else 
    trendColor := color.new(color.orange, 75)
    trendColor

trVsATRColor = color.green
if trueRangePercent <= 70
    trVsATRColor := color.green
    trVsATRColor
else if trueRangePercent >= 90
    trVsATRColor := color.red
    trVsATRColor
else
    trVsATRColor := color.orange
    trVsATRColor


// atr level 1 - baby money
callLevel = openPrice + (atr * 0.146)
putLevel = openPrice - (atr * 0.146)
callMoneyLevel = openPrice + (atr * 0.236)
putMoneyLevel = openPrice - (atr * 0.236)
callMidLevel = openPrice + (atr * 0.382)
putMidLevel = openPrice - (atr * 0.382)
callMidLevel2 = openPrice + (atr * 0.5)
putMidLevel2 = openPrice - (atr * 0.5)  
callProfitLevel = openPrice + (atr * 0.618)
putProfitLevel = openPrice - (atr * 0.618)
callProfitLevel2 = openPrice + (atr * 0.764)
putProfitLevel2 = openPrice - (atr * 0.764)
callPrintingLevel = openPrice + atr
putPrintingLevel = openPrice - atr
// atr level 2 - super money
superCallMoneyLevel = callPrintingLevel + (atr * 0.236)
superPutMoneyLevel = putPrintingLevel - (atr * 0.236)
superCallMidLevel = callPrintingLevel + (atr * 0.382)
superPutMidLevel = putPrintingLevel - (atr * 0.382) 
superCallMidLevel2 = callPrintingLevel + (atr * 0.5)
superPutMidLevel2 = putPrintingLevel - (atr * 0.5) 
superCallProfitLevel = callPrintingLevel + (atr * 0.618)
superPutProfitLevel = putPrintingLevel - (atr * 0.618)
superCallProfitLevel2 = callPrintingLevel + (atr * 0.764)
superPutProfitLevel2 = putPrintingLevel - (atr * 0.764)
superCallPrintingLevel = callPrintingLevel + atr
superPutPrintingLevel = putPrintingLevel - atr 
// atr level 3 - ultra money
ultraCallMoneyLevel = superCallPrintingLevel + (atr * 0.236)
ultraPutMoneyLevel = superPutPrintingLevel - (atr * 0.236)
ultraCallMidLevel = superCallPrintingLevel + (atr * 0.382)
ultraPutMidLevel = superPutPrintingLevel - (atr * 0.382) 
ultraCallProfitLevel = superCallPrintingLevel + (atr * 0.618)
ultraPutProfitLevel = superPutPrintingLevel - (atr * 0.618)  
ultraCallPrintingLevel = superCallPrintingLevel + atr
ultraPutPrintingLevel = superPutPrintingLevel - atr
// atr level 4 - mega money
megaCallMoneyLevel = ultraCallPrintingLevel + (atr * 0.236)
megaPutMoneyLevel = ultraPutPrintingLevel - (atr * 0.236)
megaCallMidLevel = ultraCallPrintingLevel + (atr * 0.382)
megaPutMidLevel = ultraPutPrintingLevel - (atr * 0.382) 
megaCallProfitLevel = ultraCallPrintingLevel + (atr * 0.618)
megaPutProfitLevel = ultraPutPrintingLevel - (atr * 0.618)  
megaCallPrintingLevel = ultraCallPrintingLevel + atr
megaPutPrintingLevel = ultraPutPrintingLevel - atr




// Calculating Candles
float candleSize = math.abs(high - low)
float bodySize = math.abs(open - close)
float hammerLowerShadow = math.abs(low - open)
float hammerUpperShadow = math.abs(high - close)
float starLowerShadow = math.abs(low - close)
float starUpperShadow = math.abs(high - open)
oneBar = high <= high[1] and low >= low[1]
twoBarV1 = (high > high[1]) and (low >= low[1]) // high is higher and low is higher or equal
twoBarV2 =  (low < low[1]) and (high <= high[1]) // low is lower and high is lower or equal
threeBar = high > high[1] and low < low[1]
twoBarUp = (high > high[1] and low > low[1]) and close > open
twoBarDown = (high < high[1] and low < low[1]) and close < open
hammer = hammerLowerShadow > bodySize * 2 and low <= ta.lowest(low, 10) and hammerLowerShadow > hammerUpperShadow * 2 and close <= open
star = starUpperShadow > bodySize * 2 and high >= ta.highest(high, 10) and starUpperShadow > starLowerShadow * 2 and open <= close
bigAssCandle = candleSize >= candleSize[1] * 3 or (candleSize[0] >= candleSize[1] * 2 and candleSize[1] >= candleSize[2] * 1.75) or (math.abs(candleSize[0] - candleSize[1]) > 0.25 * atr and timeframe.period == '1')


// User Input Values
showATRFibLevels = input(true, title = "Show ATR Fibonacci Levels on Chart") 
showStratSetUps = input(true, title = "Show Strat Candle Setups and Indicators")
showMomentumBand = input(true, title = "Show Momentum Bands")
showInfoTable = input(true, title = "Show Table With Strat & Momentum Strategy Information Table on Chart")
showFullTable = input(true, title = "Toggle Showing The Full Table or Smaller Table For Mobile Devices")
colorCandles = input(false, title = "Color Candles to Match Momentum Trend Color")


// Plotting Hull Momentum band
currentHULLPlot = plot(currentHULL, title = 'Hull Line 1', color = color.new(trendColor, 35), linewidth = 2, editable = false, display = display.pane)
previousHULLPlot = plot(previousHULL, title = 'Hull Line 2', color = color.new(trendColor, 35), editable = false, display = display.pane)
fill(currentHULLPlot, previousHULLPlot, title = 'Momentum Band Filler', color = color.new(trendColor, 75))
barcolor(color = colorCandles? color.new(trendColor, 75): na, editable = false)

// Creating Table Data
momentumContinuity = ''
ftfcContinuity = ''
// vwma Over or Under Hull Over or Under Slow EMA Over or Under Fast EMA Over or Under. Pivot EMA Over or Under
if price >= vwap 
    momentumContinuity += 'VWAP ⬆ | '
else 
    momentumContinuity += 'VWAP ⬇ | '

if price >= vwma 
    momentumContinuity += 'VWMA ⬆ | '
else 
    momentumContinuity += 'VWMA ⬇ | '

if currentHULL >= previousHULL
    momentumContinuity += 'HULL ⬆ | '
else 
    momentumContinuity += 'HULL ⬇ | '

if price >= youngKobeEMA 
    momentumContinuity += '8EMA ⬆ | '
else 
    momentumContinuity += '8EMA ⬇ | '

if youngKobeEMA >= savageModeEMA
    momentumContinuity += '21EMA ⬆ | '
else
    momentumContinuity += '21EMA ⬇ | '
if savageModeEMA >= drizzyEMA
    momentumContinuity += '34EMA ⬆'
else
    momentumContinuity += '34EMA ⬇ | '

if drizzyEMA >= jayZEMA
    momentumContinuity += '55EMA ⬆'
else 
    momentumContinuity += '55EMA ⬇'



checkTimeFrame(currentClose, previousClose) =>
    upOrDown = currentClose > previousClose ? '⬆| ' : '⬇| '
    upOrDown

getPreviousClose(timeframe) =>
    previousClose = request.security(syminfo.tickerid, timeframe, close[1], lookahead=barmerge.lookahead_on)
    previousClose

getCurrentClose(timeframe) =>
    currentClose = request.security(syminfo.tickerid, timeframe, close, lookahead=barmerge.lookahead_on)
    currentClose

getPriceTarget(op) => 
    val = request.security(stockTicker, timeFrame, op, gaps = barmerge.gaps_off, lookahead = barmerge.lookahead_on, ignore_invalid_symbol = true)
    val 


ftfcContinuity += '5' + checkTimeFrame(getCurrentClose('5'), getPreviousClose('5'))

ftfcContinuity += '15' + checkTimeFrame(getCurrentClose('15'), getPreviousClose('15'))

ftfcContinuity += '30' + checkTimeFrame(getCurrentClose('30'), getPreviousClose('30'))

ftfcContinuity += 'H' + checkTimeFrame(getCurrentClose('60'), getPreviousClose('60'))

ftfcContinuity += 'D' + checkTimeFrame(getCurrentClose('D'), getPreviousClose('D'))

ftfcContinuity += 'W' + checkTimeFrame(getCurrentClose('W'), getPreviousClose('W'))

ftfcContinuity += 'M' + checkTimeFrame(getCurrentClose('M'), getPreviousClose('M'))

ftfcContinuity += 'Y' + checkTimeFrame(getCurrentClose('12M'), getPreviousClose('12M'))




// Plotting ATR Fibonacci Levels
// Up Fib ATR
lineWidth = 2

callPrintingLvlColor = color.rgb(76, 175, 163)
callProfitLvlColor = color.rgb(0, 230, 192)
callMidLvlColor = color.new(#049fcf, 1)
callLvlColor = color.aqua
openLvlColor = color.purple
putLvlColor = color.new(#fdfcd0, 1)
putMidLvlColor = color.yellow
putProfitLvlColor = color.rgb(255, 213, 0)
putPrintingLvlColor = color.new(#ff8867, 1)


fill(plot1 = plot(showATRFibLevels ? openPrice : na, title = 'Open Level', style = plot.style_line, color=openLvlColor, editable = false, linewidth = lineWidth, display = display.price_scale), plot2 = plot(showATRFibLevels ? callLevel : na, title = 'Call Level', style = plot.style_line, color = callLvlColor, editable = false, linewidth = lineWidth, display = display.pane), fillgaps = true, color = (color.new(color.gray, 91)), editable = false)
fill(plot1 = plot(showATRFibLevels ? callLevel : na , title = 'Call Level', style = plot.style_line, color=callLvlColor,  editable = false, linewidth= lineWidth, display = display.price_scale), plot2 = plot(showATRFibLevels ? callMidLevel : na, title = 'Call Mid Level', style = plot.style_line, color = callMidLvlColor, editable = false, linewidth = lineWidth, display = display.pane), fillgaps = false, color = (color.new(color.aqua, 91)))
fill(plot1 = plot(showATRFibLevels ? callMidLevel : na, title = 'Call Mid Level', style = plot.style_line, editable = false, linewidth= lineWidth, color = callMidLvlColor, display = display.price_scale), plot2 = plot(showATRFibLevels ? callProfitLevel : na, title = 'Call Profit Level', style = plot.style_line, editable = false, linewidth = lineWidth, color=callProfitLvlColor, display = display.pane), fillgaps = false, color = (color.new(color.green, 91)))
fill(plot1 = plot(showATRFibLevels ? callProfitLevel : na, title = 'Call Profit Level', style = plot.style_line, editable = false, linewidth= lineWidth, color = callProfitLvlColor, display = display.price_scale), plot2 = plot(showATRFibLevels ? callPrintingLevel : na, title = 'Call Printing Level', style = plot.style_line, color = callPrintingLvlColor, editable = false, linewidth= lineWidth, display = display.pane + display.price_scale), fillgaps = false, color = (color.new(color.red, 91)))
plot(showATRFibLevels ? callMoneyLevel : na , title = 'Call Money Level', style = plot.style_line, color=callLvlColor,  editable = false, linewidth= lineWidth * 2, display = display.price_scale + display.pane)
// Down Fib ATR
fill(plot1 = plot(showATRFibLevels ? openPrice : na, title = 'Open Level', style = plot.style_circles, editable = false, linewidth = lineWidth, color = openLvlColor, display = display.pane), plot2 = plot(showATRFibLevels ? putLevel : na, title = 'Put Level', style = plot.style_line, editable = false, linewidth = lineWidth, color = putLvlColor, display = display.pane), fillgaps = false, color = (color.new(color.gray, 91)))
fill(plot1 = plot(showATRFibLevels ? putLevel : na, title = 'Put Level', style = plot.style_line, editable = false, linewidth = lineWidth, color = putLvlColor, display = display.price_scale), plot2 = plot(showATRFibLevels ? putMidLevel : na, title = 'Put Mid Level',style = plot.style_line, editable = false, linewidth = lineWidth, color = putMidLvlColor, display = display.pane), fillgaps = false, color = (color.new(color.aqua, 91)))
fill(plot1 = plot(showATRFibLevels ? putMidLevel : na, title = 'Put Mid Level', style = plot.style_line, editable = false, linewidth = lineWidth, color = putMidLvlColor, display = display.price_scale), plot2 = plot(showATRFibLevels ? putProfitLevel : na, title = 'Put Profit Level', style = plot.style_line, editable = false, linewidth = lineWidth, color = putProfitLvlColor, display = display.pane), fillgaps = false, color = (color.new(color.green, 91)))
fill(plot1 = plot(showATRFibLevels ? putProfitLevel : na, title = 'Put Profit Level', style = plot.style_line, editable = false, linewidth = lineWidth, color = putProfitLvlColor, display = display.price_scale), plot2 = plot(showATRFibLevels ? putPrintingLevel : na, title = 'Put Priniting Level', style = plot.style_line, editable = false, linewidth = lineWidth, color = putPrintingLvlColor, display = display.pane + display.price_scale), fillgaps = false, color = (color.new(color.red, 91)))
plot(showATRFibLevels ? putMoneyLevel : na, title = 'Put Money Level', style = plot.style_line, editable = false, linewidth = lineWidth * 2, color = putLvlColor, display = display.price_scale + display.pane)






// Creating Alerts

// ----------------------//
// 2bar Up - 1bar - 2bar Up
twoOneTwoUpBullCont = twoBarUp[2] and oneBar[1] and twoBarUp[0]
// // 2bar Down - 1bar - 2bar Up
twoOneTwoUpBullRev =  twoBarDown[2] and oneBar[1] and twoBarUp[0]
// // 2bar Down - 1bar - 2bar Down 
twoOneTwoDownBearCont = twoBarDown[2] and oneBar[1] and twoBarDown[0]
// // 2bar Up - 1 bar - 2bar Down  
twoOneTwoDownBearRev = twoBarUp[2] and oneBar[1] and twoBarDown[0]
// // 2bar Down - 2bar Up
twoDowntwoUpBullRev = twoBarDown[1] and twoBarUp[0] 
// // 2bar Up - 2bar Down
twoUpTwoDownRevBearish = twoBarUp[1] and twoBarDown[0]
// //---------------------------//

// //---------------------------//
// // 3bar Up - 1bar - 2bar Down
threeOneTwoBearRev = threeBar[2] and oneBar[1] and twoBarDown[0] and close[2] > open[2]
// // 3bar Down - 2bar Down - 2bar Up
threeTwoTwoBullRev = threeBar[2] and twoBarDown[1] and twoBarUp[0] and close[2] < open[2]
// // 3bar Up - 2bar Down - 2bar Down
threeTwoTwoBearRev = threeBar[2] and twoBarDown[1] and twoBarDown[0] and close[2] > open[2]

// // 2bar - 1bar Setup
twoOneSetUp = (twoBarV1[1] or twoBarV2[1]) and oneBar[0]
// // 3bar - 1bar Setup
threeOneSetUp = threeBar[1] and oneBar[0] 
// // 3bar - 2bar Setup
threeTwoSetup = threeBar[1] and (twoBarV1[0] or twoBarV2[0])
// // 2up - 2up - 2up
twoUpContinuation = twoBarUp[2] and twoBarUp[1] and twoBarUp[0]
// // 2down - 2down - 2down
twoDownContinuation = twoBarDown[2] and twoBarDown[1] and twoBarDown[0]

setup = twoOneSetUp or threeOneSetUp or threeTwoSetup or twoUpContinuation or twoDownContinuation

alertcondition(threeBar, '3 Bar', '3 Bar Alert')
alertcondition(oneBar, '1 Bar', '1 Bar Alert')
alertcondition(twoOneTwoUpBullCont, '2bar Up - 1bar - 2bar Up', '2-1-2 bullish continuation confirmed')
alertcondition(twoOneTwoUpBullRev, '2bar Down - 1bar - 2bar Up', '2-1-2 bullish reversal confirmed')
alertcondition(twoOneTwoDownBearCont, '2bar Down - 1bar - 2bar Down', '2-1-2 bearish continuation confirmed')
alertcondition(twoOneTwoDownBearRev, '2bar Up - 1 bar - 2bar Down', '2-1-2 bearish reversal confirmed')
alertcondition(twoOneSetUp, ' 2bar - 1bar Setup', '2-1 setup')
alertcondition(threeOneSetUp, '3bar - 1bar Setup', '3-1 setup')
alertcondition(threeTwoSetup, '3bar - 2bar Setup', '3-2 setup')
alertcondition(twoUpContinuation, '2 - 2 - 2 Up', 'Bullish Continuation')
alertcondition(twoDownContinuation, '2 - 2 - 2 Down', 'Bearish Continuation')
alertcondition(hammer, 'Hammer Candle', 'Hammer Signal')
alertcondition(star, 'Star Candle', 'Star Signal')
alertcondition(bigAssCandle, title='Big Ass Candle detected for', message='{{ticker}}')

// Plotting Strat Setups      
//---------------------------//
plotshape(showStratSetUps ? twoUpContinuation : na, title='Two Up 3x', text='2\n2\n2\n⬆',  style=shape.labeldown, location=location.belowbar, color=color.new(color.green, 50), textcolor=color.white, display = display.pane)
plotshape(showStratSetUps ? twoDownContinuation : na, title='Two Down 3x', text='2\n2\n\2\n⬇',  style=shape.labeldown, location=location.belowbar, color=color.new(color.red, 50), textcolor=color.white, display = display.pane)
plotshape(showStratSetUps ? twoOneSetUp : na, title='Two One', text='2\n1',  style=shape.labeldown, location=location.belowbar, color=color.new(color.green, 50), textcolor=color.white, display = display.pane)
plotshape(showStratSetUps ? threeOneSetUp : na, title='Three One', text='3\n1',  style=shape.labeldown, location=location.belowbar, color=color.new(color.red, 50), textcolor=color.white, display = display.pane)
plotshape(showStratSetUps ? threeTwoSetup : na, title='Three Two', text='3\n2',  style=shape.labeldown, location=location.belowbar, color=color.new(color.green, 50), textcolor=color.white, display = display.pane)
//---------------------------//
plotchar(showStratSetUps and not setup ? (twoBarV1 or twoBarV2) : na , title='2 bar', char='2', location=location.belowbar, color=color.new(color.white, 0), display = display.pane)
plotchar(showStratSetUps and not setup ? oneBar: na, title='1 bar', char='1', location=location.belowbar, color=color.new(color.yellow, 0), display = display.pane)
plotchar(showStratSetUps and not setup ? threeBar: na, title='3 bar', char='3', location=location.belowbar, color=color.new(color.blue, 0), display = display.pane)
plotshape(bigAssCandle and not hammer and not star, style=shape.labeldown, location=location.abovebar, text='Big \n Ass \n Candle', color=color.new(trendColor, 50), textcolor=color.white, display = display.pane)
plotshape(showStratSetUps and not bigAssCandle ? hammer : na, style=shape.labeldown, location=location.abovebar, color=color.rgb(76, 175, 79, 71), text='Hammer \n 🔨', textcolor=color.white, display = display.pane)
plotshape(showStratSetUps and not bigAssCandle ? star: na, style=shape.labeldown, location=location.abovebar, color=color.rgb(255, 82, 82, 71), text='Star \n 🌟', textcolor=color.white, display = display.pane )
plotshape(showStratSetUps and bigAssCandle ? hammer : na, style=shape.labeldown, location=location.abovebar, color=color.rgb(76, 175, 79, 71), text='🔨🔨\n Big \n Ass \n Candle \n🔨🔨', textcolor=color.white, display = display.pane )
plotshape(showStratSetUps and bigAssCandle ? star: na, style=shape.labeldown, location=location.abovebar, color=color.rgb(255, 82, 82, 71), text='🌟🌟\n Big \n Ass \n Candle \n🌟🌟', textcolor=color.white, display = display.pane )


last5Candles = ''

last5Candles += oneBar[4] ? '| 1 | ' :  twoBarUp[4] ? '| 2⬆ | ' : twoBarDown[4] ? '| 2⬇ | ': (twoBarV1[4] or twoBarV2[4])? '| 2 | ' : threeBar[4] ? '| 3 | ': na
last5Candles += oneBar[3] ? '1 | ' :  twoBarUp[3] ? '2⬆ | ' : twoBarDown[3] ? '2⬇ | ': (twoBarV1[3] or twoBarV2[3])? '2 | ' : threeBar[3] ? '3 | ': na
last5Candles += oneBar[2] ? '1 | ' :  twoBarUp[2] ? '2⬆ | ' : twoBarDown[2] ? '2⬇ | ': (twoBarV1[2] or twoBarV2[2])? '2 | ' : threeBar[2] ? '3 | ': na
last5Candles += oneBar[1] ? '1 | ' :  twoBarUp[1] ? '2⬆ | ' : twoBarDown[1] ? '2⬇ | ': (twoBarV1[1] or twoBarV2[1])? '2 | ' : threeBar[1] ? '3 | ': na
last5Candles += oneBar[0] ? '1 | ' :  twoBarUp[0] ? '2⬆ | ' : twoBarDown[0] ? '2⬇ | ': (twoBarV1[0] or twoBarV2[2])? '2 | ' : threeBar[0] ? '3 | ': na
last5Candles += hammer[0] ? ' 🔨🔨' : star[0] ? ' 🌟🌟' : na
// Plotting Tables
last5Candles += setup or hammer or star or (bigAssCandle[1] and (twoBarUp[0] or twoBarDown[0])) ? ' Setup or Actionable Signal' : 'No Current Setup or Actionable Signal'


profitLvl = 0.618
midLvl = 0.382
moneyLvl = 0.236
entryLvl = 0.146
atrLvl = 1.0

entryLvlReached = 0
midLvlReached = 0
moneyLvlReached = 0
profitLvlReached = 0
atrLvlReached = 0
// get true range for Day 10, Day 9, Day 8, Day 7, Day 6, Day 5, Day 4, Day 3, Day 2, Day 1
// Get an avg of 10 - 6 and assign it to atr5
// Get an avg of 9 - 5 and assign it to atr4
// Get an avg of 8 - 4 and assign it to atr3
// Get an avg of 7 - 3 and assign it to atr2
// Get an avg of 6 - 2 and assign it to atr1
// open5 high5 low5
// open4 high4 low4 
// open3 high3 low3
// open2 high2 low2 
// open1 high1 low1

// Not charted ad don next update
open5 = getPriceTarget(open[5])
high5 = getPriceTarget(high[5])
low5 = getPriceTarget(low[5])
open4 = getPriceTarget(open[4])
high4 = getPriceTarget(high[4])
low4 = getPriceTarget(low[4])
open3 = getPriceTarget(open[3])
high3 = getPriceTarget(high[3])
low3 = getPriceTarget(low[3])
open2 = getPriceTarget(open[2])
high2 = getPriceTarget(high[2])
low2 = getPriceTarget(low[2])
open1 = getPriceTarget(open[1])
high1 = getPriceTarget(high[1])
low1 = getPriceTarget(low[1])





day1EntryLevelsReached = (open1 + (atr * entryLvl) <= high1) or (open1 - (atr * entryLvl) >= low1) ? true : false  
day2EntryLevelsReached = (open2 + (atr * entryLvl) <= high2) or (open2 - (atr * entryLvl) >= low2) ? true : false  
day3EntryLevelsReached = (open3 + (atr * entryLvl) <= high3) or (open3 - (atr * entryLvl) >= low3) ? true : false    
day4EntryLevelsReached = (open4 + (atr * entryLvl) <= high4) or (open4 - (atr * entryLvl) >= low4) ? true : false  
day5EntryLevelsReached = (open5 + (atr * entryLvl) <= high5) or (open5 - (atr * entryLvl) >= low5) ? true : false  

day1MoneyLevelsReached = (open1 + (atr * moneyLvl) <= high1) or (open1 - (atr * moneyLvl) >= low1) ? true : false  
day2MoneyLevelsReached = (open2 + (atr * moneyLvl) <= high2) or (open2 - (atr * moneyLvl) >= low2) ? true : false  
day3MoneyLevelsReached = (open3 + (atr * moneyLvl) <= high3) or (open3 - (atr * moneyLvl) >= low3) ? true : false    
day4MoneyLevelsReached = (open4 + (atr * moneyLvl) <= high4) or (open4 - (atr * moneyLvl) >= low4) ? true : false  
day5MoneyLevelsReached = (open5 + (atr * moneyLvl) <= high5) or (open5 - (atr * moneyLvl) >= low5) ? true : false  

day1MidLevelsReached = (open1 + (atr * midLvl) <= high1) or (open1 - (atr * midLvl) >= low1) ? true : false  
day2MidLevelsReached =(open2 + (atr * midLvl) <= high2) or (open2 - (atr * midLvl) >= low2) ? true : false  
day3MidLevelsReached = (open3 + (atr * midLvl) <= high3) or (open3 - (atr * midLvl) >= low3) ? true : false    
day4MidLevelsReached = (open4 + (atr * midLvl) <= high4) or (open4 - (atr * midLvl) >= low4) ? true : false  
day5MidLevelsReached = (open5 + (atr * midLvl) <= high5) or (open5 - (atr * midLvl) >= low5) ? true : false  

day1ProfitLevelsReached = (open1 + (atr * profitLvl) <= high1) or (open1 - (atr * profitLvl) >= low1) ? true : false  
day2ProfitLevelsReached =(open2 + (atr * profitLvl) <= high2) or (open2 - (atr * profitLvl) >= low2) ? true : false  
day3ProfitLevelsReached = (open3 + (atr * profitLvl) <= high3) or (open3 - (atr * profitLvl) >= low3) ? true : false    
day4ProfitLevelsReached = (open4 + (atr * profitLvl) <= high4) or (open4 - (atr * profitLvl) >= low4) ? true : false  
day5ProfitLevelsReached = (open5 + (atr * profitLvl) <= high5) or (open5 - (atr * profitLvl) >= low5) ? true : false  

day1ATRLevelsReached = (open1 + (atr) <= high1) or (open1 - (atr) >= low1) ? true : false  
day2ATRLevelsReached =(open2 + (atr) <= high2) or (open2 - (atr) >= low2) ? true : false  
day3ATRLevelsReached = (open3 + (atr) <= high3) or (open3 - (atr) >= low3) ? true : false    
day4ATRLevelsReached = (open4 + (atr) <= high4) or (open4 - (atr) >= low4) ? true : false  
day5ATRLevelsReached = (open5 + (atr) <= high5) or (open5 - (atr) >= low5) ? true : false  


// .146
if day1EntryLevelsReached
    entryLvlReached += 1
if day2EntryLevelsReached
    entryLvlReached += 1
if day3EntryLevelsReached
    entryLvlReached += 1
if day4EntryLevelsReached
    entryLvlReached += 1
if day5EntryLevelsReached
    entryLvlReached += 1


// .236
if day1MoneyLevelsReached
    moneyLvlReached += 1
if day2MoneyLevelsReached
    moneyLvlReached += 1
if day3MoneyLevelsReached
    moneyLvlReached += 1
if day4MoneyLevelsReached
    moneyLvlReached += 1
if day5MoneyLevelsReached
    moneyLvlReached += 1



// .382
if day1MidLevelsReached
    midLvlReached += 1
if day2MidLevelsReached
    midLvlReached += 1
if day3MidLevelsReached
    midLvlReached += 1
if day4MidLevelsReached
    midLvlReached += 1
if day5MidLevelsReached
    midLvlReached += 1


// .618
if day1ProfitLevelsReached
    profitLvlReached += 1
if day2ProfitLevelsReached
    profitLvlReached += 1
if day3ProfitLevelsReached
    profitLvlReached += 1
if day4ProfitLevelsReached
    profitLvlReached += 1
if day5ProfitLevelsReached
    profitLvlReached += 1


// 1.0
if day1ATRLevelsReached
    atrLvlReached += 1
if day2ATRLevelsReached
    atrLvlReached += 1
if day3ATRLevelsReached
    atrLvlReached += 1
if day4ATRLevelsReached
    atrLvlReached += 1
if day5ATRLevelsReached
    atrLvlReached += 1


plot(showATRFibLevels ? high1 : na, title = 'Previous Day High', style = plot.style_line, editable = false, linewidth = lineWidth, color = trendColor, display = display.price_scale)
plot(showATRFibLevels ? low1 : na, title = 'Previous Day Low', style = plot.style_line, editable = false, linewidth = lineWidth, color = trendColor, display = display.price_scale)
plot(showATRFibLevels ? open1 : na, title = 'Previous Day Open', style = plot.style_line, editable = false, linewidth = lineWidth, color = trendColor, display = display.price_scale)

atrLevelsString = 'Prev Day H|0|L: ' + str.tostring(high1, '#.##') + '|' + str.tostring(open1, '#.##') + '|' + str.tostring(low1, '#.##') 

var tbl = table.new(position.top_right, columns = 1, rows = 14)
if barstate.islast and showInfoTable
    currentZoneColor = color.white 
    if close >= callLevel
        currentZoneColor := color.aqua
    if close <= putLevel
        currentZoneColor := color.yellow 
    trend =  bullishTrend ? ' Trend is Bullish 🐂' :  bearishTrend ? 'Trend is Bearish 🐻': 'Trend is Sideways/Choppy ✖️'
    if showFullTable
        table.cell(tbl, 0, 0, 'THE STRAT & MOMENTUM Strategy ' + trend, bgcolor = color.new(trendColor, 10), text_color=color.white)
        table.cell(tbl, 0, 1, ftfcContinuity, bgcolor=color.new(color.black, 80), text_color=color.white)
        table.cell(tbl, 0, 2, momentumContinuity, bgcolor=color.new(color.black, 80), text_color=color.white)
        table.cell(tbl, 0, 3,  'Day Open | ' + str.tostring(openPrice) + ' | Day Range ($' + str.tostring(trueRange, '#.##') + ') is ' + str.tostring(trueRangePercent, '#.##') + '% of ATR ($' + str.tostring(atr, '#.##') + ')', bgcolor=color.new(trVsATRColor, 80), text_color=color.white)
        table.cell(tbl, 0, close > callLevel ? 4 : 5, close >= callLevel ? 'In Call Zone': close <= putLevel ? ' In Put Zone' : 'Patience is a Virtue Not In Call or Put Zone', bgcolor = color.new(currentZoneColor, 80), text_color = color.white)
        table.cell(tbl, 0, close >callLevel ? 5 : 4, 'Call Entry $' + str.tostring(callLevel, '#.##') + ' | Money$ $' + str.tostring(callMoneyLevel,'#.##') + ' | Good$ $' + str.tostring(callMidLevel,'#.##') + ' | Great$ $' + str.tostring(callProfitLevel, '#.##'), bgcolor=color.new(color.aqua, 80), text_color=color.white)
        table.cell(tbl, 0, 6,' Put Entry $' + str.tostring(putLevel, '#.##') + ' | Money$ $' + str.tostring(putMoneyLevel, '#.##') + ' | Good$ $' + str.tostring(putMidLevel, '#.##') + ' | Great$ $' + str.tostring(putProfitLevel, '#.##'), bgcolor=color.new(color.yellow, 80), text_color=color.white)
        table.cell(tbl, 0, 7, 'Price Action ' + last5Candles, text_color = color.white, bgcolor = color.new(trendColor, 1))
        table.cell(tbl, 0, 8, str.tostring(entryLvl, '#.###') + '+/- Entry Level Reached ' + str.tostring(entryLvlReached, '#') + ' of Last 5 trading days ', text_color = color.white, bgcolor = color.new(trendColor, 1))
        table.cell(tbl, 0, 9, str.tostring(moneyLvl, '#.###') + '+/- Money$ Level Reached ' + str.tostring(moneyLvlReached, '#') + ' of Last 5 trading days ', text_color = color.white, bgcolor = color.new(trendColor, 1))
        table.cell(tbl, 0, 10, str.tostring(midLvl, '#.###') + '+/- Good$ Level Reached ' + str.tostring(midLvlReached, '#') + ' of Last 5 trading days ', text_color = color.white, bgcolor = color.new(trendColor, 1))
        table.cell(tbl, 0, 11, str.tostring(profitLvl, '#.###') + '+/- Great$ Level Reached ' + str.tostring(profitLvlReached, '#') + ' of Last 5 trading days ', text_color = color.white, bgcolor = color.new(trendColor, 1))
        table.cell(tbl, 0, 12, str.tostring(atrLvl, '#.###') + '+/- Baller$ $ Level Reached ' + str.tostring(atrLvlReached, '#') + ' of Last 5 trading days ', text_color = color.white, bgcolor = color.new(trendColor, 1))
        table.cell(tbl, 0,13, atrLevelsString, text_color = color.white)
    else 
        table.cell(tbl, 0, 0, ftfcContinuity, bgcolor=color.new(color.black, 80), text_color=color.white)
        table.cell(tbl, 0, 1, trend, bgcolor= trendColor, text_color=color.white)
        table.cell(tbl, 0, 2, 'The first # is your potential entry +/-', bgcolor=color.new(color.black, 80), text_color=color.white)
        table.cell(tbl, 0, 3, 'Call$' + str.tostring(callLevel, '#.##') + ' --> $' + str.tostring(callMoneyLevel,'#.##') + ' | $' + str.tostring(callMidLevel,'#.##') + ' | $' + str.tostring(callProfitLevel, '#.##'), bgcolor=color.new(color.aqua, 80), text_color=color.white)
        table.cell(tbl, 0, 4, 'Put$' + str.tostring(putLevel, '#.##') + ' --> $' + str.tostring(putMoneyLevel,'#.##') + ' | $' + str.tostring(putMidLevel,'#.##') + ' | $' + str.tostring(putProfitLevel, '#.##'), bgcolor=color.new(color.yellow, 80), text_color=color.white)
        table.cell(tbl, 0, 5, atrLevelsString + '| ATR is ' + str.tostring(atr, '#.##'), text_color = color.white)


// Atributions
// All code was written by me, but I was informed by the following
// Significant changes to all code listed below but this code was built with the help of 3 indicators
// Basic HULL MA Pack, The Strat Info Box by Xpul and SATY ATR Levels by Saty Mahajan
// Basic Hull Ma Pack tinkered by InSilico 
// Strat Algos from The Strat info box by Xpul
// ATR Levels from 
// Saty ATR Levels added by Big Poppa code
// Copyright (C) 2022 Saty Mahajan
// Author is not responsible for your trading using this script.
// Data provided in this script is not financial advice.
//
// Special thanks to Gabriel Viana.
// Based on my own ideas and ideas from Ripster, drippy2hard, 
// Adam Sliver, and others.
// Strategy developed from CallMe100K, TrustMyLevels, JrGreatness, FaithInTheStrat and various Youtube Research
// DYOR

