Here are 2 similar but different scripts: Be forwarned, DO NOT Change the Chart Type from CANDLE! I had to re-load ThinkorSwim.
Code:
# Add chart as lower study. Strongly suggest your TOS is backed up & suggest DO NOT change CHART TYPE
# This is "deprecated", unsupported in ThinkScript, there is no documentation.
# Usage example: You may have oil company, CVX, ploted in the upper. And you want to see its price vs oil futures.
# The code below allows you to show the oil futures (/CL) below for comparison.
# There has been talk of potential to put simple study eg MAs in here as well. I don't know anyone that has done it.
# Found in JQs OneNote 2018
# Hacked together by Markos 6-27-19. Parts taken from a few studies. PLEASE READ NOTES#
declare lower;
input symbol = "SPX"; #Hint add any of these "SPX", "COMP", "DJX", "SOX", "NDX", "OEX", "QQQ", "IWM", "TNX", "/ES", "/CL" ect.
input cType = ChartType.CANDLE; #Hint: Change chart type at our own risk!
DefineGlobalColor( "uptick", Color.UPTICK );
DefineGlobalColor( "downtick", Color.DOWNTICK );
DefineGlobalColor( "neutral", Color.PLUM );
AddChart( high = high( symbol ),
low = low( symbol ),
open = open( symbol ),
close = close( symbol ),
type = cType,
growColor = GlobalColor( "uptick" ),
fallColor = GlobalColor( "downtick" ),
neutralColor = GlobalColor( "neutral" )
);
AddLabel(1, if Security == Security."SPX" then "SPX = S&P 500 INDEX is showing"
else if Security == Security."COMP" then " COMP = NASDAQ COMPOSITE is showing "
else if Security == Security."DJX" then " DJX = DOW JONES INDUSTRIAL AVERAGE INDEX is showing"
else if Security == Security."SOX" then "SOX = PHLX SEMI CONDUCTOR INDEX is showing"
else if Security == Security."NDX" then " NDX = NASDAQ 100 INDEX INDEX is showing"
else if Security == Security."OEX" then "OEX = S & P 100 INDEX is showing"
else if Security == Security."IWM" then " IWM = Russel 2000 Index is showing "
else if Security == Security."QQQ" then "QQQ = POWERSHARES QQQ is showing"
else if Security == Security."TNX" then " TNX = 10-YR TREASURY INDEX is showing"
else if Security == Security."/CL" then "/CL = Light Sweet Crude Oil Futures is showing"
else if Security == Security."/ES" then "/ES = E-mini S&P 500 Index Futures is showing"
else "ERROR – none were found", Color.WHITE);
# EOC #
--------------------------------------------------------------------
##2nd way of putting a chart in Lower pane ##
#ADD AN INDEX OR FUTURE LOWER CHART
#from StanL Archives, White Candles Used
#The AddChart function is unsupported in TOS, Hence there is no documentation to support its use and color formatting.
#Also, not all chart types are supported.
#Usage example: You may have a stock plotted on the upper panel:Say an oil company, CVX. You may want to see how its price varies with the oil futures.
#The code below allows you to show the oil futures (/CL) below for comparison. declare lower;
input chartType = ChartType.CANDLE; #Hint: Do Not Change without Backing up your Desktop!
input Security = {default "SPX", "COMP", "DJX", "SOX", "NDX", "OEX", "QQQ", "IWM", "VIX", "TNX", "/ES", "/CL"};
AddChart( high = high( Security ), low = low( Security ),
open = open( Security ), close = close( Security ), type = chartType );
AddLabel(1, if Security == Security."SPX" then "SPX = S&P 500 INDEX is showing"
else if Security == Security."COMP" then " COMP = NASDAQ COMPOSITE is showing "
else if Security == Security."DJX" then " DJX = DOW JONES INDUSTRIAL AVERAGE INDEX is showing"
else if Security == Security."SOX" then "SOX = PHLX SEMI CONDUCTOR INDEX is showing"
else if Security == Security."NDX" then " NDX = NASDAQ 100 INDEX INDEX is showing"
else if Security == Security."OEX" then "OEX = S & P 100 INDEX is showing"
else if Security == Security."IWM" then " IWM = Russel 2000 Index is showing "
else if Security == Security."QQQ" then "QQQ = POWERSHARES QQQ is showing"
else if Security == Security."VIX" then "VIX = CBOE MARKET VOLATILITY INDEX is showing"
else if Security == Security."TNX" then " TNX = 10-YR TREASURY INDEX is showing"
else if Security == Security."/CL" then "/CL = Light Sweet Crude Oil Futures is showing"
else if Security == Security."/ES" then "/ES = E-mini S&P 500 Index Futures is showing"
else "ERROR – none were found", Color.WHITE);
#end