Nasdaq 100 Screener
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © avsr90


//@version=5
indicator("Nasdaq100 Input Screener","N100",max_bars_back=5000)


//Input for A to B stocks
Sym0 =input.string(defval="nasdaq:aapl",title="input A to B(Use dropdown symbol ▼ to view and select Input Symbols in Input Box)",options=["nasdaq:atvi","nasdaq:adbe","nasdaq:amd","nasdaq:algn","nasdaq:googl",
 "nasdaq:goog","nasdaq:amzn","nasdaq:aep","nasdaq:amgn","nasdaq:adi","nasdaq:anss","nasdaq:aapl","nasdaq:amat","nasdaq:asml",
  "nasdaq:team","nasdaq:adsk", "nasdaq:adp","nasdaq:bidu","nasdaq:biib","nasdaq:bkng","nasdaq:avgo"])

//Switch of A to B stocks
Name1=switch Sym0 

	"nasdaq:atvi" =>"ActivisionBlizzard"
	"nasdaq:adbe"=> "AdobeInformation"
	"nasdaq:amd"=> "AdvancedMicroDevices"  
	"nasdaq:algn"=> "AlignTechnology"
	"nasdaq:googl"=>  "AlphabetClassA"
	"nasdaq:goog"=> "AlphabetClassC	"
    "nasdaq:amzn"=> "Amazoncom"
    "nasdaq:aep"=>  "AmericanElectricPower"
    "nasdaq:amgn"=> "Amgen"
    "nasdaq:adi"=> "AnalogDevices"
    "nasdaq:anss"=> "Ansys"
    "nasdaq:aapl"=> "Apple"
    "nasdaq:amat"=> "AppliedMaterials"
    "nasdaq:asml"=> "ASMLHolding"
    "nasdaq:team"=> "Atlassian"
    "nasdaq:adsk"=> "Autodesk"
    "nasdaq:adp"=> "AutomaticDataProcessing"
    "nasdaq:bidu"=> "Baidu "
    "nasdaq:biib"=>"Biogen	"
    "nasdaq:bkng"=>"BookingHoldings	"
    "nasdaq:avgo"=>"Broadcom"
    

//Inputs for C to E stocks 
Sym2 =input.string(defval="nasdaq:cdns",title="input C to E(Use dropdown symbol ▼ to view and select Input Symbols in Input Box)",options=["nasdaq:cdns","nasdaq:cdw","nasdaq:chtr","nasdaq:chkp",
 "nasdaq:ctas","nasdaq:csco","nasdaq:ctsh","nasdaq:cmcsa","nasdaq:cprt","nasdaq:cost","nasdaq:crwd","nasdaq:csx","nasdaq:dxcm","nasdaq:docu",
 "nasdaq:dltr","nasdaq:ebay","nasdaq:ea","nasdaq:exc"])

//Switch  of C to E stocks 
Name2=switch Sym2
    "nasdaq:cdns"=> "CadenceDesignSystems"
    "nasdaq:cdw"=>"CDW"
    "nasdaq:chtr"=>"Charter Communication"	
    "nasdaq:chkp"=>"CheckPoint"
    "nasdaq:csco"=>"CiscoSystems"
    "nasdaq:ctsh"=> "Cognizant"
    "nasdaq:cmcsa"=>"Comcast"
    "nasdaq:cprt"=>"Copart"
    "nasdaq:cost"=> "Costco"
    "nasdaq:crwd"=> "CrowdStrike"
    "nasdaq:csx"=>"CSXCorporation"
    "nasdaq:ctas"=>"Cintas Corporation"
    "nasdaq:dxcm"=>"DexCom"
    "nasdaq:docu"=> "DocuSign"
    "nasdaq:dltr"=> "DollarTree"
    "nasdaq:ebay"=>"eBay"
    "nasdaq:ea"=>"ElectronicArts"
    "nasdaq:exc"=>"Exelon"
   
//Input for F to L stocks 
Sym3 =input.string(defval="nasdaq:fast",title="input F to L(Use dropdown symbol ▼ to view and select Input Symbols in Input Box)",options=["nasdaq:fast","nasdaq:fisv","nasdaq:foxa","nasdaq:fox",
 "nasdaq:gild","nasdaq:hon","nasdaq:idxx","nasdaq:ilmn","nasdaq:incy","nasdaq:intc","nasdaq:intu","nasdaq:isrg","nasdaq:jd",
 "nasdaq:kdp","nasdaq:klac", "nasdaq:khc","nasdaq:lrcx","nasdaq:lulu"])


//Switch of F to L stocks 
Name3=switch Sym3
    "nasdaq:meta"=>"Meta"
    "nasdaq:fast"=>"Fastenal"
    "nasdaq:fisv"=>"Fiserv"
    "nasdaq:foxa"=>"FoxCorporationClassA"
    "nasdaq:fox"=>"FoxCorporationClassB"
    "nasdaq:gild"=>"GileadSciences"
    "nasdaq:hon"=>"Honeywell"
    "nasdaq:idxx"=>"IdexxLaboratories"
    "nasdaq:ilmn"=>"Illumina"
    "nasdaq:incy"=>"Incyte"
    "nasdaq:intc"=>"Intel"
    "nasdaq:intu"=> "Intuit"
    "nasdaq:isrg"=> "IntuitiveSurgical"
    "nasdaq:jd"=> "JDcom"
    "nasdaq:kdp"=>"Keurig Dr Pepper"
    "nasdaq:klac"=>"KLACorporation"	
    "nasdaq:khc"=>"KraftHeinz"
    "nasdaq:lrcx"=>"LamResearch"
    "nasdaq:lulu"=>"LululemonAthletica"
    


//Input for M to P stocks 
Sym4 =input.string(defval="nasdaq:mar",title="input M to P (Use dropdown symbol ▼ to view and select Input Symbols in Input Box)",options=["nasdaq:mar","nasdaq:mrvl","nasdaq:mtch","nasdaq:meli",
 "nasdaq:meta", "nasdaq:mchp","nasdaq:mu","nasdaq:msft", "nasdaq:mrna","nasdaq:mdlz","nasdaq:mnst","nasdaq:ntes","nasdaq:nflx",
 "nasdaq:nvda","nasdaq:nxpi","nasdaq:orly","nasdaq:okta", "nasdaq:pcar", "nasdaq:payx","nasdaq:pypl","nasdaq:pton",
  "nasdaq:pep","nasdaq:pdd"])

//Switch of M to P stocks   
Name4=switch Sym4
    "nasdaq:mar"=> "MarriottInternational"
    "nasdaq:mrvl"=> "MarvellTechnology"
    "nasdaq:mtch"=>"MatchGroup"
    "nasdaq:meli"=>"MercadoLibre"
    "nasdaq:mchp"=>"MicrochipTechnology"
    "nasdaq:mu"=> "MicronTechnology	"
    "nasdaq:msft"=>"Microsoft"
    "nasdaq:mrna"=> "Moderna",
    "nasdaq:mdlz"=>"MondelezInternational"
    "nasdaq:mnst"=>"MonsterBeverage	"
    "nasdaq:ntes"=>"NetEase	" 
    "nasdaq:nflx"=>"Netflix	"
    "nasdaq:nvda"=>"Nvidia"	
    "nasdaq:nxpi"=> "NXPSemiconductors"
    "nasdaq:orly"=>"OReillyAutomotive"
    "nasdaq:okta"=>"Okta"
    "nasdaq:pcar"=> "Paccar	"
    "nasdaq:payx"=> "Paychex"
    "nasdaq:pypl"=>"PayPal	"
    "nasdaq:pton"=>"PelotonInteractive"
    "nasdaq:pep"=>"PepsiCo",
    "nasdaq:pdd"=>"Pinduoduo"


//Input for Q to Z stocks 
Sym5 =input.string(defval="nasdaq:sgen",title="input Q toZ(Use dropdown symbol ▼ to view and select Input Symbols in Input Box)",options=["nasdaq:qcom","nasdaq:regn","nasdaq:rost","nasdaq:sgen",
 "nasdaq:siri","nasdaq:swks","nasdaq:splk","nasdaq:sbux", "nasdaq:snps","nasdaq:tmus","nasdaq:tsla","nasdaq:txn","nasdaq:tcom",
 "nasdaq:vrsn","nasdaq:vrsk", "nasdaq:vrtx","nasdaq:wba","nasdaq:wday","nasdaq:xel","nasdaq:zm"])

//Switch of Q to Z stocks 
Name5=switch Sym5
    "nasdaq:qcom"=>"Qualcomm"
    "nasdaq:regn"=>"RegeneronPharmaceuticals"
    "nasdaq:rost"=>"RossStores"
    "nasdaq:sgen"=>"Seagen"
    "nasdaq:siri"=>"SiriusXM"
    "nasdaq:swks"=>"SkyworksSolutions"
    "nasdaq:splk"=>"Splunk"
    "nasdaq:sbux"=>"Starbucks"	
    "nasdaq:snps"=>"Synopsys"
    "nasdaq:tmus"=>"TMobileUS"
    "nasdaq:tsla"=>"Tesla"
    "nasdaq:txn"=>"TexasInstruments"
    "nasdaq:tcom"=>"TripcomGroup"
    "nasdaq:vrsn"=> "Verisign"
    "nasdaq:vrsk"=>"VeriskAnalytics"
    "nasdaq:vrtx"=>"VertexPharmaceuticals"	
    "nasdaq:wba"=>"WalgreensBootsAlliance"
    "nasdaq:wday"=>"Workday"
    "nasdaq:xel"=>"XcelEnergy"
    "nasdaq:xlnx"=>"Xilinx	"
    "nasdaq:zm"=>"ZoomVideoCommunicati"

//Input for A to Z stocks (All stocks)

Syma=input.string(defval="nasdaq:aapl",title="Input A to Z (Use dropdown symbol ▼ to view and select Input Symbols in Input Box)",options=["nasdaq:atvi","nasdaq:adbe","nasdaq:amd","nasdaq:algn","nasdaq:googl",
 "nasdaq:goog","nasdaq:amzn","nasdaq:aep","nasdaq:amgn","nasdaq:adi","nasdaq:anss","nasdaq:aapl","nasdaq:amat","nasdaq:asml",
  "nasdaq:team","nasdaq:adsk", "nasdaq:adp","nasdaq:bidu","nasdaq:biib","nasdaq:bkng","nasdaq:avgo",
 "nasdaq:cdns","nasdaq:cdw","nasdaq:chtr","nasdaq:chkp","nasdaq:ctas","nasdaq:csco","nasdaq:ctsh","nasdaq:cmcsa","nasdaq:cprt",
 "nasdaq:cost","nasdaq:crwd","nasdaq:csx","nasdaq:dxcm","nasdaq:docu",
 "nasdaq:dltr","nasdaq:ebay","nasdaq:ea","nasdaq:exc","nasdaq:fast","nasdaq:fisv","nasdaq:foxa","nasdaq:fox",
 "nasdaq:gild","nasdaq:hon","nasdaq:idxx","nasdaq:ilmn","nasdaq:incy","nasdaq:intc","nasdaq:intu","nasdaq:isrg","nasdaq:jd",
 "nasdaq:kdp","nasdaq:klac", "nasdaq:khc","nasdaq:lrcx","nasdaq:lulu","nasdaq:mar","nasdaq:mrvl","nasdaq:mtch","nasdaq:meli",
 "nasdaq:meta",
 "nasdaq:mchp","nasdaq:mu","nasdaq:msft","nasdaq:mrna","nasdaq:mdlz","nasdaq:mnst","nasdaq:ntes","nasdaq:nflx","nasdaq:nvda",
 "nasdaq:nxpi","nasdaq:orly","nasdaq:okta",
 "nasdaq:pcar", "nasdaq:payx","nasdaq:pypl","nasdaq:pton","nasdaq:pep","nasdaq:pdd","nasdaq:qcom","nasdaq:regn","nasdaq:rost",
 "nasdaq:sgen",
 "nasdaq:siri","nasdaq:swks","nasdaq:splk","nasdaq:sbux", "nasdaq:snps","nasdaq:tmus","nasdaq:tsla","nasdaq:txn","nasdaq:tcom",
 "nasdaq:vrsn","nasdaq:vrsk", "nasdaq:vrtx","nasdaq:wba","nasdaq:wday","nasdaq:xel","nasdaq:zm"])

//switch of A to Z stocks (All stocks)
Nameall=switch Syma 
	"nasdaq:atvi" =>"ActivisionBlizzard"
	"nasdaq:adbe"=> "AdobeInformation"
	"nasdaq:amd"=> "AdvancedMicroDevices"  
	"nasdaq:algn"=> "AlignTechnology"
	"nasdaq:googl"=>  "AlphabetClassA"
	"nasdaq:goog"=> "AlphabetClassC	"
    "nasdaq:amzn"=> "Amazoncom"
    "nasdaq:aep"=>  "AmericanElectricPower"
    "nasdaq:amgn"=> "Amgen"
    "nasdaq:adi"=> "AnalogDevices"
    "nasdaq:anss"=> "Ansys"
    "nasdaq:aapl"=> "Apple"
    "nasdaq:amat"=> "AppliedMaterials"
    "nasdaq:asml"=> "ASMLHolding"
    "nasdaq:team"=> "Atlassian"
    "nasdaq:adsk"=> "Autodesk"
    "nasdaq:adp"=> "AutomaticDataProcessing"
    "nasdaq:bidu"=> "Baidu "
    "nasdaq:biib"=>"Biogen	"
    "nasdaq:bkng"=>"BookingHoldings	"
    "nasdaq:avgo"=>"Broadcom"
    "nasdaq:cdns"=>  "CadenceDesignSystems"
    "nasdaq:cdw"=>"CDW"
    "nasdaq:chtr"=>"Charter Communication"	
    "nasdaq:chkp"=>"CheckPoint"
    "nasdaq:csco"=>"CiscoSystems"
    "nasdaq:ctsh"=> "Cognizant"
    "nasdaq:cmcsa"=>"Comcast"
    "nasdaq:cprt"=>"Copart"
    "nasdaq:cost"=> "Costco"
    "nasdaq:crwd"=> "CrowdStrike"
    "nasdaq:csx"=>"CSXCorporation"
    "nasdaq:ctas"=>"Cintas Corporation"
    "nasdaq:dxcm"=>"DexCom"
    "nasdaq:docu"=> "DocuSign"
    "nasdaq:dltr"=> "DollarTree"
    "nasdaq:ebay"=>"eBay"
    "nasdaq:ea"=>"ElectronicArts"
    "nasdaq:exc"=>"Exelon"
    "nasdaq:meta"=>"Meta"
    "nasdaq:fast"=>"Fastenal"
    "nasdaq:fisv"=>"Fiserv"
    "nasdaq:foxa"=>"FoxCorporationClassA"
    "nasdaq:fox"=>"FoxCorporationClassB"
    "nasdaq:gild"=>"GileadSciences"
    "nasdaq:hon"=>"Honeywell"
    "nasdaq:idxx"=>"IdexxLaboratories"
    "nasdaq:ilmn"=>"Illumina"
    "nasdaq:incy"=>"Incyte"
    "nasdaq:intc"=>"Intel"
    "nasdaq:intu"=> "Intuit"
    "nasdaq:isrg"=> "IntuitiveSurgical"
    "nasdaq:jd"=> "JDcom"
    "nasdaq:kdp"=>"Keurig Dr Pepper"
    "nasdaq:klac"=>"KLACorporation"	
    "nasdaq:khc"=>"KraftHeinz"
    "nasdaq:lrcx"=>"LamResearch"
    "nasdaq:lulu"=>"LululemonAthletica"
    "nasdaq:mar"=> "MarriottInternational"
    "nasdaq:mrvl"=> "MarvellTechnology"
    "nasdaq:mtch"=>"MatchGroup"
    "nasdaq:meli"=>"MercadoLibre"
    "nasdaq:mchp"=>"MicrochipTechnology"
    "nasdaq:mu"=> "MicronTechnology	"
    "nasdaq:msft"=>"Microsoft"
    "nasdaq:mrna"=> "Moderna",
    "nasdaq:mdlz"=>"MondelezInternational"
    "nasdaq:mnst"=>"MonsterBeverage	"
    "nasdaq:ntes"=>"NetEase	" 
    "nasdaq:nflx"=>"Netflix	"
    "nasdaq:nvda"=>"Nvidia"	
    "nasdaq:nxpi"=> "NXPSemiconductors"
    "nasdaq:orly"=>"OReillyAutomotive"
    "nasdaq:okta"=>"Okta"
    "nasdaq:pcar"=> "Paccar	"
    "nasdaq:payx"=> "Paychex"
    "nasdaq:pypl"=>"PayPal	"
    "nasdaq:pton"=>"PelotonInteractive"
    "nasdaq:pep"=>"PepsiCo",
    "nasdaq:pdd"=>"Pinduoduo"
    "nasdaq:qcom"=>"Qualcomm"
    "nasdaq:regn"=>"RegeneronPharmaceuticals"
    "nasdaq:rost"=>"RossStores"
    "nasdaq:sgen"=>"Seagen"
    "nasdaq:siri"=>"SiriusXM"
    "nasdaq:swks"=>"SkyworksSolutions"
    "nasdaq:splk"=>"Splunk"
    "nasdaq:sbux"=>"Starbucks"	
    "nasdaq:snps"=>"Synopsys"
    "nasdaq:tmus"=>"TMobileUS"
    "nasdaq:tsla"=>"Tesla"
    "nasdaq:txn"=>"TexasInstruments"
    "nasdaq:tcom"=>"TripcomGroup"
    "nasdaq:vrsn"=> "Verisign"
    "nasdaq:vrsk"=>"VeriskAnalytics"
    "nasdaq:vrtx"=>"VertexPharmaceuticals"	
    "nasdaq:wba"=>"WalgreensBootsAlliance"
    "nasdaq:wday"=>"Workday"
    "nasdaq:xel"=>"XcelEnergy"
    "nasdaq:xlnx"=>"Xilinx	"
    "nasdaq:zm"=>"ZoomVideoCommunicati"



//Resolutions 
Resn=input.timeframe(defval="",title="resolution")
Resn1=input.timeframe(defval="D",title="resolution")


//Nasdaq Index input
Sym=input.symbol(defval="nasdaq:ndx",title="Nasdaq")
Nift= request.security(Sym ,Resn1,close[1],barmerge.gaps_off, barmerge.lookahead_on) 

//length from Day open 
Nifnum= ta.change(Nift)
Lb=int(math.max(1, nz(ta.barssince(Nifnum)) + 1))

//Lengths for various Table parameters 
Lfor_Atr=input.int(defval=14,title="LforAtr")
Lfor_Rsi=input.int(defval=14,title="L for Rsi")
Lfor_Cci=input.int(defval=20,title="Lfor CCI")
Lfor_Dmi=input.int(defval=14,title="Lfor Dmi")
Lfor_Dmisig=input.int(defval=14,title="LfordmiSig")
Lfor_Mom=input.int(defval=10,title="lfor Mom")
Lfor_Cmo=input.int(defval=9,title="lfor CMO")


//Chaikin Money Flow parameter
var cumVol = 0.
cumVol += nz(volume)
Lfor_Cmf= input.int(20, minval=1,title="LforCMF")
ad = close==high and close==low or high==low ? 0 : ((2*close-low-high)/(high-low))*volume
cmf = math.sum(ad, Lfor_Cmf) / math.sum(volume,Lfor_Cmf )


//Macd and Signal
[macdline, signalline, _] = ta.macd(close, 12, 26, 9)
[_, _, adx] = ta.dmi(Lfor_Dmi,Lfor_Dmisig)



//SMA calculations
Sma20=math.round_to_mintick(ta.sma(close,20))
Sma50=math.round_to_mintick(ta.sma(close,50))
Sma200=math.round_to_mintick(ta.sma(close,200))

//Table parameters

cle=math.round_to_mintick(close)

oc1=math.round_to_mintick(cle-cle[1])

adin=math.round_to_mintick(ta.roc(cle,Lb))

adi1=math.round_to_mintick(Sma20)
max_bars_back(adi1,500)

adi2=math.round_to_mintick(cle-Sma20)
max_bars_back(adi2,500)

adi3=math.round_to_mintick(Sma50)
max_bars_back(adi3,500)

adi4=math.round_to_mintick(cle-Sma50)
max_bars_back(adi4,500)

adi5=math.round_to_mintick(Sma200)
max_bars_back(adi5,500)

adi6=math.round_to_mintick(cle-Sma200)
max_bars_back(adi6,500)

adi7=math.round_to_mintick(adx)
max_bars_back(adi7,500)

adi8=math.round_to_mintick(ta.rsi(cle,Lfor_Rsi))
max_bars_back(adi8,500)

adi9=math.round_to_mintick(ta.cci(hlc3,Lfor_Cci))
max_bars_back(adi9,500)

adi10=math.round_to_mintick(ta.atr(Lfor_Atr))
max_bars_back(adi10,500)

adi11=math.round_to_mintick(ta.mom(cle,Lfor_Mom))
max_bars_back(adi11,500)

adi12=math.round_to_mintick(ta.cmo(cle,Lfor_Cmo) )
max_bars_back(adi12,500)

adi13=math.round_to_mintick(cmf )
max_bars_back(adi13,500)

adi14=math.round_to_mintick(macdline )
max_bars_back(adi14,500)

adi15=math.round_to_mintick(signalline )
max_bars_back(adi15,500)


//Table parameters retrieval

[nif,cl,dif,avgn]= request.security(Sym ,Resn1,[cle[1],cle,oc1,adin],barmerge.gaps_off, barmerge.lookahead_on) 

[a20,a20d,a50,a50d,a200,a200d,dx,r,c,atr,mom,nvv,mf,macd,sig]=request.security(Sym ,Resn,[adi1,adi2,adi3,adi4,adi5,adi6,adi7,adi8,
 adi9,adi10,adi11,adi12,adi13,adi14,adi15], barmerge.gaps_off, barmerge.lookahead_on)


[nif1,cl1,dif1,avgn1]=request.security(Sym0 ,Resn1,[cle[1],cle,oc1,adin],barmerge.gaps_off, barmerge.lookahead_on) 

[a201,a20d1,a501,a50d1,a2001,a200d1,dx1,r1,c1,atr1,mom1,nvv1,mf1,macd1,sig1]=request.security(Sym0 ,Resn,[adi1,adi2,adi3,adi4,adi5,
 adi6,adi7,adi8,adi9,adi10,adi11,adi12,adi13,adi14,adi15],barmerge.gaps_off, barmerge.lookahead_on)


[nif2,cl2,dif2,avgn2]=request.security(Sym2 ,Resn1,[cle[1],cle,oc1,adin],barmerge.gaps_off, barmerge.lookahead_on) 

[a202,a20d2,a502,a50d2,a2002,a200d2,dx2,r2,c2,atr2,mom2,nvv2,mf2,macd2,sig2]=request.security(Sym2 ,Resn,[adi1,adi2,adi3,adi4,adi5,
 adi6, adi7,adi8,adi9,adi10,adi11,adi12,adi13,adi14,adi15], barmerge.gaps_off, barmerge.lookahead_on) 


[nif3,cl3,dif3,avgn3]=request.security(Sym3 ,Resn1,[cle[1],cle,oc1,adin],barmerge.gaps_off, barmerge.lookahead_on) 

[a203,a20d3,a503,a50d3,a2003,a200d3,dx3,r3,c3,atr3,mom3,nvv3,mf3,macd3,sig3]=request.security(Sym3 ,Resn,[adi1,adi2,adi3,adi4,adi5,
 adi6,adi7,adi8,adi9,adi10,adi11,adi12,adi13,adi14,adi15], barmerge.gaps_off, barmerge.lookahead_on) 


[nif4,cl4,dif4,avgn4]=request.security(Sym4 ,Resn1,[cle[1],cle,oc1,adin],barmerge.gaps_off, barmerge.lookahead_on) 

[a204,a20d4,a504,a50d4,a2004,a200d4,dx4,r4,c4,atr4,mom4,nvv4,mf4,macd4,sig4]=request.security(Sym4 ,Resn,[adi1,adi2,adi3,adi4,adi5,
 adi6,adi7,adi8,adi9,adi10,adi11,adi12,adi13,adi14,adi15], barmerge.gaps_off, barmerge.lookahead_on) 


[nif5,cl5,dif5,avgn5]=request.security(Sym5 ,Resn1,[cle[1],cle,oc1,adin],barmerge.gaps_off, barmerge.lookahead_on) 

[a205,a20d5,a505,a50d5,a2005,a200d5,dx5,r5,c5,atr5,mom5,nvv5,mf5,macd5,sig5]=request.security(Sym5 ,Resn,[adi1,adi2,adi3,adi4,adi5,
 adi6,adi7,adi8,adi9,adi10,adi11,adi12,adi13,adi14,adi15],barmerge.gaps_off, barmerge.lookahead_on) 

 
[nif6,cl6,dif6,avgn6]=request.security(Syma ,Resn1,[cle[1],cle,oc1,adin],barmerge.gaps_off, barmerge.lookahead_on) 

[a206,a20d6,a506,a50d6,a2006,a200d6,dx6,r6,c6,atr6,mom6,nvv6,mf6,macd6,sig6]=request.security(Syma ,Resn,[adi1,adi2,adi3,adi4,adi5,
 adi6,adi7,adi8,adi9,adi10,adi11,adi12,adi13,adi14,adi15], barmerge.gaps_off, barmerge.lookahead_on) 
 


//Table

BorderThickness = 1
TableWidth = 0
Tableheight=0



TableLocation = input.string("top_left", title='Select Table Position',options=["top_left","top_center","top_right",
   "middle_left","middle_center","middle_right","bottom_left","bottom_center","bottom_right"] , 
   tooltip="Default location is at top_ left")
 
TableTextSize = input.string("Auto", title='Select Table Text Size',options=["Auto","Huge","Large","Normal","Small",
  "Tiny"] , tooltip="Default Text Size is Auto")


celltextsize = switch TableTextSize
    "Auto" => size.auto
    "Huge" => size.huge
    "Large" => size.large
    "Normal" => size.normal
    "Small" => size.small
    "Tiny" => size.tiny


//colors
TBGcol=input.color(defval=color.new(#ffffff,0),title="BG color")   

cellcol=input.color(defval=color.new(#c2e1b4,20),title="column header  BG color")


cellcol1=input.color(defval=color.new(#c2e1b4,20),title="column header  BG color")


ctexcol=input.color(defval=color.new(#000000,0),title="column header textcolor")


var table t = table.new (position=TableLocation,columns=30,rows= 50, bgcolor=TBGcol,frame_color=color.black,frame_width=2,
 border_color=color.gray,border_width=BorderThickness)

if barstate.islast
    
    
    table.cell(t, 1, 4,"Index" ,text_size=celltextsize, width=TableWidth,height=Tableheight,bgcolor=cellcol,text_color=ctexcol,text_halign=text.align_left)
    table.cell(t, 2, 4,"Name" ,text_size=celltextsize, width=TableWidth,height=Tableheight,bgcolor=cellcol,text_color=ctexcol,
     text_halign=text.align_left)
    table.cell(t, 3, 4,"Op",text_size=celltextsize, width=TableWidth,height=Tableheight,bgcolor=cellcol,text_color=ctexcol)
    table.cell(t, 4, 4,"LaP",text_size=celltextsize, width=TableWidth,height=Tableheight,bgcolor=cellcol,text_color=ctexcol)
    table.cell(t, 5, 4,"O-L",text_size=celltextsize, width=TableWidth,height=Tableheight,bgcolor=cellcol,text_color=ctexcol)
    table.cell(t, 6, 4,"ROC",text_size=celltextsize, width=TableWidth,height=Tableheight,bgcolor=cellcol,text_color=ctexcol)
    table.cell(t, 7, 4,"Sma20",text_size=celltextsize, width=TableWidth,height=Tableheight,bgcolor=cellcol,text_color=ctexcol)
    table.cell(t, 8,4,"s20d",text_size=celltextsize, width=TableWidth,height=Tableheight,bgcolor=cellcol,text_color=ctexcol)
    table.cell(t, 9, 4,"Sma50",text_size=celltextsize, width=TableWidth,height=Tableheight,bgcolor=cellcol,text_color=ctexcol)
    table.cell(t, 10, 4,"s50d",text_size=celltextsize, width=TableWidth,height=Tableheight,bgcolor=cellcol,text_color=ctexcol)
    table.cell(t, 11, 4,"Sma200", text_size=celltextsize,width=TableWidth,height=Tableheight,bgcolor=cellcol,text_color=ctexcol)
    table.cell(t, 12,4,"s200d",text_size=celltextsize, width=TableWidth,height=Tableheight,bgcolor=cellcol,text_color=ctexcol)
    table.cell(t, 13,4,"ADX(14)",text_size=celltextsize, width=TableWidth,height=Tableheight,bgcolor=cellcol,text_color=ctexcol)
    table.cell(t, 14,4,"RSI(14)",text_size=celltextsize, width=TableWidth,height=Tableheight,bgcolor=cellcol,text_color=ctexcol)
    table.cell(t, 15,4,"CCI(20)",text_size=celltextsize, width=TableWidth,height=Tableheight,bgcolor=cellcol,text_color=ctexcol)
    table.cell(t, 16,4,"ATR(14)",text_size=celltextsize, width=TableWidth,height=Tableheight,bgcolor=cellcol,text_color=ctexcol)
    table.cell(t, 17,4,"MOM(10)",text_size=celltextsize, width=TableWidth,height=Tableheight,bgcolor=cellcol,text_color=ctexcol)
    table.cell(t, 18,4,"CMO",text_size=celltextsize, width=TableWidth,height=Tableheight,bgcolor=cellcol,text_color=ctexcol)
    table.cell(t, 19,4,"CMF(20)",text_size=celltextsize, width=TableWidth,height=Tableheight,bgcolor=cellcol,text_color=ctexcol)
    table.cell(t, 20,4,"Macd",text_size=celltextsize, width=TableWidth,height=Tableheight,bgcolor=cellcol,text_color=ctexcol)
    table.cell(t, 21,4,"Sig",text_size=celltextsize, width=TableWidth,height=Tableheight,bgcolor=cellcol,text_color=ctexcol)
    

    table.cell(t, 2, 5, "Nasdaq",text_size=celltextsize, width=TableWidth,height=Tableheight,bgcolor=cellcol1,text_color=ctexcol,
     text_halign=text.align_left)
    table.cell(t, 3, 5, str.tostring(nif),text_size=celltextsize, width=TableWidth,height=Tableheight,text_color=color.blue,
     text_halign=text.align_right)
    table.cell(t, 4, 5, str.tostring(cl),text_size=celltextsize, width=TableWidth,text_color=cl>cl[1]? color.green:
     color.red,height=Tableheight,text_halign=text.align_right)
    table.cell(t, 5, 5, str.tostring(dif),text_size=celltextsize, width=TableWidth,text_color=dif>0 ? color.green:
      color.red,height=Tableheight,text_halign=text.align_right)
    table.cell(t, 6, 5, str.tostring(avgn),text_size=celltextsize, width=TableWidth,text_color=avgn>0 ? color.green:
     color.red,height=Tableheight,text_halign=text.align_right)
    table.cell(t, 7, 5, str.tostring(a20),text_size=celltextsize, width=TableWidth, text_color= color.blue,height=Tableheight)
    table.cell(t, 8, 5, str.tostring(a20d),text_size=celltextsize, width=TableWidth,text_color=a20d>0? color.green:color.red,
     height=Tableheight,text_halign=text.align_right)
    table.cell(t, 9, 5, str.tostring(a50),text_size=celltextsize, width=TableWidth,text_color=color.blue,height=Tableheight,
     text_halign=text.align_right)
    table.cell(t, 10, 5, str.tostring(a50d),text_size=celltextsize, width=TableWidth,text_color=a50d>0 ? color.green:color.red,
     height=Tableheight,text_halign=text.align_right)
    table.cell(t, 11, 5, str.tostring(a200),text_size=celltextsize, width=TableWidth,text_color=color.blue,height=Tableheight,
     text_halign=text.align_right)
    table.cell(t, 12, 5, str.tostring(a200d),text_size=celltextsize, width=TableWidth, text_color=a200d>0 ?color.green:color.red,
     height=Tableheight,text_halign=text.align_right)
    table.cell(t, 13, 5, str.tostring(dx),text_size=celltextsize, width=TableWidth, text_color=color.blue,height=Tableheight,
     text_halign=text.align_right)
    table.cell(t, 14, 5, str.tostring(r),text_size=celltextsize, width=TableWidth, text_color=color.blue,
     height=Tableheight,text_halign=text.align_right)
    table.cell(t, 15, 5, str.tostring(c),text_size=celltextsize, width=TableWidth, text_color=c>0 ? color.green:color.red,
     height=Tableheight, text_halign=text.align_right)
    table.cell(t, 16, 5, str.tostring(atr),text_size=celltextsize, width=TableWidth, text_color=color.blue,
     height=Tableheight,text_halign=text.align_right)
    table.cell(t, 17, 5, str.tostring(mom),text_size=celltextsize, width=TableWidth, text_color=mom>0 ? color.green:color.red,
     height=Tableheight, text_halign=text.align_right)
    table.cell(t, 18, 5, str.tostring(nvv),text_size=celltextsize, width=TableWidth, text_color=nvv>0 ? color.green:color.red,
     height=Tableheight,text_halign=text.align_right)
    table.cell(t, 19, 5, str.tostring(mf),text_size=celltextsize, width=TableWidth, text_color=mf>0 ? color.green:color.red,
     height=Tableheight,text_halign=text.align_right)
    table.cell(t, 20, 5, str.tostring(macd),text_size=celltextsize, width=TableWidth, text_color=macd>0 ? color.green:color.red,
     height=Tableheight,text_halign=text.align_right)
    table.cell(t, 21, 5, str.tostring(sig),text_size=celltextsize, width=TableWidth, text_color=sig>0 ? color.green:color.red,
     height=Tableheight,text_halign=text.align_right)
    
    
    
    table.cell(t, 1, 6, "A to B",text_size=celltextsize, width=TableWidth,height=Tableheight,bgcolor=TBGcol,text_color=color.fuchsia,
     text_halign=text.align_left)
    table.cell(t, 2, 6, str.tostring(Name1),text_size=celltextsize, width=TableWidth,height=Tableheight,bgcolor=cellcol1,text_color=ctexcol,
     text_halign=text.align_left)
    table.cell(t, 3, 6, str.tostring(nif1),text_size=celltextsize, width=TableWidth,height=Tableheight,text_color=color.blue,
     text_halign=text.align_right)
    table.cell(t, 4, 6, str.tostring(cl1),text_size=celltextsize, width=TableWidth,text_color=cl1>cl1[1]? color.green:
     color.red,height=Tableheight,text_halign=text.align_right)
    table.cell(t, 5, 6, str.tostring(dif1),text_size=celltextsize, width=TableWidth,text_color=dif1>0 ? color.green:
      color.red,height=Tableheight,text_halign=text.align_right)
    table.cell(t, 6, 6, str.tostring(avgn1),text_size=celltextsize, width=TableWidth,text_color=avgn1>0 ? color.green:
     color.red,height=Tableheight,text_halign=text.align_right)
    table.cell(t, 7, 6, str.tostring(a201),text_size=celltextsize, width=TableWidth, text_color= color.blue,height=Tableheight)
    table.cell(t, 8, 6, str.tostring(a20d1),text_size=celltextsize, width=TableWidth,text_color=a20d1>0? color.green:color.red,
     height=Tableheight,text_halign=text.align_right)
    table.cell(t, 9, 6, str.tostring(a501),text_size=celltextsize, width=TableWidth,text_color=color.blue,height=Tableheight,
     text_halign=text.align_right)
    table.cell(t, 10, 6, str.tostring(a50d1),text_size=celltextsize, width=TableWidth,text_color=a50d1>0 ? color.green:color.red,
     height=Tableheight,text_halign=text.align_right)
    table.cell(t, 11, 6, str.tostring(a2001),text_size=celltextsize, width=TableWidth,text_color=color.blue,height=Tableheight,
     text_halign=text.align_right)
    table.cell(t, 12, 6, str.tostring(a200d1),text_size=celltextsize, width=TableWidth, text_color=a200d1>0 ?color.green:color.red,
     height=Tableheight,text_halign=text.align_right)
    table.cell(t, 13, 6, str.tostring(dx1),text_size=celltextsize, width=TableWidth, text_color=color.blue,height=Tableheight,
     text_halign=text.align_right)
    table.cell(t, 14, 6, str.tostring(r1),text_size=celltextsize, width=TableWidth, text_color=color.blue,
     height=Tableheight,text_halign=text.align_right)
    table.cell(t, 15, 6, str.tostring(c1),text_size=celltextsize, width=TableWidth, text_color=c1>0 ? color.green:color.red,
     height=Tableheight, text_halign=text.align_right)
    table.cell(t, 16, 6, str.tostring(atr1),text_size=celltextsize, width=TableWidth, text_color=color.blue,
     height=Tableheight,text_halign=text.align_right)
    table.cell(t, 17, 6, str.tostring(mom1),text_size=celltextsize, width=TableWidth, text_color=mom1>0 ? color.green:color.red,
     height=Tableheight, text_halign=text.align_right)
    table.cell(t, 18, 6, str.tostring(nvv1),text_size=celltextsize, width=TableWidth, text_color=nvv1>0 ? color.green:color.red,
     height=Tableheight,text_halign=text.align_right)
    table.cell(t, 19, 6, str.tostring(mf1),text_size=celltextsize, width=TableWidth, text_color=mf1>0 ? color.green:color.red,
     height=Tableheight,text_halign=text.align_right)
    table.cell(t, 20, 6, str.tostring(macd1),text_size=celltextsize, width=TableWidth, text_color=macd1>0 ? color.green:color.red,
     height=Tableheight,text_halign=text.align_right)
    table.cell(t, 21, 6, str.tostring(sig1),text_size=celltextsize, width=TableWidth, text_color=sig1>0 ? color.green:color.red,
     height=Tableheight,text_halign=text.align_right)
    
    table.cell(t, 1, 7, "C to E",text_size=celltextsize, width=TableWidth,height=Tableheight,bgcolor=TBGcol,text_color=color.fuchsia,
     text_halign=text.align_left)
    table.cell(t, 2, 7, str.tostring(Name2),text_size=celltextsize, width=TableWidth,height=Tableheight,bgcolor=cellcol1,text_color=ctexcol,
     text_halign=text.align_left)
    table.cell(t, 3, 7, str.tostring(nif2),text_size=celltextsize, width=TableWidth,height=Tableheight,text_color=color.blue,
     text_halign=text.align_right)
    table.cell(t, 4, 7, str.tostring(cl2),text_size=celltextsize, width=TableWidth,text_color=cl2>cl2[1]? color.green:
     color.red,height=Tableheight,text_halign=text.align_right)
    table.cell(t, 5, 7, str.tostring(dif2),text_size=celltextsize, width=TableWidth,text_color=dif2>0 ? color.green:
      color.red,height=Tableheight,text_halign=text.align_right)
    table.cell(t, 6, 7, str.tostring(avgn2),text_size=celltextsize, width=TableWidth,text_color=avgn2>0 ? color.green:
     color.red,height=Tableheight,text_halign=text.align_right)
    table.cell(t, 7, 7, str.tostring(a202),text_size=celltextsize, width=TableWidth, text_color= color.blue,height=Tableheight)
    table.cell(t, 8, 7, str.tostring(a20d2),text_size=celltextsize, width=TableWidth,text_color=a20d2>0? color.green:color.red,
     height=Tableheight,text_halign=text.align_right)
    table.cell(t, 9, 7, str.tostring(a502),text_size=celltextsize, width=TableWidth,text_color=color.blue,height=Tableheight,
     text_halign=text.align_right)
    table.cell(t, 10, 7, str.tostring(a50d2),text_size=celltextsize, width=TableWidth,text_color=a50d2>0 ? color.green:color.red,
     height=Tableheight,text_halign=text.align_right)
    table.cell(t, 11, 7, str.tostring(a2002),text_size=celltextsize, width=TableWidth,text_color=color.blue,height=Tableheight,
     text_halign=text.align_right)
    table.cell(t, 12, 7, str.tostring(a200d2),text_size=celltextsize, width=TableWidth, text_color=a200d2>0 ?color.green:color.red,
     height=Tableheight,text_halign=text.align_right)
    table.cell(t, 13, 7, str.tostring(dx2),text_size=celltextsize, width=TableWidth, text_color=color.blue,height=Tableheight,
     text_halign=text.align_right)
    table.cell(t, 14, 7, str.tostring(r2),text_size=celltextsize, width=TableWidth, text_color=color.blue,
     height=Tableheight,text_halign=text.align_right)
    table.cell(t, 15, 7, str.tostring(c2),text_size=celltextsize, width=TableWidth, text_color=c2>0 ? color.green:color.red,
     height=Tableheight, text_halign=text.align_right)
    table.cell(t, 16, 7, str.tostring(atr2),text_size=celltextsize, width=TableWidth, text_color=color.blue,
     height=Tableheight,text_halign=text.align_right)
    table.cell(t, 17, 7, str.tostring(mom2),text_size=celltextsize, width=TableWidth, text_color=mom2>0 ? color.green:color.red,
     height=Tableheight, text_halign=text.align_right)
    table.cell(t, 18, 7, str.tostring(nvv2),text_size=celltextsize, width=TableWidth, text_color=nvv2>0 ? color.green:color.red,
     height=Tableheight,text_halign=text.align_right)
    table.cell(t, 19, 7, str.tostring(mf2),text_size=celltextsize, width=TableWidth, text_color=mf2>0 ? color.green:color.red,
     height=Tableheight,text_halign=text.align_right)
    table.cell(t, 20, 7, str.tostring(macd2),text_size=celltextsize, width=TableWidth, text_color=macd2>0 ? color.green:color.red,
     height=Tableheight,text_halign=text.align_right)
    table.cell(t, 21, 7, str.tostring(sig2),text_size=celltextsize, width=TableWidth, text_color=sig2>0 ? color.green:color.red,
     height=Tableheight,text_halign=text.align_right)
    

    table.cell(t, 1, 8, "F to L",text_size=celltextsize, width=TableWidth,height=Tableheight,bgcolor=TBGcol,text_color=color.fuchsia,
     text_halign=text.align_left)
    table.cell(t, 2, 8, str.tostring(Name3),text_size=celltextsize, width=TableWidth,height=Tableheight,bgcolor=cellcol1,text_color=ctexcol,
     text_halign=text.align_left)
    table.cell(t, 3, 8, str.tostring(nif3),text_size=celltextsize, width=TableWidth,height=Tableheight,text_color=color.blue,
     text_halign=text.align_right)
    table.cell(t, 4, 8, str.tostring(cl3),text_size=celltextsize, width=TableWidth,text_color=cl3>cl3[1]? color.green:
     color.red,height=Tableheight,text_halign=text.align_right)
    table.cell(t, 5, 8, str.tostring(dif3),text_size=celltextsize, width=TableWidth,text_color=dif3>0 ? color.green:
      color.red,height=Tableheight,text_halign=text.align_right)
    table.cell(t, 6, 8, str.tostring(avgn3),text_size=celltextsize, width=TableWidth,text_color=avgn3>0 ? color.green:
     color.red,height=Tableheight,text_halign=text.align_right)
    table.cell(t, 7, 8, str.tostring(a203),text_size=celltextsize, width=TableWidth, text_color= color.blue,height=Tableheight)
    table.cell(t, 8, 8, str.tostring(a20d3),text_size=celltextsize, width=TableWidth,text_color=a20d3>0? color.green:color.red,
     height=Tableheight,text_halign=text.align_right)
    table.cell(t, 9, 8, str.tostring(a503),text_size=celltextsize, width=TableWidth,text_color=color.blue,height=Tableheight,
     text_halign=text.align_right)
    table.cell(t, 10, 8, str.tostring(a50d3),text_size=celltextsize, width=TableWidth,text_color=a50d3>0 ? color.green:color.red,
     height=Tableheight,text_halign=text.align_right)
    table.cell(t, 11, 8, str.tostring(a2003),text_size=celltextsize, width=TableWidth,text_color=color.blue,height=Tableheight,
     text_halign=text.align_right)
    table.cell(t, 12, 8, str.tostring(a200d3),text_size=celltextsize, width=TableWidth, text_color=a200d3>0 ?color.green:color.red,
     height=Tableheight,text_halign=text.align_right)
    table.cell(t, 13, 8, str.tostring(dx3),text_size=celltextsize, width=TableWidth, text_color=color.blue,height=Tableheight,
     text_halign=text.align_right)
    table.cell(t, 14, 8, str.tostring(r3),text_size=celltextsize, width=TableWidth, text_color=color.blue,
     height=Tableheight,text_halign=text.align_right)
    table.cell(t, 15, 8, str.tostring(c3),text_size=celltextsize, width=TableWidth, text_color=c3>0 ? color.green:color.red,
     height=Tableheight, text_halign=text.align_right)
    table.cell(t, 16, 8, str.tostring(atr3),text_size=celltextsize, width=TableWidth, text_color=color.blue,
     height=Tableheight,text_halign=text.align_right)
    table.cell(t, 17, 8, str.tostring(mom3),text_size=celltextsize, width=TableWidth, text_color=mom3>0 ? color.green:color.red,
     height=Tableheight, text_halign=text.align_right)
    table.cell(t, 18, 8, str.tostring(nvv3),text_size=celltextsize, width=TableWidth, text_color=nvv3>0 ? color.green:color.red,
     height=Tableheight,text_halign=text.align_right)
    table.cell(t, 19, 8, str.tostring(mf3),text_size=celltextsize, width=TableWidth, text_color=mf3>0 ? color.green:color.red,
     height=Tableheight,text_halign=text.align_right)
    table.cell(t, 20, 8, str.tostring(macd3),text_size=celltextsize, width=TableWidth, text_color=macd3>0 ? color.green:color.red,
     height=Tableheight,text_halign=text.align_right)
    table.cell(t, 21, 8, str.tostring(sig3),text_size=celltextsize, width=TableWidth, text_color=sig3>0 ? color.green:color.red,
     height=Tableheight,text_halign=text.align_right)
    
    
    table.cell(t, 1, 9, "M to P",text_size=celltextsize, width=TableWidth,height=Tableheight,bgcolor=TBGcol,text_color=color.fuchsia,
     text_halign=text.align_left)
    table.cell(t, 2, 9, str.tostring(Name4),text_size=celltextsize, width=TableWidth,height=Tableheight,bgcolor=cellcol1,text_color=ctexcol,
     text_halign=text.align_left)
    table.cell(t, 3, 9, str.tostring(nif4),text_size=celltextsize, width=TableWidth,height=Tableheight,text_color=color.blue,
     text_halign=text.align_right)
    table.cell(t, 4, 9, str.tostring(cl4),text_size=celltextsize, width=TableWidth,text_color=cl4>cl4[1]? color.green:
     color.red,height=Tableheight,text_halign=text.align_right)
    table.cell(t, 5, 9, str.tostring(dif4),text_size=celltextsize, width=TableWidth,text_color=dif4>0 ? color.green:
      color.red,height=Tableheight,text_halign=text.align_right)
    table.cell(t, 6, 9, str.tostring(avgn4),text_size=celltextsize, width=TableWidth,text_color=avgn4>0 ? color.green:
     color.red,height=Tableheight,text_halign=text.align_right)
    table.cell(t, 7, 9, str.tostring(a204),text_size=celltextsize, width=TableWidth, text_color= color.blue,height=Tableheight)
    table.cell(t, 8, 9, str.tostring(a20d4),text_size=celltextsize, width=TableWidth,text_color=a20d4>0? color.green:color.red,
     height=Tableheight,text_halign=text.align_right)
    table.cell(t, 9, 9, str.tostring(a504),text_size=celltextsize, width=TableWidth,text_color=color.blue,height=Tableheight,
     text_halign=text.align_right)
    table.cell(t, 10, 9, str.tostring(a50d4),text_size=celltextsize, width=TableWidth,text_color=a50d4>0 ? color.green:color.red,
     height=Tableheight,text_halign=text.align_right)
    table.cell(t, 11, 9, str.tostring(a2004),text_size=celltextsize, width=TableWidth,text_color=color.blue,height=Tableheight,
     text_halign=text.align_right)
    table.cell(t, 12, 9, str.tostring(a200d4),text_size=celltextsize, width=TableWidth, text_color=a200d4>0 ?color.green:color.red,
     height=Tableheight,text_halign=text.align_right)
    table.cell(t, 13, 9, str.tostring(dx4),text_size=celltextsize, width=TableWidth, text_color=color.blue,height=Tableheight,
     text_halign=text.align_right)
    table.cell(t, 14, 9, str.tostring(r4),text_size=celltextsize, width=TableWidth, text_color=color.blue,
     height=Tableheight,text_halign=text.align_right)
    table.cell(t, 15, 9, str.tostring(c4),text_size=celltextsize, width=TableWidth, text_color=c4>0 ? color.green:color.red,
     height=Tableheight, text_halign=text.align_right)
    table.cell(t, 16, 9, str.tostring(atr4),text_size=celltextsize, width=TableWidth, text_color=color.blue,
     height=Tableheight,text_halign=text.align_right)
    table.cell(t, 17, 9, str.tostring(mom4),text_size=celltextsize, width=TableWidth, text_color=mom4>0 ? color.green:color.red,
     height=Tableheight, text_halign=text.align_right)
    table.cell(t, 18, 9, str.tostring(nvv4),text_size=celltextsize, width=TableWidth, text_color=nvv4>0 ? color.green:color.red,
     height=Tableheight,text_halign=text.align_right)
    table.cell(t, 19, 9, str.tostring(mf4),text_size=celltextsize, width=TableWidth, text_color=mf4>0 ? color.green:color.red,
     height=Tableheight,text_halign=text.align_right)
    table.cell(t, 20, 9, str.tostring(macd4),text_size=celltextsize, width=TableWidth, text_color=macd4>0 ? color.green:color.red,
     height=Tableheight,text_halign=text.align_right)
    table.cell(t, 21, 9, str.tostring(sig4),text_size=celltextsize, width=TableWidth, text_color=sig4>0 ? color.green:color.red,
     height=Tableheight,text_halign=text.align_right)
    
    table.cell(t, 1, 10, "R to Z",text_size=celltextsize, width=TableWidth,height=Tableheight,bgcolor=TBGcol,text_color=color.fuchsia,
     text_halign=text.align_left)
    table.cell(t, 2, 10, str.tostring(Name5),text_size=celltextsize, width=TableWidth,height=Tableheight,bgcolor=cellcol1,text_color=ctexcol,
     text_halign=text.align_left)
    table.cell(t, 3, 10, str.tostring(nif5),text_size=celltextsize, width=TableWidth,height=Tableheight,text_color=color.blue,
     text_halign=text.align_right)
    table.cell(t, 4, 10, str.tostring(cl5),text_size=celltextsize, width=TableWidth,text_color=cl5>cl5[1]? color.green:
     color.red,height=Tableheight,text_halign=text.align_right)
    table.cell(t, 5, 10, str.tostring(dif5),text_size=celltextsize, width=TableWidth,text_color=dif5>0 ? color.green:
      color.red,height=Tableheight,text_halign=text.align_right)
    table.cell(t, 6, 10, str.tostring(avgn5),text_size=celltextsize, width=TableWidth,text_color=avgn5>0 ? color.green:
     color.red,height=Tableheight,text_halign=text.align_right)
    table.cell(t, 7, 10, str.tostring(a205),text_size=celltextsize, width=TableWidth, text_color= color.blue,height=Tableheight)
    table.cell(t, 8, 10, str.tostring(a20d5),text_size=celltextsize, width=TableWidth,text_color=a20d5>0? color.green:color.red,
     height=Tableheight,text_halign=text.align_right)
    table.cell(t, 9, 10, str.tostring(a505),text_size=celltextsize, width=TableWidth,text_color=color.blue,height=Tableheight,
     text_halign=text.align_right)
    table.cell(t, 10, 10, str.tostring(a50d5),text_size=celltextsize, width=TableWidth,text_color=a50d5>0 ? color.green:color.red,
     height=Tableheight,text_halign=text.align_right)
    table.cell(t, 11, 10, str.tostring(a2005),text_size=celltextsize, width=TableWidth,text_color=color.blue,height=Tableheight,
     text_halign=text.align_right)
    table.cell(t, 12, 10, str.tostring(a200d5),text_size=celltextsize, width=TableWidth, text_color=a200d5>0 ?color.green:color.red,
     height=Tableheight,text_halign=text.align_right)
    table.cell(t, 13, 10, str.tostring(dx5),text_size=celltextsize, width=TableWidth, text_color=color.blue,height=Tableheight,
     text_halign=text.align_right)
    table.cell(t, 14, 10, str.tostring(r5),text_size=celltextsize, width=TableWidth, text_color=color.blue,
     height=Tableheight,text_halign=text.align_right)
    table.cell(t, 15, 10, str.tostring(c5),text_size=celltextsize, width=TableWidth, text_color=c5>0 ? color.green:color.red,
     height=Tableheight, text_halign=text.align_right)
    table.cell(t, 16, 10, str.tostring(atr5),text_size=celltextsize, width=TableWidth, text_color=color.blue,
     height=Tableheight,text_halign=text.align_right)
    table.cell(t, 17, 10, str.tostring(mom5),text_size=celltextsize, width=TableWidth, text_color=mom5>0 ? color.green:color.red,
     height=Tableheight, text_halign=text.align_right)
    table.cell(t, 18, 10, str.tostring(nvv5),text_size=celltextsize, width=TableWidth, text_color=nvv5>0 ? color.green:color.red,
     height=Tableheight,text_halign=text.align_right)
    table.cell(t, 19, 10, str.tostring(mf5),text_size=celltextsize, width=TableWidth, text_color=mf5>0 ? color.green:color.red,
     height=Tableheight,text_halign=text.align_right)
    table.cell(t, 20, 10, str.tostring(macd5),text_size=celltextsize, width=TableWidth, text_color=macd5>0 ? color.green:color.red,
     height=Tableheight,text_halign=text.align_right)
    table.cell(t, 21, 10, str.tostring(sig5),text_size=celltextsize, width=TableWidth, text_color=sig5>0 ? color.green:color.red,
     height=Tableheight,text_halign=text.align_right)
    
    table.cell(t, 1, 11, "A to Z",text_size=celltextsize, width=TableWidth,height=Tableheight,bgcolor=TBGcol,text_color=color.blue,
     text_halign=text.align_left)
    table.cell(t, 2, 11, str.tostring(Nameall),text_size=celltextsize, width=TableWidth,height=Tableheight,bgcolor=cellcol1,text_color=ctexcol,
     text_halign=text.align_left)
    table.cell(t, 3, 11, str.tostring(nif6),text_size=celltextsize, width=TableWidth,height=Tableheight,text_color=color.blue,
     text_halign=text.align_right)
    table.cell(t, 4, 11, str.tostring(cl6),text_size=celltextsize, width=TableWidth,text_color=cl6>cl6[1]? color.green:
     color.red,height=Tableheight,text_halign=text.align_right)
    table.cell(t, 5, 11, str.tostring(dif6),text_size=celltextsize, width=TableWidth,text_color=dif6>0 ? color.green:
      color.red,height=Tableheight,text_halign=text.align_right)
    table.cell(t, 6, 11, str.tostring(avgn6),text_size=celltextsize, width=TableWidth,text_color=avgn6>0 ? color.green:
     color.red,height=Tableheight,text_halign=text.align_right)
    table.cell(t, 7, 11, str.tostring(a206),text_size=celltextsize, width=TableWidth, text_color= color.blue,height=Tableheight)
    table.cell(t, 8, 11, str.tostring(a20d6),text_size=celltextsize, width=TableWidth,text_color=a20d6>0? color.green:color.red,
     height=Tableheight,text_halign=text.align_right)
    table.cell(t, 9, 11, str.tostring(a506),text_size=celltextsize, width=TableWidth,text_color=color.blue,height=Tableheight,
     text_halign=text.align_right)
    table.cell(t, 10, 11, str.tostring(a50d6),text_size=celltextsize, width=TableWidth,text_color=a50d6>0 ? color.green:color.red,
     height=Tableheight,text_halign=text.align_right)
    table.cell(t, 11, 11, str.tostring(a2006),text_size=celltextsize, width=TableWidth,text_color=color.blue,height=Tableheight,
     text_halign=text.align_right)
    table.cell(t, 12, 11, str.tostring(a200d6),text_size=celltextsize, width=TableWidth, text_color=a200d6>0 ?color.green:color.red,
     height=Tableheight,text_halign=text.align_right)
    table.cell(t, 13, 11, str.tostring(dx6),text_size=celltextsize, width=TableWidth, text_color=color.blue,height=Tableheight,
     text_halign=text.align_right)
    table.cell(t, 14, 11, str.tostring(r6),text_size=celltextsize, width=TableWidth, text_color=color.blue,
     height=Tableheight,text_halign=text.align_right)
    table.cell(t, 15, 11, str.tostring(c6),text_size=celltextsize, width=TableWidth, text_color=c6>0 ? color.green:color.red,
     height=Tableheight, text_halign=text.align_right)
    table.cell(t, 16, 11, str.tostring(atr6),text_size=celltextsize, width=TableWidth, text_color=color.blue,
     height=Tableheight,text_halign=text.align_right)
    table.cell(t, 17, 11, str.tostring(mom6),text_size=celltextsize, width=TableWidth, text_color=mom6>0 ? color.green:color.red,
     height=Tableheight, text_halign=text.align_right)
    table.cell(t, 18, 11, str.tostring(nvv6),text_size=celltextsize, width=TableWidth, text_color=nvv6>0 ? color.green:color.red,
     height=Tableheight,text_halign=text.align_right)
    table.cell(t, 19, 11, str.tostring(mf6),text_size=celltextsize, width=TableWidth, text_color=mf6>0 ? color.green:color.red,
     height=Tableheight,text_halign=text.align_right)
    table.cell(t, 20, 11, str.tostring(macd6),text_size=celltextsize, width=TableWidth, text_color=macd6>0 ? color.green:color.red,
     height=Tableheight,text_halign=text.align_right)
    table.cell(t, 21, 11, str.tostring(sig6),text_size=celltextsize, width=TableWidth, text_color=sig6>0 ? color.green:color.red,
     height=Tableheight,text_halign=text.align_right)
    
