Multiple Moving Avg MTF Table
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © jbritton001
// MA MTF v 1.5
// script will plot the smas on higher time frames 
// Added Table
// Colored the MAs to make the plot colors
// fixed some floating issues .. along with corrected some request.security issues 
// added XY code to where the table can be moved around
// fixed then broke ... fixed the data sourced in the Weekly coloumn but lost one 
// added the wvma .. its plotted but NOT in the table as I have reached the number of security requests 
// left in the commented out parts in case TV allows more then 40 security requests in the future
// removed EMA so the table is only SMA now. 
// removed vwma 
// FIXED FINALLY figured it out .. TUPLES TUPLES 
// readded EMA and then add WMA
// ADDED VWMA 
//@version=5

indicator(title="Multiple Moving Avg MTF Table", shorttitle="Multi MA MTF", overlay=true)

// BEGIN SCRIPT 

choice = input.string(title="Moving Avarages", defval="SMA", options=["SMA", "EMA", "WMA","VWMA", "SMA Mobile"], tooltip="This options can be changes for ref or mobile as the size of the font will changed based on your selection")


s01 = input.int(title="SMA 1", defval=5, group='Simple Moving Avg')
s02 = input.int(title="SMA 2", defval=10, group='Simple Moving Avg')
s03 = input.int(title="SMA 3", defval=20, group='Simple Moving Avg')
s04 = input.int(title="SMA 4", defval=50, group='Simple Moving Avg')
s05 = input.int(title="SMA 5", defval=120, group='Simple Moving Avg')
s06 = input.int(title="SMA 6", defval=200, group='Simple Moving Avg')

// SMAs
sma1 = ta.sma(close, s01)
sma2 = ta.sma(close, s02)
sma3 = ta.sma(close, s03)
sma4 = ta.sma(close, s04)
sma5 = ta.sma(close, s05) 
sma6 = ta.sma(close, s06)

// SMA Plots
plot(series=sma1, title='SMA 1', color=color.new(#9C27B0, 0), display = display.none) // Purple
plot(series=sma2, title='SMA 2', color=color.new(#FFEB3B, 0), display = display.none) // Yellow
plot(series=sma3, title='SMA 3', color=color.new(#00E676, 0), display = display.none) // Lime Green
plot(series=sma4, title='SMA 4', color=color.new(#2196F3, 0), display = display.none) // Blue
plot(series=sma5, title='SMA 5', color=color.gray, display = display.none) // White color.new(#FFFFFF, 0)
plot(series=sma6, title='SMA 6', color=color.new(#FF9800, 0), display = display.none) // Orange


// EMA values that can be changed   
e01 = input.int(title="EMA 1", defval=5, group='Exponential Moving Avg')
e02 = input.int(title="EMA 2", defval=10,group='Exponential Moving Avg')
e03 = input.int(title="EMA 3", defval=20,group='Exponential Moving Avg')
e04 = input.int(title="EMA 4", defval=50,group='Exponential Moving Avg')
e05 = input.int(title="EMA 5", defval=120,group='Exponential Moving Avg')
e06 = input.int(title="EMA 6", defval=200,group='Exponential Moving Avg')

// EMAs
ema1 = ta.ema(close, e01)
ema2 = ta.ema(close, e02)
ema3 = ta.ema(close, e03)
ema4 = ta.ema(close, e04)
ema5 = ta.ema(close, e05) 
ema6 = ta.ema(close, e06)

// EMA Plots
plot(series=ema1, title='EMA 1', color=color.new(#9C27B0, 0), display = display.none) // Purple
plot(series=ema2, title='EMA 2', color=color.new(#FFEB3B, 0), display = display.none) // Yellow
plot(series=ema3, title='EMA 3', color=color.new(#00E676, 0), display = display.none) // Lime Green
plot(series=ema4, title='EMA 4', color=color.new(#2196F3, 0), display = display.none) // Blue
plot(series=ema5, title='EMA 5', color=color.gray, display = display.none) // White
plot(series=ema6, title='EMA 6', color=color.new(#FF9800, 0), display = display.none) // Orange

// WMA 
// WMA Inputs
w01 = input.int(title="WMA 1", defval=5, group='Weighted Moving Avg')
w02 = input.int(title="WMA 2", defval=10, group='Weighted Moving Avg')
w03 = input.int(title="WMA 3", defval=20, group='Weighted Moving Avg')
w04 = input.int(title="WMA 4", defval=50, group='Weighted Moving Avg')
w05 = input.int(title="WMA 5", defval=120, group='Weighted Moving Avg')
w06 = input.int(title="WMA 6", defval=200, group='Weighted Moving Avg')

// WMAs
wma1 = ta.wma(close, w01)
wma2 = ta.wma(close, w02)
wma3 = ta.wma(close, w03)
wma4 = ta.wma(close, w04)
wma5 = ta.wma(close, w05) 
wma6 = ta.wma(close, w06)


// WMA Plots
plot(series=wma1, title='WMA 1', color=color.new(#9C27B0, 0), display = display.none) // Purple
plot(series=wma2, title='WMA 2', color=color.new(#FFEB3B, 0), display = display.none) // Yellow
plot(series=wma3, title='WMA 3', color=color.new(#00E676, 0), display = display.none) // Lime Green
plot(series=wma4, title='WMA 4', color=color.new(#2196F3, 0), display = display.none) // Blue
plot(series=wma5, title='WMA 5', color=color.gray, display = display.none) // White
plot(series=wma6, title='WMA 6', color=color.new(#FF9800, 0), display = display.none) // Orange

// VWMA 
// VWMA Inputs
vw1 = input.int(title="VWMA 1", defval=5, group='Volume Weighted Moving Avg')
vw2 = input.int(title="VWMA 2", defval=10, group='Volume Weighted Moving Avg')
vw3 = input.int(title="VWMA 3", defval=20, group='Volume Weighted Moving Avg')
vw4 = input.int(title="VWMA 4", defval=50, group='Volume Weighted Moving Avg')
vw5 = input.int(title="VWMA 5", defval=120, group='Volume Weighted Moving Avg')
vw6 = input.int(title="VWMA 6", defval=200, group='Volume Weighted Moving Avg')

// VWMAs
vwma1 = ta.vwma(close, vw1)
vwma2 = ta.vwma(close, vw2)
vwma3 = ta.vwma(close, vw3)
vwma4 = ta.vwma(close, vw4)
vwma5 = ta.vwma(close, vw5) 
vwma6 = ta.vwma(close, vw6)


// VWMA Plots
plot(series=vwma1, title='VWMA 1', color=color.new(#9C27B0, 0), display = display.none) // Purple
plot(series=vwma2, title='VWMA 2', color=color.new(#FFEB3B, 0), display = display.none) // Yellow
plot(series=vwma3, title='VWMA 3', color=color.new(#00E676, 0), display = display.none) // Lime Green
plot(series=vwma4, title='VWMA 4', color=color.new(#2196F3, 0), display = display.none) // Blue
plot(series=vwma5, title='VWMA 5', color=color.gray, display = display.none) // White
plot(series=vwma6, title='VWMA 6', color=color.new(#FF9800, 0), display = display.none) // Orange



// MTF requests SMA 

[S1, S7, S13, S19, S25, S31] = request.security(syminfo.tickerid, "60", [sma1, sma2, sma3, sma4, sma5, sma6], lookahead=barmerge.lookahead_on)
[S2, S8, S14, S20, S26, S32] = request.security(syminfo.tickerid, "D", [sma1, sma2, sma3, sma4, sma5, sma6], lookahead=barmerge.lookahead_on)
[S3, S9, S15, S21, S27, S33] = request.security(syminfo.tickerid, "W", [sma1, sma2, sma3, sma4, sma5, sma6] , lookahead=barmerge.lookahead_on)
[S4, S10, S16, S22, S28, S34] = request.security(syminfo.tickerid, "M", [sma1, sma2, sma3, sma4, sma5, sma6] , lookahead=barmerge.lookahead_on)
[S5, S11, S17, S23, S29, S35] = request.security(syminfo.tickerid, "3M", [sma1, sma2, sma3, sma4, sma5, sma6] , lookahead=barmerge.lookahead_on)
[S6, S12, S18, S24, S30, S36] = request.security(syminfo.tickerid, "12M", [sma1, sma2, sma3, sma4, sma5, sma6] , lookahead=barmerge.lookahead_on)

// MTF EMA

[E1, E7, E13, E19, E25, E31] = request.security(syminfo.tickerid, "60", [ema1, ema2, ema3, ema4, ema5, ema6], lookahead=barmerge.lookahead_on)
[E2, E8, E14, E20, E26, E32] = request.security(syminfo.tickerid, "D", [ema1, ema2, ema3, ema4, ema5, ema6], lookahead=barmerge.lookahead_on)
[E3, E9, E15, E21, E27, E33] = request.security(syminfo.tickerid, "W", [ema1, ema2, ema3, ema4, ema5, ema6], lookahead=barmerge.lookahead_on)
[E4, E10, E16, E22, E28, E34] = request.security(syminfo.tickerid, "M", [ema1, ema2, ema3, ema4, ema5, ema6], lookahead=barmerge.lookahead_on)
[E5, E11, E17, E23, E29, E35] = request.security(syminfo.tickerid, "3M", [ema1, ema2, ema3, ema4, ema5, ema6], lookahead=barmerge.lookahead_on)
[E6, E12, E18, E24, E30, E36] = request.security(syminfo.tickerid, "12M", [ema1, ema2, ema3, ema4, ema5, ema6], lookahead=barmerge.lookahead_on)

// MTF WMA 

[W1, W7, W13, W19, W25, W31] = request.security(syminfo.tickerid, "60", [wma1, wma2, wma3, wma4, wma5, wma6], lookahead=barmerge.lookahead_on)
[W2, W8, W14, W20, W26, W32] = request.security(syminfo.tickerid, "D", [wma1, wma2, wma3, wma4, wma5, wma6], lookahead=barmerge.lookahead_on)
[W3, W9, W15, W21, W27, W33] = request.security(syminfo.tickerid, "W", [wma1, wma2, wma3, wma4, wma5, wma6], lookahead=barmerge.lookahead_on)
[W4, W10, W16, W22, W28, W34] = request.security(syminfo.tickerid, "M", [wma1, wma2, wma3, wma4, wma5, wma6], lookahead=barmerge.lookahead_on)
[W5, W11, W17, W23, W29, W35] = request.security(syminfo.tickerid, "3M", [wma1, wma2, wma3, wma4, wma5, wma6], lookahead=barmerge.lookahead_on)
[W6, W12, W18, W24, W30, W36] = request.security(syminfo.tickerid, "12M", [wma1, wma2, wma3, wma4, wma5, wma6], lookahead=barmerge.lookahead_on)

// MTF VWMA 
[VW1, VW7, VW13, VW19, VW25, VW31] = request.security(syminfo.tickerid, "60", [vwma1, vwma2, vwma3, vwma4, vwma5, vwma6], lookahead=barmerge.lookahead_on)
[VW2, VW8, VW14, VW20, VW26, VW32] = request.security(syminfo.tickerid, "D", [vwma1, vwma2, vwma3, vwma4, vwma5, vwma6], lookahead=barmerge.lookahead_on)
[VW3, VW9, VW15, VW21, VW27, VW33] = request.security(syminfo.tickerid, "W", [vwma1, vwma2, vwma3, vwma4, vwma5, vwma6], lookahead=barmerge.lookahead_on)
[VW4, VW10, VW16, VW22, VW28, VW34] = request.security(syminfo.tickerid, "M", [vwma1, vwma2, vwma3, vwma4, vwma5, vwma6], lookahead=barmerge.lookahead_on)
[VW5, VW11, VW17, VW23, VW29, VW35] = request.security(syminfo.tickerid, "3M", [vwma1, vwma2, vwma3, vwma4, vwma5, vwma6], lookahead=barmerge.lookahead_on)
[VW6, VW12, VW18, VW24, VW30, VW36] = request.security(syminfo.tickerid, "12M", [vwma1, vwma2, vwma3, vwma4, vwma5, vwma6], lookahead=barmerge.lookahead_on)


// Option Varible 
c1 = "SMA"
c2 = "EMA"
c3 = "WMA"
c4 = "VWMA"
c1_m = "SMA Mobile"


// Custom function to truncate (cut) excess decimal places
truncate(_number, _decimalPlaces) =>
    _factor = math.pow(10, _decimalPlaces)
    int(_number * _factor) / _factor
    
//Table 

TblY = input.string("top", "Table Position", inline = "11", options = ["top", "middle", "bottom"])
TblX = input.string("right", "", inline = "11", options = ["left", "center", "right"])

tTable = table.new(TblY + "_" + TblX, columns = 10, rows = 10, border_width = 1,border_color = color.black,frame_width = 1,frame_color = color.red, bgcolor=color.gray)

if barstate.islastconfirmedhistory or barstate.isrealtime
// SMA table
    if choice == c1  
        t1 = str.tostring(s01)
        t2 = str.tostring(s02)
        t3 = str.tostring(s03)
        t4 = str.tostring(s04)
        t5 = str.tostring(s05)
        t6 = str.tostring(s06)
        table.cell(table_id = tTable, column = 0, row = 0, text = "SMA",text_size = size.normal,text_color = color.black)
        table.cell(table_id = tTable, column = 1, row = 0, text = "Current",text_size = size.normal,text_color = color.black)
        table.cell(table_id = tTable, column = 0, row = 1, text = t1 ,text_size = size.normal,text_color = color.black)
        table.cell(table_id = tTable, column = 1, row = 1, text = str.tostring(truncate(sma1,2)),text_size = size.normal,bgcolor=color.new(#9C27B0, 0),text_color = color.white)
        table.cell(table_id = tTable, column = 0, row = 2, text = t2 ,text_size = size.normal,text_color = color.black)
        table.cell(table_id = tTable, column = 1, row = 2, text = str.tostring(truncate(sma2,2)),text_size = size.normal,bgcolor=color.new(#FFEB3B, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 0, row = 3, text = t3 ,text_size = size.normal,text_color = color.black)
        table.cell(table_id = tTable, column = 1, row = 3, text = str.tostring(truncate(sma2,2)),text_size = size.normal,bgcolor=color.new(#00E676, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 0, row = 4, text = t4 ,text_size = size.normal,text_color = color.black)
        table.cell(table_id = tTable, column = 1, row = 4, text = str.tostring(truncate(sma4,2)),text_size = size.normal,bgcolor=color.new(#2196F3, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 0, row = 5, text = t5,text_size = size.normal,text_color = color.black)
        table.cell(table_id = tTable, column = 1, row = 5, text = str.tostring(truncate(sma5,2)),text_size = size.normal,bgcolor=color.new(#FFFFFF, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 0, row = 6, text = t6,text_size = size.normal,text_color = color.black)
        table.cell(table_id = tTable, column = 1, row = 6, text = str.tostring(truncate(sma6,2)),text_size = size.normal,bgcolor=color.new(#FF9800, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 2, row = 0, text = "Hourly",text_size = size.normal,text_color = color.black)
        table.cell(table_id = tTable, column = 2, row = 1, text = str.tostring(truncate(S1,2)),text_size = size.normal,bgcolor=color.new(#9C27B0, 0),text_color = color.white)
        table.cell(table_id = tTable, column = 2, row = 2, text = str.tostring(truncate(S7,2)),text_size = size.normal,bgcolor=color.new(#FFEB3B, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 2, row = 3, text = str.tostring(truncate(S13,2)),text_size = size.normal,bgcolor=color.new(#00E676, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 2, row = 4, text = str.tostring(truncate(S19,2)),text_size = size.normal,bgcolor=color.new(#2196F3, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 2, row = 5, text = str.tostring(truncate(S25,2)),text_size = size.normal,bgcolor=color.new(#FFFFFF, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 2, row = 6, text = str.tostring(truncate(S31,2)),text_size = size.normal,bgcolor=color.new(#FF9800, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 3, row = 0, text = "Daily",text_size = size.normal,text_color = color.black)
        table.cell(table_id = tTable, column = 3, row = 1, text = str.tostring(truncate(S2,2)),text_size = size.normal,bgcolor=color.new(#9C27B0, 0),text_color = color.white)
        table.cell(table_id = tTable, column = 3, row = 2, text = str.tostring(truncate(S8,2)),text_size = size.normal,bgcolor=color.new(#FFEB3B, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 3, row = 3, text = str.tostring(truncate(S14,2)),text_size = size.normal,bgcolor=color.new(#00E676, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 3, row = 4, text = str.tostring(truncate(S20,2)),text_size = size.normal,bgcolor=color.new(#2196F3, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 3, row = 5, text = str.tostring(truncate(S26,2)),text_size = size.normal,bgcolor=color.new(#FFFFFF, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 3, row = 6, text = str.tostring(truncate(S32,2)),text_size = size.normal,bgcolor=color.new(#FF9800, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 4, row = 0, text = "Weekly",text_size = size.normal,text_color = color.black)
        table.cell(table_id = tTable, column = 4, row = 1, text = str.tostring(truncate(S3,2)),text_size = size.normal,bgcolor=color.new(#9C27B0, 0),text_color = color.white)
        table.cell(table_id = tTable, column = 4, row = 2, text = str.tostring(truncate(S9,2)),text_size = size.normal,bgcolor=color.new(#FFEB3B, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 4, row = 3, text = str.tostring(truncate(S15,2)),text_size = size.normal,bgcolor=color.new(#00E676, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 4, row = 4, text = str.tostring(truncate(S21,2)),text_size = size.normal,bgcolor=color.new(#2196F3, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 4, row = 5, text = str.tostring(truncate(S27,2)),text_size = size.normal,bgcolor=color.new(#FFFFFF, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 4, row = 6, text = str.tostring(truncate(S33,2)),text_size = size.normal,bgcolor=color.new(#FF9800, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 5, row = 0, text = "Montly",text_size = size.normal,text_color = color.black)
        table.cell(table_id = tTable, column = 5, row = 1, text = str.tostring(truncate(S4,2)),text_size = size.normal,bgcolor=color.new(#9C27B0, 0),text_color = color.white)
        table.cell(table_id = tTable, column = 5, row = 2, text = str.tostring(truncate(S10,2)),text_size = size.normal,bgcolor=color.new(#FFEB3B, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 5, row = 3, text = str.tostring(truncate(S16,2)),text_size = size.normal,bgcolor=color.new(#00E676, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 5, row = 4, text = str.tostring(truncate(S22,2)),text_size = size.normal,bgcolor=color.new(#2196F3, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 5, row = 5, text = str.tostring(truncate(S28,2)),text_size = size.normal,bgcolor=color.new(#FFFFFF, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 5, row = 6, text = str.tostring(truncate(S34,2)),text_size = size.normal,bgcolor=color.new(#FF9800, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 6, row = 0, text = "Quartly",text_size = size.normal,text_color = color.black)
        table.cell(table_id = tTable, column = 6, row = 1, text = str.tostring(truncate(S5,2)),text_size = size.normal,bgcolor=color.new(#9C27B0, 0),text_color = color.white)
        table.cell(table_id = tTable, column = 6, row = 2, text = str.tostring(truncate(S11,2)),text_size = size.normal,bgcolor=color.new(#FFEB3B, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 6, row = 3, text = str.tostring(truncate(S17,2)),text_size = size.normal,bgcolor=color.new(#00E676, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 6, row = 4, text = str.tostring(truncate(S23,2)),text_size = size.normal,bgcolor=color.new(#2196F3, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 6, row = 5, text = str.tostring(truncate(S29,2)),text_size = size.normal,bgcolor=color.new(#FFFFFF, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 6, row = 6, text = str.tostring(truncate(S35,2)),text_size = size.normal,bgcolor=color.new(#FF9800, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 7, row = 0, text = "Yearly",text_size = size.normal,text_color = color.black)
        table.cell(table_id = tTable, column = 7, row = 1, text = str.tostring(truncate(S6,2)),text_size = size.normal,bgcolor=color.new(#9C27B0, 0),text_color = color.white)
        table.cell(table_id = tTable, column = 7, row = 2, text = str.tostring(truncate(S12,2)),text_size = size.normal,bgcolor=color.new(#FFEB3B, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 7, row = 3, text = str.tostring(truncate(S18,2)),text_size = size.normal,bgcolor=color.new(#00E676, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 7, row = 4, text = str.tostring(truncate(S24,2)),text_size = size.normal,bgcolor=color.new(#2196F3, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 7, row = 5, text = str.tostring(truncate(S30,2)),text_size = size.normal,bgcolor=color.new(#FFFFFF, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 7, row = 6, text = str.tostring(truncate(S36,2)),text_size = size.normal,bgcolor=color.new(#FF9800, 0),text_color = color.black)
    
    else if choice == c1_m
        t01 = str.tostring(s01)
        t02 = str.tostring(s02)
        t03 = str.tostring(s03)
        t04 = str.tostring(s04)
        t05 = str.tostring(s05)
        t06 = str.tostring(s06)
        table.cell(table_id = tTable, column = 0, row = 0, text = "SMA",text_size = size.small,text_color = color.black)
        table.cell(table_id = tTable, column = 1, row = 0, text = "Current",text_size = size.small,text_color = color.black)
        table.cell(table_id = tTable, column = 0, row = 1, text = t01 ,text_size = size.small,text_color = color.black)
        table.cell(table_id = tTable, column = 1, row = 1, text = str.tostring(truncate(sma1,2)),text_size = size.small,bgcolor=color.new(#9C27B0, 0),text_color = color.white)
        table.cell(table_id = tTable, column = 0, row = 2, text = t02 ,text_size = size.small,text_color = color.black)
        table.cell(table_id = tTable, column = 1, row = 2, text = str.tostring(truncate(sma2,2)),text_size = size.small,bgcolor=color.new(#FFEB3B, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 0, row = 3, text = t03 ,text_size = size.small,text_color = color.black)
        table.cell(table_id = tTable, column = 1, row = 3, text = str.tostring(truncate(sma2,2)),text_size = size.small,bgcolor=color.new(#00E676, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 0, row = 4, text = t04 ,text_size = size.small,text_color = color.black)
        table.cell(table_id = tTable, column = 1, row = 4, text = str.tostring(truncate(sma4,2)),text_size = size.small,bgcolor=color.new(#2196F3, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 0, row = 5, text = t05,text_size = size.small,text_color = color.black)
        table.cell(table_id = tTable, column = 1, row = 5, text = str.tostring(truncate(sma5,2)),text_size = size.small,bgcolor=color.new(#FFFFFF, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 0, row = 6, text = t06,text_size = size.small,text_color = color.black)
        table.cell(table_id = tTable, column = 1, row = 6, text = str.tostring(truncate(sma6,2)),text_size = size.small,bgcolor=color.new(#FF9800, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 2, row = 0, text = "Hourly",text_size = size.small,text_color = color.black)
        table.cell(table_id = tTable, column = 2, row = 1, text = str.tostring(truncate(S1,2)),text_size = size.small,bgcolor=color.new(#9C27B0, 0),text_color = color.white)
        table.cell(table_id = tTable, column = 2, row = 2, text = str.tostring(truncate(S7,2)),text_size = size.small,bgcolor=color.new(#FFEB3B, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 2, row = 3, text = str.tostring(truncate(S13,2)),text_size = size.small,bgcolor=color.new(#00E676, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 2, row = 4, text = str.tostring(truncate(S19,2)),text_size = size.small,bgcolor=color.new(#2196F3, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 2, row = 5, text = str.tostring(truncate(S25,2)),text_size = size.small,bgcolor=color.new(#FFFFFF, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 2, row = 6, text = str.tostring(truncate(S31,2)),text_size = size.small,bgcolor=color.new(#FF9800, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 3, row = 0, text = "Daily",text_size = size.small,text_color = color.black)
        table.cell(table_id = tTable, column = 3, row = 1, text = str.tostring(truncate(S2,2)),text_size = size.small,bgcolor=color.new(#9C27B0, 0),text_color = color.white)
        table.cell(table_id = tTable, column = 3, row = 2, text = str.tostring(truncate(S8,2)),text_size = size.small,bgcolor=color.new(#FFEB3B, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 3, row = 3, text = str.tostring(truncate(S14,2)),text_size = size.small,bgcolor=color.new(#00E676, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 3, row = 4, text = str.tostring(truncate(S20,2)),text_size = size.small,bgcolor=color.new(#2196F3, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 3, row = 5, text = str.tostring(truncate(S26,2)),text_size = size.small,bgcolor=color.new(#FFFFFF, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 3, row = 6, text = str.tostring(truncate(S32,2)),text_size = size.small,bgcolor=color.new(#FF9800, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 4, row = 0, text = "Weekly",text_size = size.small,text_color = color.black)
        table.cell(table_id = tTable, column = 4, row = 1, text = str.tostring(truncate(S3,2)),text_size = size.small,bgcolor=color.new(#9C27B0, 0),text_color = color.white)
        table.cell(table_id = tTable, column = 4, row = 2, text = str.tostring(truncate(S9,2)),text_size = size.small,bgcolor=color.new(#FFEB3B, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 4, row = 3, text = str.tostring(truncate(S15,2)),text_size = size.small,bgcolor=color.new(#00E676, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 4, row = 4, text = str.tostring(truncate(S21,2)),text_size = size.small,bgcolor=color.new(#2196F3, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 4, row = 5, text = str.tostring(truncate(S27,2)),text_size = size.small,bgcolor=color.new(#FFFFFF, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 4, row = 6, text = str.tostring(truncate(S33,2)),text_size = size.small,bgcolor=color.new(#FF9800, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 5, row = 0, text = "Montly",text_size = size.small,text_color = color.black)
        table.cell(table_id = tTable, column = 5, row = 1, text = str.tostring(truncate(S4,2)),text_size = size.small,bgcolor=color.new(#9C27B0, 0),text_color = color.white)
        table.cell(table_id = tTable, column = 5, row = 2, text = str.tostring(truncate(S10,2)),text_size = size.small,bgcolor=color.new(#FFEB3B, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 5, row = 3, text = str.tostring(truncate(S16,2)),text_size = size.small,bgcolor=color.new(#00E676, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 5, row = 4, text = str.tostring(truncate(S22,2)),text_size = size.small,bgcolor=color.new(#2196F3, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 5, row = 5, text = str.tostring(truncate(S28,2)),text_size = size.small,bgcolor=color.new(#FFFFFF, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 5, row = 6, text = str.tostring(truncate(S34,2)),text_size = size.small,bgcolor=color.new(#FF9800, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 6, row = 0, text = "Quartly",text_size = size.small,text_color = color.black)
        table.cell(table_id = tTable, column = 6, row = 1, text = str.tostring(truncate(S5,2)),text_size = size.small,bgcolor=color.new(#9C27B0, 0),text_color = color.white)
        table.cell(table_id = tTable, column = 6, row = 2, text = str.tostring(truncate(S11,2)),text_size = size.small,bgcolor=color.new(#FFEB3B, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 6, row = 3, text = str.tostring(truncate(S17,2)),text_size = size.small,bgcolor=color.new(#00E676, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 6, row = 4, text = str.tostring(truncate(S23,2)),text_size = size.small,bgcolor=color.new(#2196F3, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 6, row = 5, text = str.tostring(truncate(S29,2)),text_size = size.small,bgcolor=color.new(#FFFFFF, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 6, row = 6, text = str.tostring(truncate(S35,2)),text_size = size.small,bgcolor=color.new(#FF9800, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 7, row = 0, text = "Yearly",text_size = size.small,text_color = color.black)
        table.cell(table_id = tTable, column = 7, row = 1, text = str.tostring(truncate(S6,2)),text_size = size.small,bgcolor=color.new(#9C27B0, 0),text_color = color.white)
        table.cell(table_id = tTable, column = 7, row = 2, text = str.tostring(truncate(S12,2)),text_size = size.small,bgcolor=color.new(#FFEB3B, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 7, row = 3, text = str.tostring(truncate(S18,2)),text_size = size.small,bgcolor=color.new(#00E676, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 7, row = 4, text = str.tostring(truncate(S24,2)),text_size = size.small,bgcolor=color.new(#2196F3, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 7, row = 5, text = str.tostring(truncate(S30,2)),text_size = size.small,bgcolor=color.new(#FFFFFF, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 7, row = 6, text = str.tostring(truncate(S36,2)),text_size = size.small,bgcolor=color.new(#FF9800, 0),text_color = color.black)    

// EMA Table
    else if choice  == c2
        t7 = str.tostring(e01)
        t8 = str.tostring(e02)
        t9 = str.tostring(e03)
        t10 = str.tostring(e04)
        t11 = str.tostring(e05)
        t12 = str.tostring(e06)
        table.cell(table_id = tTable, column = 0, row = 0, text = "EMA",text_size = size.normal,text_color = color.black)
        table.cell(table_id = tTable, column = 1, row = 0, text = "Current",text_size = size.normal,text_color = color.black)
        table.cell(table_id = tTable, column = 0, row = 1, text = t7 ,text_size = size.normal,text_color = color.black)
        table.cell(table_id = tTable, column = 1, row = 1, text = str.tostring(truncate(ema1,2)),text_size = size.normal,bgcolor=color.new(#9C27B0, 0),text_color = color.white)
        table.cell(table_id = tTable, column = 0, row = 2, text = t8 ,text_size = size.normal,text_color = color.black)
        table.cell(table_id = tTable, column = 1, row = 2, text = str.tostring(truncate(ema2,2)),text_size = size.normal,bgcolor=color.new(#FFEB3B, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 0, row = 3, text = t9 ,text_size = size.normal,text_color = color.black)
        table.cell(table_id = tTable, column = 1, row = 3, text = str.tostring(truncate(ema2,2)),text_size = size.normal,bgcolor=color.new(#00E676, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 0, row = 4, text = t10 ,text_size = size.normal,text_color = color.black)
        table.cell(table_id = tTable, column = 1, row = 4, text = str.tostring(truncate(ema4,2)),text_size = size.normal,bgcolor=color.new(#2196F3, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 0, row = 5, text = t11,text_size = size.normal,text_color = color.black)
        table.cell(table_id = tTable, column = 1, row = 5, text = str.tostring(truncate(ema5,2)),text_size = size.normal,bgcolor=color.new(#FFFFFF, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 0, row = 6, text = t12,text_size = size.normal,text_color = color.black)
        table.cell(table_id = tTable, column = 1, row = 6, text = str.tostring(truncate(ema6,2)),text_size = size.normal,bgcolor=color.new(#FF9800, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 2, row = 0, text = "Hourly",text_size = size.normal,text_color = color.black)
        table.cell(table_id = tTable, column = 2, row = 1, text = str.tostring(truncate(E1,2)),text_size = size.normal,bgcolor=color.new(#9C27B0, 0),text_color = color.white)
        table.cell(table_id = tTable, column = 2, row = 2, text = str.tostring(truncate(E7,2)),text_size = size.normal,bgcolor=color.new(#FFEB3B, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 2, row = 3, text = str.tostring(truncate(E13,2)),text_size = size.normal,bgcolor=color.new(#00E676, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 2, row = 4, text = str.tostring(truncate(E19,2)),text_size = size.normal,bgcolor=color.new(#2196F3, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 2, row = 5, text = str.tostring(truncate(E25,2)),text_size = size.normal,bgcolor=color.new(#FFFFFF, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 2, row = 6, text = str.tostring(truncate(E31,2)),text_size = size.normal,bgcolor=color.new(#FF9800, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 3, row = 0, text = "Daily",text_size = size.normal,text_color = color.black)
        table.cell(table_id = tTable, column = 3, row = 1, text = str.tostring(truncate(E2,2)),text_size = size.normal,bgcolor=color.new(#9C27B0, 0),text_color = color.white)
        table.cell(table_id = tTable, column = 3, row = 2, text = str.tostring(truncate(E8,2)),text_size = size.normal,bgcolor=color.new(#FFEB3B, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 3, row = 3, text = str.tostring(truncate(E14,2)),text_size = size.normal,bgcolor=color.new(#00E676, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 3, row = 4, text = str.tostring(truncate(E20,2)),text_size = size.normal,bgcolor=color.new(#2196F3, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 3, row = 5, text = str.tostring(truncate(E26,2)),text_size = size.normal,bgcolor=color.new(#FFFFFF, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 3, row = 6, text = str.tostring(truncate(E32,2)),text_size = size.normal,bgcolor=color.new(#FF9800, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 4, row = 0, text = "Weekly",text_size = size.normal,text_color = color.black)
        table.cell(table_id = tTable, column = 4, row = 1, text = str.tostring(truncate(E3,2)),text_size = size.normal,bgcolor=color.new(#9C27B0, 0),text_color = color.white)
        table.cell(table_id = tTable, column = 4, row = 2, text = str.tostring(truncate(E9,2)),text_size = size.normal,bgcolor=color.new(#FFEB3B, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 4, row = 3, text = str.tostring(truncate(E15,2)),text_size = size.normal,bgcolor=color.new(#00E676, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 4, row = 4, text = str.tostring(truncate(E21,2)),text_size = size.normal,bgcolor=color.new(#2196F3, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 4, row = 5, text = str.tostring(truncate(E27,2)),text_size = size.normal,bgcolor=color.new(#FFFFFF, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 4, row = 6, text = str.tostring(truncate(E33,2)),text_size = size.normal,bgcolor=color.new(#FF9800, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 5, row = 0, text = "Montly",text_size = size.normal,text_color = color.black)
        table.cell(table_id = tTable, column = 5, row = 1, text = str.tostring(truncate(E4,2)),text_size = size.normal,bgcolor=color.new(#9C27B0, 0),text_color = color.white)
        table.cell(table_id = tTable, column = 5, row = 2, text = str.tostring(truncate(E10,2)),text_size = size.normal,bgcolor=color.new(#FFEB3B, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 5, row = 3, text = str.tostring(truncate(E16,2)),text_size = size.normal,bgcolor=color.new(#00E676, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 5, row = 4, text = str.tostring(truncate(E22,2)),text_size = size.normal,bgcolor=color.new(#2196F3, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 5, row = 5, text = str.tostring(truncate(E28,2)),text_size = size.normal,bgcolor=color.new(#FFFFFF, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 5, row = 6, text = str.tostring(truncate(E34,2)),text_size = size.normal,bgcolor=color.new(#FF9800, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 6, row = 0, text = "Quartly",text_size = size.normal,text_color = color.black)
        table.cell(table_id = tTable, column = 6, row = 1, text = str.tostring(truncate(E5,2)),text_size = size.normal,bgcolor=color.new(#9C27B0, 0),text_color = color.white)
        table.cell(table_id = tTable, column = 6, row = 2, text = str.tostring(truncate(E11,2)),text_size = size.normal,bgcolor=color.new(#FFEB3B, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 6, row = 3, text = str.tostring(truncate(E17,2)),text_size = size.normal,bgcolor=color.new(#00E676, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 6, row = 4, text = str.tostring(truncate(E23,2)),text_size = size.normal,bgcolor=color.new(#2196F3, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 6, row = 5, text = str.tostring(truncate(E29,2)),text_size = size.normal,bgcolor=color.new(#FFFFFF, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 6, row = 6, text = str.tostring(truncate(E35,2)),text_size = size.normal,bgcolor=color.new(#FF9800, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 7, row = 0, text = "Yearly",text_size = size.normal,text_color = color.black)
        table.cell(table_id = tTable, column = 7, row = 1, text = str.tostring(truncate(E6,2)),text_size = size.normal,bgcolor=color.new(#9C27B0, 0),text_color = color.white)
        table.cell(table_id = tTable, column = 7, row = 2, text = str.tostring(truncate(E12,2)),text_size = size.normal,bgcolor=color.new(#FFEB3B, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 7, row = 3, text = str.tostring(truncate(E18,2)),text_size = size.normal,bgcolor=color.new(#00E676, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 7, row = 4, text = str.tostring(truncate(E24,2)),text_size = size.normal,bgcolor=color.new(#2196F3, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 7, row = 5, text = str.tostring(truncate(E30,2)),text_size = size.normal,bgcolor=color.new(#FFFFFF, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 7, row = 6, text = str.tostring(truncate(E36,2)),text_size = size.normal,bgcolor=color.new(#FF9800, 0),text_color = color.black)
        
      

// WMA table        
    else if choice  == c3
        t13 = str.tostring(w01)
        t14 = str.tostring(w02)
        t15 = str.tostring(w03)
        t16 = str.tostring(w04)
        t17 = str.tostring(w05)
        t18 = str.tostring(w06)
        table.cell(table_id = tTable, column = 0, row = 0, text = "WMA",text_size = size.normal,text_color = color.black)
        table.cell(table_id = tTable, column = 1, row = 0, text = "Current",text_size = size.normal,text_color = color.black)
        table.cell(table_id = tTable, column = 0, row = 1, text = t13 ,text_size = size.normal,text_color = color.black)
        table.cell(table_id = tTable, column = 1, row = 1, text = str.tostring(truncate(wma1,2)),text_size = size.normal,bgcolor=color.new(#9C27B0, 0),text_color = color.white)
        table.cell(table_id = tTable, column = 0, row = 2, text = t14 ,text_size = size.normal,text_color = color.black)
        table.cell(table_id = tTable, column = 1, row = 2, text = str.tostring(truncate(wma2,2)),text_size = size.normal,bgcolor=color.new(#FFEB3B, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 0, row = 3, text = t15 ,text_size = size.normal,text_color = color.black)
        table.cell(table_id = tTable, column = 1, row = 3, text = str.tostring(truncate(wma2,2)),text_size = size.normal,bgcolor=color.new(#00E676, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 0, row = 4, text = t16 ,text_size = size.normal,text_color = color.black)
        table.cell(table_id = tTable, column = 1, row = 4, text = str.tostring(truncate(wma4,2)),text_size = size.normal,bgcolor=color.new(#2196F3, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 0, row = 5, text = t17,text_size = size.normal,text_color = color.black)
        table.cell(table_id = tTable, column = 1, row = 5, text = str.tostring(truncate(wma5,2)),text_size = size.normal,bgcolor=color.new(#FFFFFF, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 0, row = 6, text = t18,text_size = size.normal,text_color = color.black)
        table.cell(table_id = tTable, column = 1, row = 6, text = str.tostring(truncate(wma6,2)),text_size = size.normal,bgcolor=color.new(#FF9800, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 2, row = 0, text = "Hourly",text_size = size.normal,text_color = color.black)
        table.cell(table_id = tTable, column = 2, row = 1, text = str.tostring(truncate(W1,2)),text_size = size.normal,bgcolor=color.new(#9C27B0, 0),text_color = color.white)
        table.cell(table_id = tTable, column = 2, row = 2, text = str.tostring(truncate(W7,2)),text_size = size.normal,bgcolor=color.new(#FFEB3B, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 2, row = 3, text = str.tostring(truncate(W13,2)),text_size = size.normal,bgcolor=color.new(#00E676, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 2, row = 4, text = str.tostring(truncate(W19,2)),text_size = size.normal,bgcolor=color.new(#2196F3, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 2, row = 5, text = str.tostring(truncate(W25,2)),text_size = size.normal,bgcolor=color.new(#FFFFFF, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 2, row = 6, text = str.tostring(truncate(W31,2)),text_size = size.normal,bgcolor=color.new(#FF9800, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 3, row = 0, text = "Daily",text_size = size.normal,text_color = color.black)
        table.cell(table_id = tTable, column = 3, row = 1, text = str.tostring(truncate(W2,2)),text_size = size.normal,bgcolor=color.new(#9C27B0, 0),text_color = color.white)
        table.cell(table_id = tTable, column = 3, row = 2, text = str.tostring(truncate(W8,2)),text_size = size.normal,bgcolor=color.new(#FFEB3B, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 3, row = 3, text = str.tostring(truncate(W14,2)),text_size = size.normal,bgcolor=color.new(#00E676, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 3, row = 4, text = str.tostring(truncate(W20,2)),text_size = size.normal,bgcolor=color.new(#2196F3, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 3, row = 5, text = str.tostring(truncate(W26,2)),text_size = size.normal,bgcolor=color.new(#FFFFFF, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 3, row = 6, text = str.tostring(truncate(W32,2)),text_size = size.normal,bgcolor=color.new(#FF9800, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 4, row = 0, text = "Weekly",text_size = size.normal,text_color = color.black)
        table.cell(table_id = tTable, column = 4, row = 1, text = str.tostring(truncate(W3,2)),text_size = size.normal,bgcolor=color.new(#9C27B0, 0),text_color = color.white)
        table.cell(table_id = tTable, column = 4, row = 2, text = str.tostring(truncate(W9,2)),text_size = size.normal,bgcolor=color.new(#FFEB3B, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 4, row = 3, text = str.tostring(truncate(W15,2)),text_size = size.normal,bgcolor=color.new(#00E676, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 4, row = 4, text = str.tostring(truncate(W21,2)),text_size = size.normal,bgcolor=color.new(#2196F3, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 4, row = 5, text = str.tostring(truncate(W27,2)),text_size = size.normal,bgcolor=color.new(#FFFFFF, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 4, row = 6, text = str.tostring(truncate(W33,2)),text_size = size.normal,bgcolor=color.new(#FF9800, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 5, row = 0, text = "Montly",text_size = size.normal,text_color = color.black)
        table.cell(table_id = tTable, column = 5, row = 1, text = str.tostring(truncate(W4,2)),text_size = size.normal,bgcolor=color.new(#9C27B0, 0),text_color = color.white)
        table.cell(table_id = tTable, column = 5, row = 2, text = str.tostring(truncate(W10,2)),text_size = size.normal,bgcolor=color.new(#FFEB3B, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 5, row = 3, text = str.tostring(truncate(W16,2)),text_size = size.normal,bgcolor=color.new(#00E676, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 5, row = 4, text = str.tostring(truncate(W22,2)),text_size = size.normal,bgcolor=color.new(#2196F3, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 5, row = 5, text = str.tostring(truncate(W28,2)),text_size = size.normal,bgcolor=color.new(#FFFFFF, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 5, row = 6, text = str.tostring(truncate(W34,2)),text_size = size.normal,bgcolor=color.new(#FF9800, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 6, row = 0, text = "Quartly",text_size = size.normal,text_color = color.black)
        table.cell(table_id = tTable, column = 6, row = 1, text = str.tostring(truncate(W5,2)),text_size = size.normal,bgcolor=color.new(#9C27B0, 0),text_color = color.white)
        table.cell(table_id = tTable, column = 6, row = 2, text = str.tostring(truncate(W11,2)),text_size = size.normal,bgcolor=color.new(#FFEB3B, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 6, row = 3, text = str.tostring(truncate(W17,2)),text_size = size.normal,bgcolor=color.new(#00E676, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 6, row = 4, text = str.tostring(truncate(W23,2)),text_size = size.normal,bgcolor=color.new(#2196F3, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 6, row = 5, text = str.tostring(truncate(W29,2)),text_size = size.normal,bgcolor=color.new(#FFFFFF, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 6, row = 6, text = str.tostring(truncate(W35,2)),text_size = size.normal,bgcolor=color.new(#FF9800, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 7, row = 0, text = "Yearly",text_size = size.normal,text_color = color.black)
        table.cell(table_id = tTable, column = 7, row = 1, text = str.tostring(truncate(W6,2)),text_size = size.normal,bgcolor=color.new(#9C27B0, 0),text_color = color.white)
        table.cell(table_id = tTable, column = 7, row = 2, text = str.tostring(truncate(W12,2)),text_size = size.normal,bgcolor=color.new(#FFEB3B, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 7, row = 3, text = str.tostring(truncate(W18,2)),text_size = size.normal,bgcolor=color.new(#00E676, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 7, row = 4, text = str.tostring(truncate(W24,2)),text_size = size.normal,bgcolor=color.new(#2196F3, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 7, row = 5, text = str.tostring(truncate(W30,2)),text_size = size.normal,bgcolor=color.new(#FFFFFF, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 7, row = 6, text = str.tostring(truncate(W36,2)),text_size = size.normal,bgcolor=color.new(#FF9800, 0),text_color = color.black)

// VWMA table        
    else if choice  == c4
        t19 = str.tostring(vw1)
        t20 = str.tostring(vw2)
        t21 = str.tostring(vw3)
        t22 = str.tostring(vw4)
        t23 = str.tostring(vw5)
        t24 = str.tostring(vw6)    
        table.cell(table_id = tTable, column = 0, row = 0, text = "VWMA",text_size = size.normal,text_color = color.black)
        table.cell(table_id = tTable, column = 1, row = 0, text = "Current",text_size = size.normal,text_color = color.black)
        table.cell(table_id = tTable, column = 0, row = 1, text = t19 ,text_size = size.normal,text_color = color.black)
        table.cell(table_id = tTable, column = 1, row = 1, text = str.tostring(truncate(vwma1,2)),text_size = size.normal,bgcolor=color.new(#9C27B0, 0),text_color = color.white)
        table.cell(table_id = tTable, column = 0, row = 2, text = t20 ,text_size = size.normal,text_color = color.black)
        table.cell(table_id = tTable, column = 1, row = 2, text = str.tostring(truncate(vwma2,2)),text_size = size.normal,bgcolor=color.new(#FFEB3B, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 0, row = 3, text = t21 ,text_size = size.normal,text_color = color.black)
        table.cell(table_id = tTable, column = 1, row = 3, text = str.tostring(truncate(vwma2,2)),text_size = size.normal,bgcolor=color.new(#00E676, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 0, row = 4, text = t22 ,text_size = size.normal,text_color = color.black)
        table.cell(table_id = tTable, column = 1, row = 4, text = str.tostring(truncate(vwma4,2)),text_size = size.normal,bgcolor=color.new(#2196F3, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 0, row = 5, text = t23,text_size = size.normal,text_color = color.black)
        table.cell(table_id = tTable, column = 1, row = 5, text = str.tostring(truncate(vwma5,2)),text_size = size.normal,bgcolor=color.new(#FFFFFF, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 0, row = 6, text = t24,text_size = size.normal,text_color = color.black)
        table.cell(table_id = tTable, column = 1, row = 6, text = str.tostring(truncate(vwma6,2)),text_size = size.normal,bgcolor=color.new(#FF9800, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 2, row = 0, text = "Hourly",text_size = size.normal,text_color = color.black)
        table.cell(table_id = tTable, column = 2, row = 1, text = str.tostring(truncate(VW1,2)),text_size = size.normal,bgcolor=color.new(#9C27B0, 0),text_color = color.white)
        table.cell(table_id = tTable, column = 2, row = 2, text = str.tostring(truncate(VW7,2)),text_size = size.normal,bgcolor=color.new(#FFEB3B, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 2, row = 3, text = str.tostring(truncate(VW13,2)),text_size = size.normal,bgcolor=color.new(#00E676, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 2, row = 4, text = str.tostring(truncate(VW19,2)),text_size = size.normal,bgcolor=color.new(#2196F3, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 2, row = 5, text = str.tostring(truncate(VW25,2)),text_size = size.normal,bgcolor=color.new(#FFFFFF, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 2, row = 6, text = str.tostring(truncate(VW31,2)),text_size = size.normal,bgcolor=color.new(#FF9800, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 3, row = 0, text = "Daily",text_size = size.normal,text_color = color.black)
        table.cell(table_id = tTable, column = 3, row = 1, text = str.tostring(truncate(VW2,2)),text_size = size.normal,bgcolor=color.new(#9C27B0, 0),text_color = color.white)
        table.cell(table_id = tTable, column = 3, row = 2, text = str.tostring(truncate(VW8,2)),text_size = size.normal,bgcolor=color.new(#FFEB3B, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 3, row = 3, text = str.tostring(truncate(VW14,2)),text_size = size.normal,bgcolor=color.new(#00E676, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 3, row = 4, text = str.tostring(truncate(VW20,2)),text_size = size.normal,bgcolor=color.new(#2196F3, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 3, row = 5, text = str.tostring(truncate(VW26,2)),text_size = size.normal,bgcolor=color.new(#FFFFFF, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 3, row = 6, text = str.tostring(truncate(VW32,2)),text_size = size.normal,bgcolor=color.new(#FF9800, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 4, row = 0, text = "Weekly",text_size = size.normal,text_color = color.black)
        table.cell(table_id = tTable, column = 4, row = 1, text = str.tostring(truncate(VW3,2)),text_size = size.normal,bgcolor=color.new(#9C27B0, 0),text_color = color.white)
        table.cell(table_id = tTable, column = 4, row = 2, text = str.tostring(truncate(VW9,2)),text_size = size.normal,bgcolor=color.new(#FFEB3B, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 4, row = 3, text = str.tostring(truncate(VW15,2)),text_size = size.normal,bgcolor=color.new(#00E676, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 4, row = 4, text = str.tostring(truncate(VW21,2)),text_size = size.normal,bgcolor=color.new(#2196F3, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 4, row = 5, text = str.tostring(truncate(VW27,2)),text_size = size.normal,bgcolor=color.new(#FFFFFF, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 4, row = 6, text = str.tostring(truncate(VW33,2)),text_size = size.normal,bgcolor=color.new(#FF9800, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 5, row = 0, text = "Montly",text_size = size.normal,text_color = color.black)
        table.cell(table_id = tTable, column = 5, row = 1, text = str.tostring(truncate(VW4,2)),text_size = size.normal,bgcolor=color.new(#9C27B0, 0),text_color = color.white)
        table.cell(table_id = tTable, column = 5, row = 2, text = str.tostring(truncate(VW10,2)),text_size = size.normal,bgcolor=color.new(#FFEB3B, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 5, row = 3, text = str.tostring(truncate(VW16,2)),text_size = size.normal,bgcolor=color.new(#00E676, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 5, row = 4, text = str.tostring(truncate(VW22,2)),text_size = size.normal,bgcolor=color.new(#2196F3, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 5, row = 5, text = str.tostring(truncate(VW28,2)),text_size = size.normal,bgcolor=color.new(#FFFFFF, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 5, row = 6, text = str.tostring(truncate(VW34,2)),text_size = size.normal,bgcolor=color.new(#FF9800, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 6, row = 0, text = "Quartly",text_size = size.normal,text_color = color.black)
        table.cell(table_id = tTable, column = 6, row = 1, text = str.tostring(truncate(VW5,2)),text_size = size.normal,bgcolor=color.new(#9C27B0, 0),text_color = color.white)
        table.cell(table_id = tTable, column = 6, row = 2, text = str.tostring(truncate(VW11,2)),text_size = size.normal,bgcolor=color.new(#FFEB3B, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 6, row = 3, text = str.tostring(truncate(VW17,2)),text_size = size.normal,bgcolor=color.new(#00E676, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 6, row = 4, text = str.tostring(truncate(VW23,2)),text_size = size.normal,bgcolor=color.new(#2196F3, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 6, row = 5, text = str.tostring(truncate(VW29,2)),text_size = size.normal,bgcolor=color.new(#FFFFFF, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 6, row = 6, text = str.tostring(truncate(VW35,2)),text_size = size.normal,bgcolor=color.new(#FF9800, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 7, row = 0, text = "Yearly",text_size = size.normal,text_color = color.black)
        table.cell(table_id = tTable, column = 7, row = 1, text = str.tostring(truncate(VW6,2)),text_size = size.normal,bgcolor=color.new(#9C27B0, 0),text_color = color.white)
        table.cell(table_id = tTable, column = 7, row = 2, text = str.tostring(truncate(VW12,2)),text_size = size.normal,bgcolor=color.new(#FFEB3B, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 7, row = 3, text = str.tostring(truncate(VW18,2)),text_size = size.normal,bgcolor=color.new(#00E676, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 7, row = 4, text = str.tostring(truncate(VW24,2)),text_size = size.normal,bgcolor=color.new(#2196F3, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 7, row = 5, text = str.tostring(truncate(VW30,2)),text_size = size.normal,bgcolor=color.new(#FFFFFF, 0),text_color = color.black)
        table.cell(table_id = tTable, column = 7, row = 6, text = str.tostring(truncate(VW36,2)),text_size = size.normal,bgcolor=color.new(#FF9800, 0),text_color = color.black)
    


// END OF CODE