Previous Day High/Low/Close For ThinkOrSwim

1) > Please see the updated code below.

2) > Yes, the prior close price will be pulled and updated Monday morning.

3) I've added AH info.

4) Done. Good luck! @cabe1332

k1qWzWQ.png
Could you kindly share the label code for RV label that listed right next to it, thanks in advance
 

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

Could you kindly share the label code for RV label that listed right next to it, thanks in advance
@mansor Here you go. Good luck! @cabe1332

# Start Relative Volume - @cabe1332

def pmclosed = if SecondsFromTime(0400) >= 0 and SecondsTillTime(0930) >= 0 then 0 else 1;
def AV = AggregationPeriod.DAY;
def x1 = Average(volume(period = AV)[1], 60);
def v1 = volume(period = AV);
def z1 = v1 / x1;
def z2 = if Lg(z1) >= 2 then 0 else 1;
AddLabel(pmclosed, "RV: " + Round(z1, z2), color.light_green);

#End Relative Volume
 
hmmmmm. still can't get AH to work on a daily chart. when you change to daily, it's working properly?
@floydddd not sure what else I can do. It works for me. Maybe someone else can take the code and add the label to confirm. @cabe1332

#Start code

# PM info
def AP = AggregationPeriod.DAY;
def Priorclose = close(period = AP)[1];
def PctChange = (close - Priorclose) / Priorclose;
def PMGapUP = Round(close - Priorclose, 2);
def PC1 = Round(PctChange, 2);

AddLabel (1, "PM Gap Up/Down $: " + PMGapUP +" | " + AsPercent(PC1),
if Priorclose < close then color.light_green else CreateColor(255, 153, 153));

AddLabel (1, "Prior Close Price $: " + Round(Priorclose, 2),
if Priorclose < close then color.light_green else CreateColor(255, 153, 153));

# AH info
def close1 = if SecondsFromTime(0930) > 0 and SecondsFromTime(1600) < 0 then close else close1[1];
def change = (close / close1) - 1;

def AH = AggregationPeriod.DAY;
def INTclose = close(period = AH);
def AHGapUP = Round(close - INTclose, 2);
def PctChange2= (close - Intclose) / Intclose;
def PC2 = Round(PctChange2, 2);

AddLabel(ah, "AH Gap Up/Down: " + AHGapUP + " | " + AsPercent(PC2), if change < 0 then CreateColor(255, 153, 153) else CreateColor(197, 239, 161));

#End code
 
hmmmmm. still can't get AH to work on a daily chart. when you change to daily, it's working properly?

That would be because there are no AH's for timeframes above intraday, meaning than from Day timeframe/aggregation up there is no AH's...
 
so ... there's PM on daily but no AH? (and from what i gather, cabe was able to see both PM and AH on daily.)
 
so ... there's PM on daily but no AH? (and from what i gather, cabe was able to see both PM and AH on daily.)
@floydddd sorry if I mislead you, but I did not claim to have this working on daily agg, I just add an AH per your request. The label will provide you with AH data on other agg or timeframes except daily. If I find or figure one out I will let you know.

Thank you for confirming @rad14733 for the reply. Much appreciate you.

Good luck!
@cabe1332
 
input aggregationPeriod = AggregationPeriod.DAY;
input showOnlyLastPeriod = yes;

def prevPrice = close(period = aggregationPeriod)[-1];
def price = close(period = aggregationPeriod);
plot DailyOpen = if showOnlyLastPeriod and !IsNaN(prevPrice) then Double.NaN else price;

DailyOpen.SetDefaultColor(GetColor(5));
DailyOpen.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);



I tried that....not sure what I am doing wrong. It's showing the current closing plots line in the current day.
 
Last edited:
Hi all , is there anyway to make a watchlist option to me whether or not a stocks current daily candle opened up between yesterday’s high and low? Thanks in advance guys
 
@kingkunta Try this...

Ruby:
AddLabel(yes, " ", if Between(open, open[1], close[1]) then Color.GREEN else Color.RED);
AssignBackgroundColor(if Between(open, open[1], close[1]) then Color.GREEN else Color.RED);
 
@rad14733
AddLabel(yes, " ", if Between(open, high[1], low[1]) then Color.GREEN else Color.RED);
AssignBackgroundColor(if Between(open, high[1], low[1]) then Color.GREEN else Color.RED);

wouldn't the code be this as I want it to be between the previous days candles high and low? instead of the open and close?
 
@rad14733
AddLabel(yes, " ", if Between(open, high[1], low[1]) then Color.GREEN else Color.RED);
AssignBackgroundColor(if Between(open, high[1], low[1]) then Color.GREEN else Color.RED);

wouldn't the code be this as I want it to be between the previous days candles high and low? instead of the open and close?

Ah, yes... Good catch... (y)
 
hey so I did it like I wrote down and its just showing red labels for every stock on my watchlist, I checked a few of them and they meet the criteria but still dont show up in the right color, any advice?

Is the timeframe for the column set to Day...??? The code below works...

Ruby:
AddLabel(yes, " ");
AssignBackgroundColor(if Between(open, low[1], high[1]) then Color.GREEN else Color.RED);
 
If anyone can help me out much appreciated. Looking for an indicator that.....
1. Shows the previous day high and low for my intraday charts. I want it simple as just showing a thin dashed line (red and green) for each, starting from the high/low. these lines should dissapear possibly premarket or next day open and the new ones should be plotted. No alerts, bubbles, or anything extra.
2. Another indicator showing the same as above but for the overnight premarket high/low with solid thin line (red and green) for each. Same set up.

can be combined into 1 also if easier, but rather seperate.
 
Last edited:
@iselloptions This is what I use, you can split the script into 2 if you want.
Code:
# TS_GlobexRange
# http://thinkscripter.wordpress.com
# [email protected]
# Last Update 18 JUL 2009

declare once_per_bar;
declare hide_on_daily;

def Globex_Open = 1630;
def Globex_Close = 0930;

def h = high;
def l = low;
def globexOpen = secondsFromTime(Globex_Open) >= 0 or secondsTillTime(Globex_Close)>0;
def globexReset = globexOpen and !globexOpen[1];


def globexHigh = compoundValue(1, if((h > globexHigh[1] and globexOpen) or globexReset, h, globexHigh[1]), h);
def globexLow = compoundValue(1, if((l < globexLow[1] and globexOpen) or globexReset, l, globexLow[1]), l);


plot Globex_High = globexHigh;
Globex_High.HideBubble();
Globex_High.HideTitle();
plot Globex_Low = globexLow;
Globex_Low.HideBubble();
Globex_Low.HideTitle();

# Previous day HiLo
plot hi = high(period = AggregationPeriod.DAY)[1];
hi.HideBubble();
hi.HideTitle();
plot lo = low(period = AggregationPeriod.DAY)[1];
lo.HideBubble();
lo.HideTitle();
 

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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