LBR Indicator Label, Watchlist, Scan For ThinkOrSwim

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

@MBF In the above study you posted, you are missing some statements from the original LBR study, probably from cut and paste? In particular you are missing out the switch statement amongst others. Do have a look at the original LBR study for clues

Code:
switch (calculationMode) {
case Normal:
    FastLine = Average(price, 3) - Average(price, 10);
case Alternate:
    FastLine = Average(price - Average(price[3], 3), 2);
}
 
Hi @tomsk
Yeah I don't know anything about coding. I have managed some codes on my own but with little else to do to them but a tweak here or there. I took out input and put in define instead but it came out red. I mashed the two into one and changed those but thats it. It's for a class.
 
Hi @tomsk
Yeah I don't know anything about coding. I have managed some codes on my own but with little else to do to them but a tweak here or there. I took out input and put in define instead but it came out red. I mashed the two into one and changed those but thats it. It's for a class.


@MBF Happy to help with your "coding" journey, the TOS editor is never wrong as it parses through the code that users enter. I have learnt to spot coding inconsistencies by first formatting complicated looking code to a "standard" format that makes it easy to read. Additionally I do all my code development directly in Notepad and once complete I then copy and paste from my NotePad directly to the editor. I still have the occasional error but thank goodness it is perhaps around 2-3% of the time! Have fun out there!
 
@MBF Happy to help with your "coding" journey, the TOS editor is never wrong as it parses through the code that users enter. I have learnt to spot coding inconsistencies by first formatting complicated looking code to a "standard" format that makes it easy to read. Additionally I do all my code development directly in Notepad and once complete I then copy and paste from my NotePad directly to the editor. I still have the occasional error but thank goodness it is perhaps around 2-3% of the time! Have fun out there!
LOL not a coding class, a trading workshop. My brain would pop. I do understand what you're saying. Before this room I would look at other codes that were similar to what Id want and try that. It worked maybe %20 of the time.
I mean I am going to TRY to put together the easiest one, hopefully before class starts again tonight. The 1SMA 5SMA Osc. They work on Tradestation, which I cannot get right now so I can't use their tools. I was trying to convert theirs into TOS so I could keep up and play along.:sneaky:
 
@MBF Please post the tradestation codes here in a separate thread. Someone will be able to port the code. :)
 
@MBF Please post the tradestation codes here in a separate thread. Someone will be able to port the code. :)
Well hi you! Thought you fell into a hole.
Let me see if I can do that because THAT would be pretty dang helpful. Just didnt think anyone has TS on here. I did do some work on them and got pretty close but a nice confirmation would be great.
 
Hi all. I've been in a workshop for 3 weeks with two more to go.
I don't really want to get Tradestation, but some of the indis that are in there I would like for TOS.
One is a 3/10 Divergence dots. The dots are placed above the 3/10 indi where divergences are found, either way.

The second is the 3/10/ROC2. They are called PF3 dots, also placed on the indicator. The dots easily tell you that ; the ROC2 is pointing down, the 3/10 Slow line is pointing down and the 3/10 fast line is pointing down for bull plays and vice versa for Bear plays, all are pointing up.

Can anyone please help me out with this? 🙏
 
tomsk wrote this indicator for me and I would love to have it as a watchlist. Can someone help me? Also, for later reference, what is a specific thing in an indicator that must be changed IF you can turn it into a watchlist? I've searched on TOS but maybe I am asking the question there incorrectly.

Code:
# LBR Three Ten Signal Arrows
# tomsk
# 12.11.2019

# Displays signals when the FastLine crosses the SlowLine.
# Configure your preferences to display CrossUp/CrossDn signals

input showCrossUp = yes;
input showCrossDn = no;
input price = close;
input calculationMode = {default "high_low", Alternate};

def FastLine;
switch (calculationMode) {
case high_low:
    FastLine = Average(price, 2) - Average(price, 9);
case Alternate:
    FastLine = Average(price - Average(price[3], 3), 2);
}
def SlowLine = Average(FastLine, 16);

plot crossUp = if showCrossUp and FastLine crosses above SlowLine then 0.995 * close else Double.NaN;
crossUp.SetpaintingStrategy(PaintingStrategy.ARROW_UP);
crossUp.SetDefaultColor(Color.YELLOW);
crossUp.SetLineWeight(4);

#plot crossDn = if showCrossDn and FastLine crosses below SlowLine then 1.005 * close else Double.NaN;
#crossDn.SetpaintingStrategy(PaintingStrategy.ARROW_DOWN);
#crossDn.SetDefaultColor(Color.CYAN);
#crossDn.SetLineWeight(4);
# End LBR Three Ten Signal Arrows
 
Ben, could you help me out with this watchlist column. Im trying to get a green color for a cross up and a red for a cross down. I have tried but now I am frustrated. 🙏
 
@MBF Here you go:

Red background = cross down, green background = cross up. No background = no signal.

Ignore the number 1. It's just there as a static plot.

Code:
# LBR Three Ten Signal Arrows
# tomsk
# 12.11.2019

# Displays signals when the FastLine crosses the SlowLine.
# Configure your preferences to display CrossUp/CrossDn signals

input showCrossUp = yes;
input showCrossDn = no;
input price = close;
input calculationMode = {default "high_low", Alternate};

def FastLine;
switch (calculationMode) {
case high_low:
    FastLine = Average(price, 2) - Average(price, 9);
case Alternate:
    FastLine = Average(price - Average(price[3], 3), 2);
}
def SlowLine = Average(FastLine, 16);

def crossUp = if showCrossUp and FastLine crosses above SlowLine then 0.995 * close else Double.NaN;
def crossDn = if showCrossDn and FastLine crosses below SlowLine then 1.005 * close else Double.NaN;

AssignBackgroundColor(if crossUp then color.dark_green else if crossDn then color.dark_red else color.gray);

plot static = 1;
 
@BenTen Hi Ben, I've been fooling with this watchlist script I have. I am trying to have a green light up when the LBR3/10 Histogram crosses above the LBR3/10 fast line. I wrote this out but it is not working correctly. If you could lend me a hand with this I would appreciate it. Again. All the main stuff in it is there but the calculation is off. Also if there is anything very incorrect could you tell me what it is so I can learn? Thanks Ben! No rush, when you have some free time.

Code:
input price = close;
input calculationMode = {default high_low, "Alternate"};
def fastLine;
switch (calculationMode) {
case high_low:
fastLine = Average(price, 3) - Average(price, 10);
case Alternate:
fastLine = Average(price - Average(price[3], 3), 2);
}
def slowLine = Average(fastLine, 16);
#def crossAbove = fastLine[1] < slowLine[1] and fastLine #> slowLine;
#def crossBelow = fastLine[1] > slowLine[1] and fastLine #< slowLine;
Def hist = fastline - slowline;
Def crossAbove = hist[1] < fastLine[1] and hist > fastLine;
Def crossBelow= hist [1] > fastLine[1] and hist < fastLine;

plot data = if crossAbove then 1 else if crossBelow then -1 else 0;
data.AssignValueColor(if data <> 0 then Color.BLACK else Color.CURRENT);
AssignBackgroundColor(if data > 0 then Color.GREEN else if data < 0 then Color.RED else Color.CURRENT);
 
@MBF There is definitely something wrong with the calculation. What are you trying to accomplish with this column?
 
  • Like
Reactions: MBF

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
232 Online
Create Post

Similar threads

Similar threads

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