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

TTM LRC Indicator for ThinkorSwim


New member
Hello Experts - I am dropping two TTM_LRC into the charts - with longer LENGTH and one with SHORTER LENGTH... I want to create a scanner to see when the price are at the extreme areas. Scan this condition for stocks. See marked - Essentially price at top of each band. Help will be great thanks


# TD Ameritrade IP Company, Inc. (c) 2010-2020
# Source code isn't available.

input price = CLOSE;
input length = 38;
input beginDate = 0;
input beginTime = 0;
input numDevDn1 = -1.0;
input numDevDn2 = -2.0;
input numDevUp1 = 1.0;
input numDevUp2 = 2.0;
input extLeft = No;
input extRight = Yes;

plot LR = Double.NaN;
plot UB1 = Double.NaN;
plot LB1 = Double.NaN;
plot UB2 = Double.NaN;
plot LB2 = Double.NaN;
Last edited by a moderator:


Well-known member
2019 Donor
Hi @ssara, it's an interesting idea.

Can you provide the next level of detail? TTM_PRC is a protected study source code is not available within the TOS, can you provide an example of inputs you're using on both, and the condition you want to trigger a signal?


Well-known member
Just use regular LRC or Std Dev Channels or Std Error Channels. All the same plots if using the same inputs. Thought I put this on here a long time ago. But my memory may be bad. At any rate use any one of them, all the same.

# LRC Variable Scan
input price = hl2;
input n = 252;
input widthOfChannel = 69;

def MidLine = InertiaAll(price, n);
def dist = HighestAll(AbsValue(MidLine - price)) * (widthOfChannel / 100.0);

# Scan only allows one plot. Set plot to Upper or Lower and def to the other
def "Upper Band Cross"  = close crosses MidLine + dist;
plot "Lower Band Cross" = close crosses MidLine - dist;


New member

I am trying to script a watchlist column in ToS that shows the % difference between the Last (or Close, or Mark) and the 2nd lower standard deviation value (num dev 2 in TTM_LRC). Basically, looking to identify tickers that are close to touch the 2nd lower SD on a given time frame.

Thanks in advance!

Similar threads