NexusFi: Find Your Edge


Home Menu

 





Adding Indicator to Watchlist Column


Discussion in ThinkOrSwim

Updated
    1. trending_up 3,414 views
    2. thumb_up 0 thanks given
    3. group 2 followers
    1. forum 6 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
 Gaterz 
Las Vegas, Nevada
 
Experience: Intermediate
Platform: TOS, NinjaTrader
Trading: Stocks, Futuers, Options
Posts: 18 since Apr 2014
Thanks Given: 0
Thanks Received: 0

I have the following code that I'd like to add to have converted into a column in the watchlist. It's the RSI code with a grey color when in the "Chop Zone" Can someone with the knowledge be able to do that? I THINK it needs a lot of def code.

All I'm interested is for the column to say "CHOP" when the RSI is in the chop zone which is between 40 & 60 else the column will be black.

I was just looking at the Custom Quote Formula area where the code would be pasted. Concerning the time selection next to Column Name, are tick candle charts not available?

#
# TD Ameritrade IP Company, Inc. (c) 2007-2020
#

declare lower;

input length = 14;
input over_Bought = 70;
input over_Sold = 30;
input price = close;
input averageType = AverageType.WILDERS;
input showBreakoutSignals = no;

def NetChgAvg = MovingAverage(averageType, price - price[1], length);
def TotChgAvg = MovingAverage(averageType, AbsValue(price - price[1]), length);
def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;
plot chop1 = 60;
plot chop2 = 40;
def Between1 = Between(close, chop1, chop2);


plot RSI = 50 * (ChgRatio + 1);
plot OverSold = over_Sold;
plot OverBought = over_Bought;
plot midline = 50;
plot UpSignal = if RSI crosses above OverSold then OverSold else Double.NaN;
plot DownSignal = if RSI crosses below OverBought then OverBought else Double.NaN;

UpSignal.SetHiding(!showBreakoutSignals);
DownSignal.SetHiding(!showBreakoutSignals);

RSI.DefineColor("OverBought", GetColor(5));
RSI.DefineColor("Normal", GetColor(7));
RSI.DefineColor("OverSold", GetColor(1));
RSI.DefineColor("Between1", GetColor(3));
RSI.AssignValueColor(if RSI > over_Bought then RSI.color("OverBought") else if RSI < over_Sold then RSI.color("OverSold") else if RSI > chop2 and RSI < chop1 then RSI.color("Between1") else RSI.color("Normal"));
OverSold.SetDefaultColor(GetColor(8));
OverBought.SetDefaultColor(GetColor(8));
UpSignal.SetDefaultColor(Color.UPTICK);
UpSignal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
DownSignal.SetDefaultColor(Color.DOWNTICK);
DownSignal.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);


Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Strike Pause Holds, Oil Erases Monday Spike -- May CPI W …
Traders Hideout
Election Sunday Resolves: Peru Heads to Runoff at 42pct, …
Prediction Markets & Event Contracts
CME Cuts Precious Metals Margins Up to 21% Starting Toda …
Commodities
Post-Summit Market Verdict: ES -1%, NQ -1.5%, 10-Year Yi …
Traders Hideout
Rubios Good News Within Hours and the 30-Day Math: Why H …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Big Mike in Ecuador
205 thanks
Sober Journey With S&P
21 thanks
30 Sessions
20 thanks
Volume Indicators
8 thanks
Thanks Mike. Godspeed.
7 thanks
  #2 (permalink)
 Gaterz 
Las Vegas, Nevada
 
Experience: Intermediate
Platform: TOS, NinjaTrader
Trading: Stocks, Futuers, Options
Posts: 18 since Apr 2014
Thanks Given: 0
Thanks Received: 0

This is what I have right now but it the color is black when the RSI is clearly in the "Chop Zone" between 60 & 40

I'm sure it's something I've done wrong

def length = 14;
def price = close;
def averageType = AverageType.WILDERS;

def NetChgAvg = MovingAverage(averageType, price - price[1], length);
def TotChgAvg = MovingAverage(averageType, AbsValue(price - price[1]), length);
def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;
def chop1 = 60;
def chop2 = 40;
def Between1 = Between(close, chop1, chop2);

def RSI = 50 * (ChgRatio + 1);

AddLabel(Between1, "CHOP",color.black);
AddLabel(!Between1, " ", color.black);
AssignBackgroundColor(if Between1 then color.GRAY else color.black);


Started this thread Reply With Quote
  #3 (permalink)
 Gaterz 
Las Vegas, Nevada
 
Experience: Intermediate
Platform: TOS, NinjaTrader
Trading: Stocks, Futuers, Options
Posts: 18 since Apr 2014
Thanks Given: 0
Thanks Received: 0


Second try...Nope

def length = 14;
def price = close;
def averageType = AverageType.WILDERS;


def NetChgAvg = MovingAverage(averageType, price - price[1], length);
def TotChgAvg = MovingAverage(averageType, AbsValue(price - price[1]), length);
def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;
def chop1 = 60;
def chop2 = 40;
def Between1 = Between(close, chop1, chop2);

def RSI = 50 * (ChgRatio + 1);

AddLabel(Between1, "CHOP",color.black);
AddLabel(!Between1, " ", color.black);
AssignBackgroundColor(if Between1 then color.GRAY else color.black);


Started this thread Reply With Quote
  #4 (permalink)
 Gaterz 
Las Vegas, Nevada
 
Experience: Intermediate
Platform: TOS, NinjaTrader
Trading: Stocks, Futuers, Options
Posts: 18 since Apr 2014
Thanks Given: 0
Thanks Received: 0

No one knows?


Started this thread Reply With Quote
  #5 (permalink)
 JayC 
San Diego, CA
 
Experience: Beginner
Platform: TOS, Sierra
Trading: Emini ES, Crude CL
Posts: 55 since Mar 2019
Thanks Given: 9
Thanks Received: 43

I think you want to check if the RSI value is between 40 and 60. Currently, you're passing in the close price, which is part of the issue. Besides that, for some reason the between function doesn't seem to work as expected, so I redefined the check using a simple greater than less than expression, which achieves the same result.

Hope this helps,
Jay


 
Code
def length = 14;
def price = close;
def averageType = AverageType.WILDERS;


def NetChgAvg = MovingAverage(averageType, price - price[1], length);
def TotChgAvg = MovingAverage(averageType, AbsValue(price - price[1]), length);
def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;
def chop1 = 60;
def chop2 = 40;


def RSI = 50 * (ChgRatio + 1);
def between1 = RSI <= chop1 and RSI >= chop2;

AddLabel(1, if between1  then "CHOP" else " ", color.black);
AssignBackgroundColor(if between1 then color.GRAY else color.black);


Reply With Quote
  #6 (permalink)
 JayC 
San Diego, CA
 
Experience: Beginner
Platform: TOS, Sierra
Trading: Emini ES, Crude CL
Posts: 55 since Mar 2019
Thanks Given: 9
Thanks Received: 43

I figured out why between wasn't working. The high/low chop values needed to be reversed, low then high range. Also, you can just call the RSI function since you're using the exact same calculation. So the latest version...

Jay

 
Code
input length = 14;
input price = close;
input averageType = AverageType.WILDERS;

def chop1 = 40;
def chop2 = 60;

def signal = RSI(length=length, price=price, averageType=averageType).RSI;
def choppy = Between(signal, chop1, chop2);

AddLabel(1, if choppy  then "CHOP" else " ", color.black);
AssignBackgroundColor(if choppy then color.GRAY else color.black);


Reply With Quote
  #7 (permalink)
 Gaterz 
Las Vegas, Nevada
 
Experience: Intermediate
Platform: TOS, NinjaTrader
Trading: Stocks, Futuers, Options
Posts: 18 since Apr 2014
Thanks Given: 0
Thanks Received: 0

Thank you so much


Started this thread Reply With Quote




Last Updated on October 11, 2020


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts