Dollar Amount and Time

Focus

Member
I'm looking for an indicator that shows the dollar amount a stock has fallen or moved up from 9 AM to 11 AM.
 
Solution
I'm looking for an indicator that shows the dollar amount a stock has fallen or moved up from 9 AM to 11 AM.


this will find the highest and lowest prices , during some time period within a day.
it draws a line for each price.
it draws 2 labels that list the start and stop times, in HHMM format.
a bubble shows the difference, highest - lowest.

i assumed you are in central time, and changed the times to be 10:00 - 12:00, so they are in EST.


Code:
# hilo_in_time_periods_02

#--------------------
#https://usethinkscript.com/threads/dollar-amount-and-time.15924/
#Dollar Amount and Time
# show the dollar amount a stock has fallen or moved up from 9 AM to 11 AM.
#-----------------------------

def bn = BarNumber();
def na =...
I'm looking for an indicator that shows the dollar amount a stock has fallen or moved up from 9 AM to 11 AM.


this will find the highest and lowest prices , during some time period within a day.
it draws a line for each price.
it draws 2 labels that list the start and stop times, in HHMM format.
a bubble shows the difference, highest - lowest.

i assumed you are in central time, and changed the times to be 10:00 - 12:00, so they are in EST.


Code:
# hilo_in_time_periods_02

#--------------------
#https://usethinkscript.com/threads/dollar-amount-and-time.15924/
#Dollar Amount and Time
# show the dollar amount a stock has fallen or moved up from 9 AM to 11 AM.
#-----------------------------

def bn = BarNumber();
def na = Double.NaN;

input start = 1000;
input stop = 1200;

addlabel(1, " " , color.black);
addlabel(1, "start time " + asprice(start), color.yellow);
addlabel(1, "stop time " + asprice(stop), color.yellow);

def first = SecondsTillTime(start) == 0;
def period = (SecondsFromTime(start) >= 0 and SecondsTillTime(stop) > 0);

def big = 99999;

def hi;
def lo;
if first and !isnan(close) then {
  hi = fold j1 = 0 to 500
    with k1
    while !isnan(getvalue(close, -j1)) and GetValue(period, -j1)
    do (if GetValue(high, -j1) > k1 then GetValue(high, -j1) else k1);

  lo = fold j2 = 0 to 500
    with k2 = big
    while !isnan(getvalue(close, -j2)) and GetValue(period, -j2)
    do (if GetValue(low, -j2) < k2 then GetValue(low, -j2) else k2);

} else if period then {
    hi = hi[1];
    lo = lo[1];
} else {
    hi = 0;
    lo = 0;
}

def rng = hi-lo;

plot zhi = if hi > 0 then hi else na;
plot zlo = if lo > 0 then lo else na;
zhi.setdefaultcolor(color.light_gray);
zlo.setdefaultcolor(color.light_gray);
zhi.hidebubble();
zlo.hidebubble();

input show_bubble = yes;
addchartbubble(show_bubble and first, lo,
"Hi - Lo\n" +
rng
, color.yellow, no);
#

funbc5M.jpg
 
Solution
this will find the highest and lowest prices , during some time period within a day.
it draws a line for each price.
it draws 2 labels that list the start and stop times, in HHMM format.
a bubble shows the difference, highest - lowest.

i assumed you are in central time, and changed the times to be 10:00 - 12:00, so they are in EST.


Code:
# hilo_in_time_periods_02

#--------------------
#https://usethinkscript.com/threads/dollar-amount-and-time.15924/
#Dollar Amount and Time
# show the dollar amount a stock has fallen or moved up from 9 AM to 11 AM.
#-----------------------------

def bn = BarNumber();
def na = Double.NaN;

input start = 1000;
input stop = 1200;

addlabel(1, " " , color.black);
addlabel(1, "start time " + asprice(start), color.yellow);
addlabel(1, "stop time " + asprice(stop), color.yellow);

def first = SecondsTillTime(start) == 0;
def period = (SecondsFromTime(start) >= 0 and SecondsTillTime(stop) > 0);

def big = 99999;

def hi;
def lo;
if first and !isnan(close) then {
  hi = fold j1 = 0 to 500
    with k1
    while !isnan(getvalue(close, -j1)) and GetValue(period, -j1)
    do (if GetValue(high, -j1) > k1 then GetValue(high, -j1) else k1);

  lo = fold j2 = 0 to 500
    with k2 = big
    while !isnan(getvalue(close, -j2)) and GetValue(period, -j2)
    do (if GetValue(low, -j2) < k2 then GetValue(low, -j2) else k2);

} else if period then {
    hi = hi[1];
    lo = lo[1];
} else {
    hi = 0;
    lo = 0;
}

def rng = hi-lo;

plot zhi = if hi > 0 then hi else na;
plot zlo = if lo > 0 then lo else na;
zhi.setdefaultcolor(color.light_gray);
zlo.setdefaultcolor(color.light_gray);
zhi.hidebubble();
zlo.hidebubble();

input show_bubble = yes;
addchartbubble(show_bubble and first, lo,
"Hi - Lo\n" +
rng
, color.yellow, no);
#

funbc5M.jpg
Can the amount be next to the "start time and stop time" label?
 
Last edited by a moderator:

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

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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