Multi indicators table
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © JuicyWolf

//@version=5
indicator("Multi-Indicators-table", overlay = true)

//###############################################################################//
//############################### USER INPUTS ##############################//
//###############################################################################//
//############################### USER INPUTS ##############################//
//###############################################################################//
//############################### USER INPUTS ##############################//
//###############################################################################//
//############################### USER INPUTS ##############################//
//###############################################################################//
//############################### USER INPUTS ##############################//
//###############################################################################//
groupTable = "Table"

bullishColor = input.color(color.green, "bullish color", group="style")
x = 0.4
veryBullishColor = color.rgb(color.r(bullishColor)*x , color.g(bullishColor)*x, color.b(bullishColor)*x) // rend la couleur plus vive

bearishColor = input.color(color.red, "bearish color", group="style")

veryBearishColor = color.rgb(color.r(bearishColor)*x , color.g(bearishColor)*x, color.b(bearishColor)*x) // rend la couleur plus vive

neutralColor = input.color(color.gray, "neutral color", group="style")

displayTableVolatility = input.bool(true, "display volatility table", group="table parameters")
displayTableTrend = input.bool(true, "display trend table", group="table parameters")
displayTableMomentum = input.bool(true, "display momentum table", group="table parameters")
displayTableReversal = input.bool(true, "display reversal table", group="table parameters")
displayTableVolume = input.bool(true, "display volume table", group="table parameters")
displayTableRiskAssesment = input.bool(true, "display risk assessment", group="table parameters")

tablePos = input.string("Top right", "Table position", options=["Top right", "Bottom right", "Bottom left", "Top left"], group="table parameters")
tableSize = input.int(2, "Table size", maxval=5, minval=1, group="table parameters")


// Volatility indicators //
//---------//
atrLength = input.int(14, "atr length", group="volatility indicators")

bbLength = input.int(20, "bollinger bands length", group="volatility indicators")
bbSource = input.source(close, "bollinger bands source")


// Trend indicators //
//---------//
lensig = input.int(14, title="ADX Smoothing", minval=1, maxval=50, group="trend indicators")
len = input.int(14, minval=1, title="DI Length", group="trend indicators")

emaSource = input.source(close, "ema source", group="trend indicators")
ema1Length = input.int(9, "ema 1 length", group="trend indicators")
ema2Length = input.int(21, "ema 2 length", group="trend indicators")
ema3Length = input.int(50, "ema 3 length", group="trend indicators")
ema4Length = input.int(200, "ema 4 length", group="trend indicators")

superTrendLength = input(10, "supertrend length", group="trend indicators")


// Momentum indicators //
//---------//
rsiLength = input.int(14, "rsi length", group="momentum indicators")
rsiSource = input.source(close, "rsi source", group="momentum indicators")

stochLength = input.int(14, "stoch rsi length", group="momentum indicators")

mfiLength = input.int(14, "mfi length", group="momentum indicators")
mfiSource = input.source(close, "mfi source", group="momentum indicators")

williamLength = input.int(30, "wiliam %R length", group="momentum indicators")

cciLength = input.int(20, "cci length", group="momentum indicators")
cciSource = input.source(hlc3, "cci source", group="momentum indicators")


// Volume indicators //
//---------//
volumeMaLength = input.int(14, "volume ema length", group="volume indicators")


// Risk Assessment indicators //
//---------//
atrMult = input.float(title="Atr multiplicator", defval=2.5, group="risk assessment")


//###############################################################################//
//############################### REVERSAL REVERSAL ##############################//
//###############################################################################//
//############################### REVERSAL REVERSAL ##############################//
//###############################################################################//
//############################### REVERSAL REVERSAL ##############################//
//###############################################################################//
//############################### REVERSAL REVERSAL ##############################//
//###############################################################################//
//############################### REVERSAL REVERSAL ##############################//
//################################################################################//


// MACD Block //
//---------//
[macdLine, macdSignalLine, macdHistLine] = ta.macd(close, 12, 26, 9) // macdLine : bullish line, signalLine : bearish line

macdBreakup = macdLine > macdSignalLine and macdLine[1] < macdSignalLine[1]
macdBreakup2 = macdLine > macdSignalLine and macdLine[2] < macdSignalLine[2]
macdBreakup3 = macdLine > macdSignalLine and macdLine[3] < macdSignalLine[3]

macdBreakdown = macdLine < macdSignalLine and macdLine[1] > macdSignalLine[1]
macdBreakdown2 = macdLine < macdSignalLine and macdLine[2] > macdSignalLine[2]
macdBreakdown3 = macdLine < macdSignalLine and macdLine[3] > macdSignalLine[3]

macdStatus = macdBreakup or macdBreakup2 or macdBreakup3 ? "high bullish reversal risk" : macdBreakdown or macdBreakdown2 or macdBreakdown3 ? "high bearish reversal risk" : "low reversal risk"
macdColor = macdStatus == "high bullish reversal risk" ? veryBullishColor : macdStatus == "high bearish reversal risk" ? veryBearishColor : macdStatus == "bullish" ? bullishColor : macdStatus == "bearish" ? bearishColor : neutralColor


// PARABOLIC SAR BLOCK //
//---------//
parabolicSar = ta.sar(0.02, 0.02, 0.2) 
psarHigherThanClose = parabolicSar > close ? true : false
breakUp = psarHigherThanClose == true and psarHigherThanClose[1] == false
breakUp2 = psarHigherThanClose == true and psarHigherThanClose[2] == false
breakUp3 = psarHigherThanClose == true and psarHigherThanClose[3] == false

breakDown = psarHigherThanClose == false and psarHigherThanClose[1] == true
breakDown2 = psarHigherThanClose == false and psarHigherThanClose[2] == true
breakDown3 = psarHigherThanClose == false and psarHigherThanClose[3] == true

psarStatus = breakUp or breakUp2 or breakUp3 ? "high bearish reversal risk": breakDown or breakDown2 or breakDown3 ? "high bullish reversal risk" : "low reversal risk"
psarColor = psarStatus == "high bearish reversal risk" ? veryBearishColor : psarStatus == "high bullish reversal risk" ? veryBullishColor : neutralColor


// PP Supertrend //
//---------//
[supertrend, direction] = ta.supertrend(3, superTrendLength)

supertrendBreakup = supertrend > close and supertrend[1] < close[1]
supertrendBreakup2 = supertrend > close and supertrend[2] < close[2]
supertrendBreakup3 = supertrend > close and supertrend[3] < close[3]

supertrendBreakdown = supertrend < close and supertrend[1] > close[1]
supertrendBreakdown2 = supertrend < close and supertrend[2] > close[2]
supertrendBreakdown3 = supertrend < close and supertrend[3] > close[3]

supertrendStatus = supertrendBreakup or supertrendBreakup2 or supertrendBreakup3 ? "high bullish reversal risk" : supertrendBreakdown or supertrendBreakdown2 or supertrendBreakdown3 ? "high bearish reversal risk" : "low reversal risk"
supertrendColor = supertrendStatus == "high bullish reversal risk" ? veryBullishColor : supertrendStatus == "high bearish reversal risk" ? veryBearishColor : supertrendStatus == "bullish" ? bullishColor : supertrendStatus == "bearish" ? bearishColor : neutralColor



//###############################################################################//
//############################### VOLATILITY  VOLATILITY ##############################//
//###############################################################################//
//############################### VOLATILITY VOLATILITY ##############################//
//###############################################################################//
//############################### VOLATILITY VOLATILITY ##############################//
//###############################################################################//
//############################### VOLATILITY VOLATILITY ##############################//
//###############################################################################//
//############################### VOLATILITY VOLATILITY ##############################//
//###############################################################################//


// ATR Block //
//---------//
atr = ta.atr(atrLength)

avgArrayAtrValues = ta.ema(atr, atrLength)

atrStatus = atr < avgArrayAtrValues*0.8 ? "low volatility" : atr > avgArrayAtrValues*1.4 ? "very high volatility" : atr > avgArrayAtrValues*1.2 ? "high volatility" : "neutral"

atrColor = atrStatus == "low volatility" ? bearishColor : atrStatus == "high volatility" ? bullishColor : atrStatus == "very high volatility" ? veryBullishColor : neutralColor



// BOLLINGER Block //
//---------//
[midBollinger, upBollinger, lowBollinger] = ta.bb(bbSource, bbLength, 2)

bbEcartype = upBollinger - lowBollinger


avgArrayEcartypeValues = ta.ema(bbEcartype, bbLength)

bbEcartypeStatus = bbEcartype < avgArrayEcartypeValues*0.8 ? "low bb ecartype" : bbEcartype > avgArrayEcartypeValues*1.2 ? "high bb ecartype" : bbEcartype > avgArrayEcartypeValues*1.4 ? "very high bb ecartype" : "neutral ecartype"



[middleBB, upperBB, lowerBB] = ta.bb(close, 20, 2)

impulsedPumpColor = color.rgb(76, 175, 79, 80)
impulsedDumpColor = color.rgb(255, 82, 82, 80)
squeezeColor = color.rgb(33, 149, 243, 80)

marketPhase = close < upperBB and close > lowerBB ? "squeeze phase" : close > upperBB ? "bullish impulsion" : close < lowerBB ? "bearish impulsion" : "error"

if marketPhase[1] == "bullish impulsion" 
    if close > middleBB
        marketPhase := "bullish impulsion"

if marketPhase[1] == "bearish impulsion"
    if close < middleBB
        marketPhase := "bearish impulsion"

bbPhaseColor = marketPhase == "squeeze phase" ? neutralColor : marketPhase == "bullish impulsion" ? bullishColor : marketPhase == "bearish impulsion" ? bearishColor : neutralColor

bbColor = marketPhase == "squeeze phase" and bbEcartypeStatus == "low bb ecartype" ? neutralColor : marketPhase == "bearish impulsion" ? bearishColor : marketPhase == "bullish impulsion" ? bullishColor : neutralColor




//###############################################################################//
//############################### TREND  TREND TREND ##############################//
//###############################################################################//
//############################### TREND TREND TREND ##############################//
//###############################################################################//
//############################### TREND TREND TREND ##############################//
//###############################################################################//
//############################### TREND TREND TREND ##############################//
//###############################################################################//
//############################### TREND TREND TREND ##############################//
//###############################################################################//

// ADX Block //
//---------//
up = ta.change(high)
down = -ta.change(low)
plusDM = na(up) ? na : (up > down and up > 0 ? up : 0)
minusDM = na(down) ? na : (down > up and down > 0 ? down : 0)
trur = ta.rma(ta.tr, len)
plus = fixnan(100 * ta.rma(plusDM, len) / trur)
minus = fixnan(100 * ta.rma(minusDM, len) / trur)
sum = plus + minus
adx = 100 * ta.rma(math.abs(plus - minus) / (sum == 0 ? 1 : sum), lensig)
adxMa = ta.sma(adx, 3)
adX = adxMa

adxStatus = adX > 25 ? "strong trend" : adX < 20 ? "weak trend" : "neutral trend"
adxColor = adxStatus == "strong trend" ? bullishColor : adxStatus == "weak trend" ? bearishColor : neutralColor


// SMA Block //
//---------//
sma = ta.sma(close, 20)


// EMA Block //
//---------//
ema1 = ta.ema(close, ema1Length)
ema1Status = close > ema1 ? "closed above" : "closed below"
ema2 = ta.ema(close, ema2Length)
ema2Status = close > ema2 ? "closed above" : "closed below"
ema3 = ta.ema(close, ema3Length)
ema3Status = close > ema3 ? "closed above" : "closed below"
ema4 = ta.ema(close, ema4Length)
ema4Status = close > ema4 ? "closed above" : "closed below"

emaAboveCount = 0
emaAboveCount += ema1Status == "closed above" ? 1 : 0
emaAboveCount += ema2Status == "closed above" ? 1 : 0
emaAboveCount += ema3Status == "closed above" ? 1 : 0
emaAboveCount += ema4Status == "closed above" ? 1 : 0

emaColor = emaAboveCount > 3 ? veryBullishColor : emaAboveCount > 2 ? bullishColor : emaAboveCount < 1 ? veryBearishColor : emaAboveCount < 2 ? bearishColor : neutralColor
emaStatus = emaAboveCount > 3 ? "very bullish" : emaAboveCount > 2 ? "bullish" : emaAboveCount < 1 ? "very bearish" : emaAboveCount < 2 ? "bearish" : "neutral"


// AROON Block //
//---------//
aroonUpper = 100 * (ta.highestbars(high, 14) + 14)/14
aroonLower = 100 * (ta.lowestbars(low, 14) + 14)/14

aroonStatus = aroonUpper > 50 and aroonLower < 50 ? "bullish trend" : aroonLower > 50 and aroonUpper < 50 ? "bearish trend" : "neutral trend"
aroonColor = aroonStatus == "bullish trend" ? bullishColor : aroonStatus == "bearish trend" ? bearishColor : neutralColor


// PSAR Block //
//---------//
psarTrendStatus = parabolicSar < close ? "bullish trend" : "bearish trend"
psartrendColor = psarTrendStatus == "bullish trend" ? bullishColor : bearishColor


//  Supertrend Block //
//---------//
superTrendStatus = supertrend < close ? "bullish trend" : "bearish trend"
superTrendColor = superTrendStatus == "bullish trend" ? bullishColor : bearishColor 



//###############################################################################//
//############################### MOMENTUM MOMENTUM ##############################//
//###############################################################################//
//############################### MOMENTUM MOMENTUM ##############################//
//###############################################################################//
//############################### MOMENTUM MOMENTUM ##############################//
//###############################################################################//
//############################### MOMENTUM MOMENTUM ##############################//
//###############################################################################//
//############################### MOMENTUM MOMENTUM ##############################//
//###############################################################################//

// RSI Block //
//---------//
rsi = ta.rsi(source = rsiSource, length = rsiLength ) 
rsiStatus = rsi > 85 ? "very overbought" : rsi > 70 ? "overbought" : rsi < 15 ? "very oversold" : rsi < 30 ? "oversold" : "neutral"
rsiColor = rsiStatus == "very overbought" ? veryBearishColor : rsiStatus == "overbought" ? bearishColor : rsiStatus == "very oversold" ? veryBullishColor : rsiStatus == "oversold" ? bullishColor : neutralColor


// STOCH RSI Block //
//---------//
k = ta.sma(ta.stoch(rsi, rsi, rsi, stochLength), 3)
stochasticRsi = ta.sma(k, 3) 
stochasticRsiStatus = stochasticRsi > 90 ? "very overbought" : stochasticRsi > 80 ? "overbought" : stochasticRsi < 10 ? "very oversold" : stochasticRsi < 20 ? "oversold" : "neutral"
stochasticRsiColor = stochasticRsiStatus == "very overbought" ? veryBearishColor : stochasticRsiStatus == "overbought" ? bearishColor : stochasticRsiStatus == "very oversold" ? veryBullishColor : stochasticRsiStatus == "oversold" ? bullishColor : neutralColor


// MFI Block //
//---------//
mfi = ta.mfi(mfiSource, mfiLength) // money flow index
mfiStatus = mfi > 90 ? "very overbought" : mfi > 80 ? "overbought" : mfi < 10 ? "very oversold" : mfi < 20 ? "oversold" : "neutral"
mfiColor = mfiStatus == "very overbought" ? veryBearishColor : mfiStatus == "overbought" ? bearishColor : mfiStatus == "very oversold" ? veryBullishColor : mfiStatus == "oversold" ? bullishColor : neutralColor


// WILLIAM %R Block //
//---------//

williamVixFormula = 100 * (close - ta.highest(williamLength)) / (ta.highest(williamLength) - ta.lowest(williamLength))

wvxStatus = williamVixFormula > -20 ? "bearish" : williamVixFormula < -80 ? "bullish" : "neutral"
wvxColor = wvxStatus == "bearish" ? bearishColor: wvxStatus == "bullish" ? bullishColor : neutralColor


// CCI Block //
//---------//
cci = ta.cci(cciSource, cciLength)
cciStatus = cci > 200 ? "very overbought" : cci > 100 ? "overbought" : cci < -200 ? "very oversold" : cci < -100 ? "oversold" : "neutral"
cciColor = cciStatus == "very overbought" ? veryBearishColor : cciStatus == "overbought" ? bearishColor : cciStatus == "oversold" ? bullishColor : cciStatus == "very oversold" ? veryBullishColor : neutralColor


// STOCH Block //
//---------//
stoch = ta.stoch(close, high, low, 14)
stochStatus = stoch > 80 ? "overbought" : stoch < 20 ? "oversold" : "neutral"
stochColor = stochStatus == "overbought" ? bearishColor : stochStatus == "oversold" ? bullishColor : neutralColor


// MOMENTUM Block //
//---------//
mom = ta.mom(source = close, length = 10)


//###############################################################################//
//############################### VOLUME VOLUME ##############################//
//###############################################################################//
//############################### VOLUME VOLUME ##############################//
//###############################################################################//
//############################### VOLUME VOLUME ##############################//
//###############################################################################//
//############################### VOLUME VOLUME ##############################//
//###############################################################################//
//############################### VOLUME VOLUME ##############################//
//###############################################################################//


// Volume compared to avgVolume Block //
//---------//
avgArrayVolumeValues = ta.ema(volume, volumeMaLength)

volumeStatus = volume > avgArrayVolumeValues*1.8 ? "very high volume" : volume > avgArrayVolumeValues*1.4 ? "high volume" : volume < avgArrayVolumeValues*0.6 ? "very low volume" : volume < avgArrayVolumeValues*0.8 ? "low volume" : "normal volume"

colorVolume = volumeStatus == "very high volume" ? veryBullishColor : volumeStatus == "high volume" ? bullishColor : volumeStatus == "very low volume" ? bearishColor : volumeStatus == "low volume" ? bearishColor: neutralColor



//###############################################################################//
//############################### RISK ASSESSMENT ##############################//
//###############################################################################//
//############################### RISK ASSESSMENT ##############################//
//###############################################################################//
//############################### RISK ASSESSMENT ##############################//
//###############################################################################//
//############################### RISK ASSESSMENT ##############################//
//###############################################################################//
//############################### RISK ASSESSMENT ##############################//
//###############################################################################//

slLong = ta.highest(high, 3) + atr * atrMult
slShort = ta.lowest(low, 3) - atr * atrMult

ph = ta.pivothigh(10, 10)
pl = ta.pivotlow(10, 10)

length = 14
// Calculate the difference between the last 10 pivot highs and pivot lows
var phTotal = array.new_float(length)
var plTotal = array.new_float(length)
for i = 0 to length - 1
    array.push(phTotal, ph[i])
    array.push(plTotal, pl[i])

avgPriceMovement = array.avg(phTotal) - array.avg(plTotal)
avgPriceMovement := ta.ema(avgPriceMovement, 9)
avgPriceMovementPercent = (avgPriceMovement/close)*100

maxLeverage = 100 / avgPriceMovementPercent
maxLeverage := maxLeverage*0.8 // Ensuring a bit more of safety
if maxLeverage < 1
    maxLeverage := 1



//###############################################################################//
//############################### FRONT END ##############################//
//###############################################################################//
//############################### FRONT END ##############################//
//###############################################################################//
//############################### FRONT END ##############################//
//###############################################################################//
//############################### FRONT END ##############################//
//###############################################################################//
//############################### FRONT END ##############################//
//###############################################################################//

//Table position and size
tablePosition = tablePos == "Top right" ? position.top_right : tablePos == "Bottom right" ? position.bottom_right : tablePos == "Bottom left" ? position.bottom_left : position.top_left

tableTextSize = tableSize == 1 ? size.tiny : tableSize == 2 ? size.small : tableSize == 3 ? size.normal : tableSize == 4 ? size.huge : size.large
tableTitleTextSize = tableSize == 1 ? size.small : tableSize == 2 ? size.normal : size.normal 

var metricTable = table.new(position = tablePosition, columns = 50, rows = 50, bgcolor = color.new(color.black, 80), border_width = 3, border_color=color.rgb(23, 23, 23))

n = "\n"

colorRow1 = color.blue

//Populating table
if displayTableVolatility
	table.cell(table_id = metricTable, column = 1, row = 1, text = "Volatility" + n + "⎯⎯⎯⎯⎯⎯⎯⎯" + n + "Value" + n + "⎯⎯⎯⎯⎯⎯" + n + "Status", text_color=colorRow1, text_halign = text.align_left, text_size=tableTextSize)
	table.cell(table_id = metricTable, column = 2, row = 1, text = "ATR" + n +  "⎯⎯⎯⎯" + n + str.tostring(math.round(atr)) + " : " + str.tostring(math.round((atr/close)*100, 2)) + "%" + n + "⎯⎯⎯⎯" + n + atrStatus, text_color=color.white, text_halign = text.align_center, bgcolor=atrColor, text_size=tableTextSize)
	table.cell(table_id = metricTable, column = 3, row = 1, text = "Bollinger Bands" + n +  "⎯⎯⎯⎯" + n + bbEcartypeStatus + " : " + str.tostring(math.round((bbEcartype/close)*100, 2)) + "%" + n + "⎯⎯⎯⎯" + n + "bb phase" + " : " + marketPhase, text_color=color.white, text_halign = text.align_center, bgcolor=bbColor, text_size=tableTextSize)


if displayTableReversal
	table.cell(table_id = metricTable, column = 1, row = 4, text = "Reversal" + n + "⎯⎯⎯⎯⎯⎯⎯⎯" + n + "Value" + n + "⎯⎯⎯⎯⎯⎯" + n + "Status", text_color=colorRow1, text_halign = text.align_left, text_size=tableTextSize)
	table.cell(table_id = metricTable, column = 2, row = 4, text = "PSAR" + n +  "⎯⎯⎯⎯" + n + str.tostring(math.round(parabolicSar)) + n + "⎯⎯⎯⎯" + n + psarStatus, text_color=color.white, text_halign = text.align_center, bgcolor=psarColor, text_size=tableTextSize)
	table.cell(table_id = metricTable, column = 3, row = 4, text = "MACD" + n +  "⎯⎯⎯⎯" + n + str.tostring(math.round(macdLine)) + n + "⎯⎯⎯⎯" + n + macdStatus, text_color=color.white, text_halign = text.align_center, bgcolor=macdColor, text_size=tableTextSize)
	table.cell(table_id = metricTable, column = 4, row = 4, text = "Super Trend" + n +  "⎯⎯⎯⎯" + n + str.tostring(math.round(supertrend)) + n + "⎯⎯⎯⎯" + n + supertrendStatus, text_color=color.white, text_halign = text.align_center, bgcolor=supertrendColor, text_size=tableTextSize)


if displayTableTrend
	table.cell(table_id = metricTable, column = 1, row = 2, text = "Trend" + n + "⎯⎯⎯⎯⎯⎯⎯⎯" + n + "Value" + n + "⎯⎯⎯⎯⎯⎯" + n + "Status", text_color=colorRow1, text_halign = text.align_left, text_size=tableTextSize)
	table.cell(table_id = metricTable, column = 2, row = 2, text = "ADX" + n +  "⎯⎯⎯⎯" + n + str.tostring(math.round(adX)) + n + "⎯⎯⎯⎯" + n + adxStatus, text_color=color.white, text_halign = text.align_center, bgcolor=adxColor, text_size=tableTextSize)
	table.cell(table_id = metricTable, column = 3, row = 2, text = "EMA" + n +  "⎯⎯⎯⎯" + n + str.tostring(ema1Length) + " : "+ str.tostring(ema1Status) + n + "⎯⎯⎯⎯" + n  + str.tostring(ema2Length) + " : "+ str.tostring(ema2Status) + n + "⎯⎯⎯⎯" + n + str.tostring(ema3Length) + " : "+ str.tostring(ema3Status) + n + "⎯⎯⎯⎯" + n + str.tostring(ema4Length) + " : "+ str.tostring(ema4Status) + n + "⎯⎯⎯⎯" + n + emaStatus + " trend",  text_color=color.white, text_halign = text.align_center, bgcolor=emaColor, text_size=tableTextSize)
	table.cell(table_id = metricTable, column = 4, row = 2, text = "Aroon" + n + "⎯⎯⎯⎯" + n + aroonStatus, text_color=color.white, text_halign = text.align_center, bgcolor=aroonColor, text_size=tableTextSize)
	table.cell(table_id = metricTable, column = 5, row = 2, text = "PSAR" + n +  "⎯⎯⎯⎯" + n + str.tostring(math.round(parabolicSar)) + n + "⎯⎯⎯⎯" + n + psarTrendStatus, text_color=color.white, text_halign = text.align_center, bgcolor=psartrendColor, text_size=tableTextSize)
	table.cell(table_id = metricTable, column = 6, row = 2, text = "Super Trend" + n +  "⎯⎯⎯⎯" + n + str.tostring(math.round(supertrend)) + n + "⎯⎯⎯⎯" + n + superTrendStatus, text_color=color.white, text_halign = text.align_center, bgcolor=superTrendColor, text_size=tableTextSize)


if displayTableMomentum
	table.cell(table_id = metricTable, column = 1, row = 3, text = "Momentum" + n + "⎯⎯⎯⎯⎯⎯⎯⎯" + n + "Value" + n + "⎯⎯⎯⎯⎯⎯" + n + "Status", text_color=colorRow1, text_halign = text.align_left, text_size=tableTextSize)
	table.cell(table_id = metricTable, column = 2, row = 3, text = "StochRSI" + n +  "⎯⎯⎯⎯" + n + str.tostring(math.round((stochasticRsi))) + n + "⎯⎯⎯⎯" + n + stochasticRsiStatus, text_color=color.white, text_halign = text.align_center, bgcolor=stochasticRsiColor, text_size=tableTextSize)
	table.cell(table_id = metricTable, column = 3, row = 3, text = "MFI" + n +  "⎯⎯⎯⎯" + n + str.tostring(math.round((mfi))) + n + "⎯⎯⎯⎯" + n + mfiStatus, text_color=color.white, text_halign = text.align_center, bgcolor=mfiColor, text_size=tableTextSize)
	table.cell(table_id = metricTable, column = 4, row = 3, text = "William %R" + n +  "⎯⎯⎯⎯" + n + str.tostring(math.round((williamVixFormula))) + n + "⎯⎯⎯⎯" + n + wvxStatus, text_color=color.white, text_halign = text.align_center, bgcolor=wvxColor, text_size=tableTextSize)
	table.cell(table_id = metricTable, column = 5, row = 3, text = "RSI" + n +  "⎯⎯⎯⎯" + n + str.tostring(math.round(rsi)) + n + "⎯⎯⎯⎯" + n + rsiStatus, text_color=color.white, text_halign = text.align_center, bgcolor=rsiColor, text_size=tableTextSize)
	table.cell(table_id = metricTable, column = 6, row = 3, text = "CCI" + n +  "⎯⎯⎯⎯" + n + str.tostring(math.round(cci)) + n + "⎯⎯⎯⎯" + n + cciStatus, text_color=color.white, text_halign = text.align_center, bgcolor=cciColor, text_size=tableTextSize)


if displayTableVolume
	table.cell(table_id = metricTable, column = 1, row = 5, text = "Volume" + n + "⎯⎯⎯⎯⎯⎯⎯⎯" + n + "Value" + n + "⎯⎯⎯⎯⎯⎯" + n + "Status", text_color=colorRow1, text_halign = text.align_left, text_size=tableTextSize)
	table.cell(table_id = metricTable, column = 2, row = 5, text = "Volume EMA" + n +  "⎯⎯⎯⎯" + n + str.tostring(math.round((volume))) + n + "⎯⎯⎯⎯" + n + volumeStatus, text_color=color.white, text_halign = text.align_center, bgcolor=colorVolume, text_size=tableTextSize)

if displayTableRiskAssesment
	table.cell(table_id = metricTable, column = 1, row = 6, text = "Risk" + n + "Assessment", text_color=color.blue, text_halign = text.align_left, text_size=tableTextSize)
	table.cell(table_id = metricTable, column = 2, row = 6, text = "Max Leverage" + n +  "⎯⎯⎯⎯" + n + str.tostring(math.round(maxLeverage, 1)), text_color=color.white, text_halign = text.align_center, bgcolor=color.new(color.blue, 80), text_size=tableTextSize)
	table.cell(table_id = metricTable, column = 3, row = 6, text = "ATR Stop Loss" + n +  "⎯⎯⎯⎯" + n + "Long SL: " + str.tostring(math.round(slLong, 2)) + n + "⎯⎯⎯⎯" + n + "Short SL: " + str.tostring(math.round(slShort, 2)), text_color=color.white, text_halign = text.align_center, bgcolor=color.new(color.blue, 80), text_size=tableTextSize)

