Counter to add up certain indicators

PT_Scalper

Member
VIP
Hi all,

Let me see if I can explain this the right way;

I'm looking to see if anyone has ever seen or created a label that can be use on a chart or WL column that will help add up all the desired buy signals.

For example;

If RSI is above 50 then "1" otherwise "0"
If MACD is above zero line and signal line crosses avg line "1" otherwise "0"
If TTM Squeeze is positive then "1" otherwise "0"
If "X' MA (could be MA of choice) is above "Y" MA (Could be MA of choice) then "1" otherwise "0"
and possibly a few more criteria's...

I could even put more weight on say the RSI and say if it's above 50 then "2" otherwise "0"

Next I have a counter that will add up the total and say it shows "5" or "4", etc... as a label and on the WL column it can be used to sort, and as certain criteria's are met, the counter will increase to a higher number representing my desired buy indicators.

Thanks in advance.
 
Hi all,

Let me see if I can explain this the right way;

I'm looking to see if anyone has ever seen or created a label that can be use on a chart or WL column that will help add up all the desired buy signals.

For example;

If RSI is above 50 then "1" otherwise "0"
If MACD is above zero line and signal line crosses avg line "1" otherwise "0"
If TTM Squeeze is positive then "1" otherwise "0"
If "X' MA (could be MA of choice) is above "Y" MA (Could be MA of choice) then "1" otherwise "0"
and possibly a few more criteria's...

I could even put more weight on say the RSI and say if it's above 50 then "2" otherwise "0"

Next I have a counter that will add up the total and say it shows "5" or "4", etc... as a label and on the WL column it can be used to sort, and as certain criteria's are met, the counter will increase to a higher number representing my desired buy indicators.

Thanks in advance.

Confirmation Candles Indicator​

 

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

i'm thinking he means for you to use it as an example of how to do what you're asking for. anyway, here's the basic idea, i think, only needing you to replace what i've got after "if" with what you want:

def t1 = if combined then 1 else 0;
def t2 = if rsi<30 then 1 else 0;
def t3 = if signal1 then 1 else 0;
def t4 = if slowk<20 then 1 else 0;
def t5 = if signal2 then 1 else 0;

def count = t1 + t2 + t3 + t4 + t5;
addlabel( yes, "total " + count, color.green);

this is so basic that i'm not sure it's what you're after but perhaps it's a start.
 
Last edited:
Thanks @Fluideng. I checked it out but honestly way too much info than what I'm looking for here. I'm trying to keep it simple and just enter the desired RSI, MACD and a few others and have it give me a simple counter.

Also, anyone know how to change the MACD signal to only show signal when above the Zero Line? I'm trying to modify the code but not successful. :-(
Not sure what your asking. Paste this code to show cross up bellow zero line and cross down above zero line. If that is what your looking for.
You can also scan for the crosses.


Code:
declare lower;
input fastLength = 12;
input slowLength = 26;
input MACDLength = 9;
input averageType = AverageType.EXPONENTIAL;
plot Value = MovingAverage(averageType, close, fastLength) – MovingAverage(averageType, close, slowLength);
plot Avg = MovingAverage(averageType, Value, MACDLength);
plot Diff = Value – Avg;
plot ZeroLine = 0;
Value.SetDefaultColor(GetColor(1));
Avg.SetDefaultColor(GetColor(8));
Diff.SetDefaultColor(GetColor(5));
Diff.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Diff.SetLineWeight(3);
Diff.DefineColor(“Positive and Up”, Color.GREEN);
Diff.DefineColor(“Positive and Down”, Color.DARK_GREEN);
Diff.DefineColor(“Negative and Down”, Color.RED);
Diff.DefineColor(“Negative and Up”, Color.DARK_RED);
Diff.AssignValueColor(if Diff >= 0 then if Diff > Diff[1] then Diff.color(“Positive and Up”) else Diff.color(“Positive and Down”) else if Diff < Diff[1] then Diff.color(“Negative and Down”) else Diff.color(“Negative and Up”));
ZeroLine.SetDefaultColor(GetColor(0));

# now for the signal
def ValueCrossBelowZeroline = Value[1] < Avg[1] and Value[1] < 0 and Value > Avg;
plot belowZeroCross = if ValueCrossBelowZeroline then Value else Double.NaN;
belowZeroCross.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
belowZeroCross.SetDefaultColor(Color.CYAN);
def ValueCrossAboveZeroline = Value[1] > Avg[1] and Value[1] > 0 and Value < Avg;
plot aboveZeroCross = if ValueCrossAboveZeroline then Value else Double.NaN;
aboveZeroCross.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
aboveZeroCross.SetDefaultColor(Color.MAGENTA);

#plot scan = ValueCrossBelowZeroline;
#plot scan = ValueCrossAboveZeroline;
# Alerts
Alert(aboveZeroCross, "ValueCrossAboveZeroline", Alert.Bar, Sound.Bell);
Alert(belowZeroCross, "ValueCrossBelowZeroline", Alert.Bar, Sound.Ding);
 
Hi all,

Let me see if I can explain this the right way;

I'm looking to see if anyone has ever seen or created a label that can be use on a chart or WL column that will help add up all the desired buy signals.

For example;

If RSI is above 50 then "1" otherwise "0"
If MACD is above zero line and signal line crosses avg line "1" otherwise "0"
If TTM Squeeze is positive then "1" otherwise "0"
If "X' MA (could be MA of choice) is above "Y" MA (Could be MA of choice) then "1" otherwise "0"
and possibly a few more criteria's...

I could even put more weight on say the RSI and say if it's above 50 then "2" otherwise "0"

Next I have a counter that will add up the total and say it shows "5" or "4", etc... as a label and on the WL column it can be used to sort, and as certain criteria's are met, the counter will increase to a higher number representing my desired buy indicators.

Thanks in advance.
Hey - A couple of things, not sure how helpful but I will try. I have a number of those as labels on the top of my screen - probably too many sometimes. I will attach a screenshot. So while it isn't any single label as a result of those multiple indictors - you can see them all at a glance. On a related, non Think or Swim platform - Trading View does have one that offers that with a number of your desired indicators. https://www.tradingview.com/chart/9xTh1vcO/
 
Thread starter Similar threads Forum Replies Date
G Counter to add values instead of counts Questions 6
F Bar Counter & Bubble Questions 1
S Condition counter Questions 12
S Fold Function Counter Questions 3
G Bar Counter Label Questions 4

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
238 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