• LIMITED TIME OFFER: use coupon code PRIMEDAY (case sensitive) at checkout to save $50 off VIP membership (down to $149 / year). Valid through Tuesday 6/22. Biggest discount this year!

How to plot asset price on second/left vertical axis?


New member
I want to compare a small cap stock to the SPX and since the SPX has a much bigger price, the plot looks unusable. Is there any way to plot the SPX on the left axis and the small cap on the right axis?


Active member
def NA = Double.NaN;
input symbol = "SPX";
DefineGlobalColor("Bullish", CreateColor(0,100,200));
DefineGlobalColor("Bearish", Color.DARK_ORANGE);
def h = high(symbol);
def l = low(symbol);
def o = open(symbol);
def c = close(symbol);
def bb = Max(o,c)==c;

AddChart(h,l,if bb then o else NA,c,ChartType.CANDLE, GlobalColor("Bullish"));
AddChart(h,l,if !bb then o else NA,c,ChartType.CANDLE, GlobalColor("Bearish"));

AddLabel(1,symbol + " " + c, if c > c[1] then GlobalColor("Bullish") else GlobalColor("Bearish"));
make sure you have left axis enabled in chart settings, and check left axis in the indicator settings.

Similar threads