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.
 

Fluideng

Member
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​

 

PT_Scalper

Member
VIP

Confirmation Candles Indicator​

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. :-(
 

floydddd

Active member
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:

PT_Scalper

Member
VIP
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.
Hi @floydddd,

Thank you. I will give it a shot.
 

Fluideng

Member
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);
 

MJK3536

New 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.
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/
 

Similar threads

Top