Follow Line Indicator For ThinkOrSwim

I've updated the script to have an additional labels.

https://tos.mx/nfYzKba

jpbP2sV.png
 
I have tried all of the versions of the Follow Line Indicator found in this thread to make a scan for the change from red to blue giving the signal. I have tried all the components available to scan for. I have also tried everything like" is equal to" or " is true ", etc to no avail. I have also tried things like "equal to 1", still no luck. My guess is that I need another snippet of code to add to the actual indicator, giving a component that is scannable to return stocks giving a signal. My timeframe I want to use is 15min, and I would like to have it show over the last 5 bars. Any help is appreciated. Thanks

https://usethinkscript.com/threads/...-can-make-at-each-of-the-m-a.10155/post-90726

How about something like this? It even has a watch list setup.
 
At its core, this indicator is using a ratcheting trailstop that ratchets when price pokes a 1 standard deviation bollinger band. By default, the trailstop ratches to a 5 period 1 ATR distance away from price. To make it more responsive, disabling the ATR filter makes a big difference because it rachets the line to the high/low instead of also buffering in ATR.

The second important setting I've found to speed it up is reduce the bb standard deviations to 0.1 so that the line ratches more often.

To do the second change you'll need to modify the input bbdeviations line to support values between 0 and 1 like this:

Code:
input bbdeviations = 1.0;

hope that helps!
If I am creating a label for buy and sell on 5min chart, which one would be correct or both works?

AddLabel(1, if close>BBUpper then "Buy" else "Sell", if close>BBUpper then color.green else color.red);
or
AddLabel(1, if trendline > trendline[1] then "Buy" else "Sell", if trendline > trendline[1] then color.green else color.red);

It seems like there is some delay, the bubble would show up first and the label does not or vice versa.
 
Last edited:
I put all 3 indicators from the video(above) into 1 study but Im having a problem with an arrow indicator when Hull, Follow Line and QQE are in sync (all up/green) like in the video.

If I use this for only 1st occurrence plot Green = condGREEN and !condGREEN[1]; the script paints sporadically or doesn’t paint where there should be an arrow
If I use this plot Green = condGREEN; then arrows go off all over!
It's very odd bc you can look at a chart and see that criteria is met and yet the arrows wont paint, but will in other spots when the same criteria is met?


Suggestions so this paints accurately?
48r5UTk.png



QQE_mod(lower study)
 
@SleepyZ can you help me out with this?


I put all 3 indicators from the video(above) into 1 study but Im having a problem with an arrow indicator when Hull, Follow Line and QQE are in sync (all up/green) like in the video.

If I use this for only 1st occurrence plot Green = condGREEN and !condGREEN[1]; the script paints sporadically or doesn’t paint where there should be an arrow
If I use this plot Green = condGREEN; then arrows go off all over!
It's very odd bc you can look at a chart and see that criteria is met and yet the arrows wont paint, but will in other spots when the same criteria is met?


Suggestions so this paints accurately?
48r5UTk.png



QQE_mod(lower study)
 
@SleepyZ can you help me out with this?
Try replacing the lines under the #FOLLOW LABEL with the below.

Code:
#FOLLOW LABEL
def condFol= close > tline;
def condCross = iTrend > 0;
def condFollow = condFol and condCross;
addlabel(condFollow,” ”,CreateColor(33,150,243));
 
Try replacing the lines under the #FOLLOW LABEL with the below.

Code:
#FOLLOW LABEL
def condFol= close > tline;
def condCross = iTrend > 0;
def condFollow = condFol and condCross;
addlabel(condFollow,” ”,CreateColor(33,150,243));


Ohhh duh! Never thought to take those extra conditions off
 
Hey folks. I was curious about this indicator as well and in review.. the line appears to be a cross of the 8/21 EMA. While it's clean in some instances, in others it is not. I think qqe mod plays the bigger part and HULL functions as long term trend.

Best.
 
Hey folks. I was curious about this indicator as well and in review.. the line appears to be a cross of the 8/21 EMA. While it's clean in some instances, in others it is not. I think qqe mod plays the bigger part and HULL functions as long term trend.

Best.
The line is an atr based trail stop that ratchets when the 21 period Bollinger band gets poked. No emas.
 
Great Info. I've got these indicators in TOS now and also the Follow Line Indicator. Thanks to you guys. I'm using it to scalp E-mini S&P Futures. (I would put a screen shot but I am new to forum and haven't figured out how to do that yet) I want to use these indicators on a 5 minute candlestick chart but can't get the settings right. It lines up on a 15 minute chart but not on the 5. Anyone got this setup on a 5 minute chart yet?
 
Great Info. I've got these indicators in TOS now and also the Follow Line Indicator. Thanks to you guys. I'm using it to scalp E-mini S&P Futures. (I would put a screen shot but I am new to forum and haven't figured out how to do that yet) I want to use these indicators on a 5 minute candlestick chart but can't get the settings right. It lines up on a 15 minute chart but not on the 5. Anyone got this setup on a 5 minute chart yet?
http://tos.mx/N05l77W
These are all the indicators you mention on a 5 minute chart. It seems to work well enough-if not can you please be specfic?
 
http://tos.mx/N05l77W
These are all the indicators you mention on a 5 minute chart. It seems to work well enough-if not can you please be specfic?
Thank you for sharing.
Did you know that the exclamation point in the upper left corner of your chart means you have an error?
In your chart setup. Both of your upper chart indicators are attempting to paint the candles with the AssignPriceColor() function (located at the bottom of the scripts).
You can only have one candle painting indicator per chart.
set candleCol to NO in the Hull settings if you don't want the Hull coloring the bars
OR
set PaintBars to
NO in the FollowTheLine settings if you would rather not have it color the candles.
2gUhlZB.png

@4more
 
Last edited:
Thank you for sharing.
Did you know that the exclamation point in the upper left corner of your chart means you have an error?
In your chart setup. Both of your upper chart indicators are attempting to paint the candles.
You can only have one candle painting indicator per chart.
The fly in the ointment...I was not aware of that. Thanks for the heads up. Not being a programmer myself, I will have to see if I can locate this in the script. I am guessing that I will have to choose one or the other to paint the candles and that it makes no difference which one.

http://tos.mx/N05l77W
These are all the indicators you mention on a 5 minute chart. It seems to work well enough-if not can you please be specfic?
Thanks. I will be working this later this evening. Will let you know.
 
Last edited by a moderator:
I want to try the strategy in this video. I found script for 2 of the 3 indicators, does anyone have this "Follow Line Indicator" tradingview script converted for TOS?


Code:
// © Dreadblitz
//@version=4
study(shorttitle="FLI", title="Follow Line Indicator", overlay=true)
//
BBperiod = input(defval = 21, title = "BB Period", type = input.integer, minval = 1)
BBdeviations = input(defval = 1.00, title = "BB Deviations", type = input.float, minval = 0.1, step=0.05)
UseATRfilter = input(defval = true, title = "ATR Filter", type = input.bool)
ATRperiod = input(defval = 5, title = "ATR Period", type = input.integer, minval = 1)
hl = input(defval = false, title = "Hide Labels", type = input.bool)
//
BBUpper=sma (close,BBperiod)+stdev(close, BBperiod)*BBdeviations
BBLower=sma (close,BBperiod)-stdev(close, BBperiod)*BBdeviations
//
TrendLine = 0.0
iTrend = 0.0
buy = 0.0
sell = 0.0
//
BBSignal = close>BBUpper? 1 : close<BBLower? -1 : 0
//
if BBSignal == 1 and UseATRfilter == 1
TrendLine:=low-atr(ATRperiod)
if TrendLine<TrendLine[1]
TrendLine:=TrendLine[1]
if BBSignal == -1 and UseATRfilter == 1
TrendLine:=high+atr(ATRperiod)
if TrendLine>TrendLine[1]
TrendLine:=TrendLine[1]
if BBSignal == 0 and UseATRfilter == 1
TrendLine:=TrendLine[1]
//
if BBSignal == 1 and UseATRfilter == 0
TrendLine:=low
if TrendLine<TrendLine[1]
TrendLine:=TrendLine[1]
if BBSignal == -1 and UseATRfilter == 0
TrendLine:=high
if TrendLine>TrendLine[1]
TrendLine:=TrendLine[1]
if BBSignal == 0 and UseATRfilter == 0
TrendLine:=TrendLine[1]
//
iTrend:=iTrend[1]
if TrendLine>TrendLine[1]
iTrend:=1
if TrendLine<TrendLine[1]
iTrend:=-1
//
buy:=iTrend[1]==-1 and iTrend==1 ? 1 : na
sell:=iTrend[1]==1 and iTrend==-1? 1 : na
//
plot(TrendLine, color=iTrend > 0?color.blue:color.red ,style=plot.style_line,linewidth=2,transp=0,title="Trend Line")
plotshape(buy == 1 and hl == false? TrendLine-atr(8) :na, text='💣', style= shape.labelup, location=location.absolute, color=color.blue, textcolor=color.white, offset=0, transp=0,size=size.auto)
plotshape(sell == 1 and hl == false ?TrendLine+atr(8):na, text='🔨', style=shape.labeldown, location=location.absolute, color=color.red, textcolor=color.white, offset=0, transp=0,size=size.auto)
//
alertcondition(sell == 1 ,title="Sell",message="Sell")
alertcondition(buy == 1 ,title="Buy",message="Buy")
alertcondition(buy == 1 or sell == 1 ,title="Buy/Sell",message="Buy/Sell")
Greetings jp782. The tradingview indicator setup that you are talking about is the most accurate setup I have ever found. I have back tested it and was really pleased with how accurately it lines up with the thinkorswim platforms "history". I have tried everything posted to match this tradingview setup with thinkorswim but just can't get the accuracy on thinkorswim. The problem with using tradingview along with thinkorswim is that tradingview has a 10 minute lag time on futures, which makes using the two together useless. I use the 2 day, 5 min chart to scalp /ES. Just can't figure out how to get the tradingview version to work as accurately on thinkorswim. It just doesn't line up the same. If you've found a way I would really appreciate if you would share the settings. I've been working this for 6 weeks to share but I can't seem to get any closer than anybody else's results here. The closest I have come is on a 15 min chart but I really want a 5 min.
 
Thank you for sharing.
Did you know that the exclamation point in the upper left corner of your chart means you have an error?
In your chart setup. Both of your upper chart indicators are attempting to paint the candles with the AssignPriceColor() function (located at the bottom of the scripts).
You can only have one candle painting indicator per chart.
set candleCol to NO in the Hull settings if you don't want the Hull coloring the bars
OR
set PaintBars to
NO in the FollowTheLine settings if you would rather not have it color the candles.
2gUhlZB.png

@4more
You are correct, thank you for pointing that out. I flip between the two sometimes to color the candles so that caused the goof.
 
I came across a study that I thought was cool but I felt like it could use small improvement tweaks such as displaying the buy & sell prices for a swing trade.

It seems like the 3 day - 15 minute chart - minus extended hours seems to be the best intraday settings.
Code:
# Follow Line Indicator
# Coverted to ToS from TV by bigboss. Original © Dreadblitz
#https://usethinkscript.com/threads/follow-line-indicator.9789/

input BbPeriod      = 9;
input BbDeviations  = 1;
input UseAtrFilter  = yes;
input AtrPeriod     = 5;
input HideArrows    = no;

def BBUpper=SimpleMovingAvg(close,BBperiod)+stdev(close, BBperiod)*BBdeviations;
def BBLower=SimpleMovingAvg(close,BBperiod)-stdev(close, BBperiod)*BBdeviations;

def BBSignal = if close>BBUpper then 1 else if close<BBLower then -1 else 0;

def TrendLine =
    if BBSignal == 1 and UseATRfilter == 1 then
        max(low-atr(ATRperiod),TrendLine[1])
    else if BBSignal == -1 and UseATRfilter == 1 then
        min(high+atr(ATRperiod),TrendLine[1])
    else if BBSignal == 0 and UseATRfilter == 1 then
        TrendLine[1]
    else if BBSignal == 1 and UseATRfilter == 0 then
        max(low,TrendLine[1])
    else if BBSignal == -1 and UseATRfilter == 0 then
        min(high,TrendLine[1])
    else if BBSignal == 0 and UseATRfilter == 0 then
        TrendLine[1]
    else TrendLine[1];

def iTrend = if TrendLine>TrendLine[1] then 1 else if TrendLine < TrendLine[1] then -1 else iTrend[1];
 
plot buy_price = if iTrend[1]==-1 and iTrend==1 and !HideArrows then TrendLine else Double.NaN;
buy_price.SetPaintingStrategy(PaintingStrategy.VALUES_ABOVE);
buy_price.SetDefaultColor(Color.GREEN);
buy_price.SetLineWeight(3);

plot sell_price = if iTrend[1]==1 and iTrend==-1 and !HideArrows then  TrendLine else Double.NaN;
sell_price.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW);
sell_price.SetDefaultColor(Color.white);
sell_price.SetLineWeight(3);

plot buy_arrow = if iTrend[1]==-1 and iTrend==1 and !HideArrows then TrendLine else Double.NaN;
buy_arrow.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
buy_arrow.SetDefaultColor(Color.GREEN);
buy_arrow.SetLineWeight(3);

plot sell_arrow = if iTrend[1]==1 and iTrend==-1 and !HideArrows then  TrendLine else Double.NaN;
sell_arrow.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
sell_arrow.SetDefaultColor(Color.RED);
sell_arrow.SetLineWeight(3);


plot tline = TrendLine;
tline.AssignValueColor(if iTrend > 0 then CreateColor(33,150,243) else CreateColor(255,82,82));
tline.SetPaintingStrategy(PaintingStrategy.DASHES);
tline.SetLineWeight(2);

https://tos.mx/NIJ9woa - this is my version.

Source for the original study. -
Hi can you tell me if any additional settings were made once the script was implemented? my results are curious
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
415 Online
Create Post

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top