How to show Time & Condition in Watchlist Columns

Good morning traders! It has been a very long time since I have posted, but I wanted to come back to the forum to see if you guys could help me with some logic. I have spent the last hour or so looking through old posts and threads looking for this logic, but I could not, so I wanted to ask if we could possibly build something together.

To preface - I would like the ability to be able to see the "AddChartBubble" logic in a watchlist column. This can be very basic. If I have an algorithm that populates a "BUY" bubble at 9:51, I would like my WL column to say "BUY, 9:51". And if another "BUY" happens to come in at a later time, that would simply replace the old "BUY, 9:51".

Is this type of thing possible, and if so, could anyone help me think through this? I dont have any "logic" for this yet, but willing to discuss further.
 
Solution
Good morning traders! It has been a very long time since I have posted, but I wanted to come back to the forum to see if you guys could help me with some logic. I have spent the last hour or so looking through old posts and threads looking for this logic, but I could not, so I wanted to ask if we could possibly build something together.

To preface - I would like the ability to be able to see the "AddChartBubble" logic in a watchlist column. This can be very basic. If I have an algorithm that populates a "BUY" bubble at 9:51, I would like my WL column to say "BUY, 9:51". And if another "BUY" happens to come in at a later time, that would simply replace the old "BUY, 9:51".

Is this type of thing possible, and if so, could...
Good morning traders! It has been a very long time since I have posted, but I wanted to come back to the forum to see if you guys could help me with some logic. I have spent the last hour or so looking through old posts and threads looking for this logic, but I could not, so I wanted to ask if we could possibly build something together.

To preface - I would like the ability to be able to see the "AddChartBubble" logic in a watchlist column. This can be very basic. If I have an algorithm that populates a "BUY" bubble at 9:51, I would like my WL column to say "BUY, 9:51". And if another "BUY" happens to come in at a later time, that would simply replace the old "BUY, 9:51".

Is this type of thing possible, and if so, could anyone help me think through this? I dont have any "logic" for this yet, but willing to discuss further.

This uses an addlabel to place the time a high or low occurred in a watchlist https://usethinkscript.com/threads/high-of-certain-period-before-certain-time.6736/post-101902
 
Solution
Is there a way to make a watchlist show the time and price at which an ema cross up or down would occur? Kinda like “Up/429.25/11:30” and vice versa?

plot EMA = ExpAverage(close, 9);
EMA.SetDefaultColor(Color.WHITE); EMA.SetLineWeight(1)
plot EMA2 = ExpAverage(close, 21);
EMA2.SetDefaultColor(Color.blue); EMA2.SetLineWeight(1);

Plot crossup = ema crosses above ema2;
Plot crossdown = ema crosses below ema2;


This uses an addlabel to place the time a high or low occurred in a watchlist https://usethinkscript.com/threads/high-of-certain-period-before-certain-time.6736/post-101902
 
Is there a way to make a watchlist show the time and price at which an ema cross up or down would occur? Kinda like “Up/429.25/11:30” and vice versa?

plot EMA = ExpAverage(close, 9);
EMA.SetDefaultColor(Color.WHITE); EMA.SetLineWeight(1)
plot EMA2 = ExpAverage(close, 21);
EMA2.SetDefaultColor(Color.blue); EMA2.SetLineWeight(1);

Plot crossup = ema crosses above ema2;
Plot crossdown = ema crosses below ema2;

Make sure your timeframe for the watchlist and the charts you are viewing are the same

Watchlist Version
Screenshot 2024-06-24 072332.png

Code:
#Watchlist Column
#Watchlist Time must match Chart Time being Viewed

input showlabel = yes;

#Time Defined
input timezone = {default "ET", "CT", "MT", "PT"};

def starthour  = (if timezone == timezone."ET"
                        then 9
                        else if timezone == timezone."CT"
                        then 8
                        else if timezone == timezone."MT"
                        then 7
                        else 6) ;

def hour = Floor(((starthour * 60 + 30) + (GetTime() - RegularTradingStart(GetYYYYMMDD())) / 60000) / 60);
def minutes = (GetTime() - RegularTradingStart(GetYYYYMMDD())) / 60000 - ((hour - starthour) * 60 + 30) + 60;
def bn = BarNumber();

def EMA = ExpAverage(close, 9);
def EMA2 = ExpAverage(close, 21);
def crossup   = EMA crosses above EMA2;
def crossdown = EMA crosses below EMA2;
def lastup    = if crossup then bn else lastup[1];
def lastdown  = if crossdown then bn else lastdown[1];
def emaup     = if crossup then ema2 else emaup[1];
def emadown   = if crossdown then ema2 else emadown[1];
def crosslast = if lastup > lastdown then 1 else 0;
def hr        = if crossup or crossdown then hour else hr[1];
def min       = if crossup or crossdown then minutes else min[1];

AddLabel(showlabel, (if crosslast == 1 then "UP / " else "DN / ") + (if crosslast==1 then astext(emaup) else astext(emadown)) + " / " +  (hr + ":") +
           (if min < 10
            then "0" + min
            else  "" + min), if crosslast == 1 then Color.GREEN else color.red);
#
Chart Version
Screenshot 2024-06-24 073257.png

Code:
#Watchlist Column
#Watchlist Time must match Chart Time being Viewed

input showlabel  = yes;
input showbubble = yes;

#Time Defined
input timezone = {default "ET", "CT", "MT", "PT"};

def starthour  = (if timezone == timezone."ET"
                        then 9
                        else if timezone == timezone."CT"
                        then 8
                        else if timezone == timezone."MT"
                        then 7
                        else 6) ;

def hour = Floor(((starthour * 60 + 30) + (GetTime() - RegularTradingStart(GetYYYYMMDD())) / 60000) / 60);
def minutes = (GetTime() - RegularTradingStart(GetYYYYMMDD())) / 60000 - ((hour - starthour) * 60 + 30) + 60;
def bn = BarNumber();

plot EMA = ExpAverage(close, 9);
EMA.SetDefaultColor(Color.WHITE);
EMA.SetLineWeight(1);
plot EMA2 = ExpAverage(close, 21);
EMA2.SetDefaultColor(Color.blue); EMA2.SetLineWeight(1);

def crossup   = EMA crosses above EMA2;
def crossdown = EMA crosses below EMA2;
def lastup    = if crossup then bn else lastup[1];
def lastdown  = if crossdown then bn else lastdown[1];
def emaup     = if crossup then ema2 else emaup[1];
def emadown   = if crossdown then ema2 else emadown[1];
def crosslast = if lastup > lastdown then 1 else 0;
def hr        = if crossup or crossdown then hour else hr[1];
def min       = if crossup or crossdown then minutes else min[1];

AddChartBubble(showbubble and crossup[1] == 0 and crossup == 1, low, “Up/" + AsText(EMA2) + "/" + +hr + ":"+ (if min < 10 then "0" else "") + min , Color.green, no);
AddChartBubble(showbubble and crossdown[1] == 0 and crossdown == 1, high, “Dn/" + AsText(EMA2) + "/" + +hr + ":"+ (if min < 10 then "0" else "") + min , Color.red);

AddLabel(showlabel, (if crosslast == 1 then "UP/" else "DN/") + (if crosslast==1 then astext(emaup) else astext(emadown)) + "/" +  (hr + ":") +
           (if min < 10
            then "0" + min
            else  "" + min), if crosslast == 1 then Color.GREEN else color.red);
#
 
Last edited:

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

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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