SPX NDX Index Price Indicator for ThinkorSwim

jngy2k

Member
VIP
Something that looks like this yellow line in Tradingview.

fudY3TP.png


There's RelativeStrength and Correlation indicators prebuilt into TOS that gives a comparison of what the stock is doing versus the index. However I want to simplify it to ONLY plot a simple line of the price action of the index. No comparison no correlation just a simple chart price of the index as a line and as a indicator. It will essentially be a line chart of the index on the bottom of the stock price chart. I know i can adjust the screen in Flexible Grid to have the index on the bottom and stock chart on the top but I want it as an indicator declare_lower so it doesn't take up as much screen space.

The purpose is to actually easily compare relative strength of the stock to the market instead of having a indicator calculate this stock is below or above the performance of the market on a zero scale. If the stock price is up but the market line is downwards as seen in the photo, then that is huge relative strength.

IS there such a tool? I believe the code GetSymbol() can be used to make the indicator.

Nevermind figured it out.

Code:
declare lower;

input price = FundamentalType.CLOSE;
input relationWithSecurity = "SPX";

def price2 = fundamental(price, relationWithSecurity);

plot Relation = price2;
Relation.SetDefaultColor(GetColor(1));
 
Last edited:

Similar threads

Top