Average up move of a stock

jeffc

New member
I am looking for an indicator that shows the average up move in dollars over the last 90 days between 6:30am-6:45am pacific time at market open. Thank you.

Solution
I am looking for an indicator that shows the average up move in dollars over the last 90 days between 6:30am-6:45am pacific time at market open. Thank you.

This uses a 15m agg bar and is dependent on the number of days showing on the chart. I had to use a 180 days chart timeframe to get 90 days of data.

Code:
``````def ymd = GetYYYYMMDD();
def ok           = !IsNaN(close);
def capture      = ok and ymd != ymd[1];
def dayCount     = CompoundValue(1, if capture then dayCount[1] + 1 else dayCount[1], 0);
def thisDay      = (HighestAll(dayCount) - dayCount) + 1;

input days       = 90;

input start_time = 0930; #Allows the first candle to form befor determining direction

def start = if SecondsTillTime(start_time) == 0 and...``````
I am looking for an indicator that shows the average up move in dollars over the last 90 days between 6:30am-6:45am pacific time at market open. Thank you.

do you want,
the average of each days price difference from,

1. 9:30 open to 9:45 close
or
2. the lowest price during the first 15 minutes subtracted from the highest price during the first 15 minutes?

Option#2 actually.

Thank you.

I am looking for an indicator that shows the average up move in dollars over the last 90 days between 6:30am-6:45am pacific time at market open. Thank you.

This uses a 15m agg bar and is dependent on the number of days showing on the chart. I had to use a 180 days chart timeframe to get 90 days of data.

Code:
``````def ymd = GetYYYYMMDD();
def ok           = !IsNaN(close);
def capture      = ok and ymd != ymd[1];
def dayCount     = CompoundValue(1, if capture then dayCount[1] + 1 else dayCount[1], 0);
def thisDay      = (HighestAll(dayCount) - dayCount) + 1;

input days       = 90;

input start_time = 0930; #Allows the first candle to form befor determining direction

def start = if SecondsTillTime(start_time) == 0 and SecondsFromTime(start_time) == 0
then 1
else 0;
def l = if start and thisDay <= Min(HighestAll(thisDay), days) then l[1] + low(period = AggregationPeriod.FIFTEEN_MIN) else l[1];
def h = if start and thisDay <= Min(HighestAll(thisDay), days) then h[1] + high(period = AggregationPeriod.FIFTEEN_MIN) else h[1];

def up = (h - l);
AddLabel(1, Min(HighestAll(thisDay), days) + " Days Avg Up Move (0630-0645 PT): " + AsDollars(up / Min(HighestAll(thisDay), days)) , Color.LIGHT_GREEN);
AddLabel(1, "| Highs: " + AsDollars(h) + " | Lows: " + AsDollars(l) + " | Diff: " + AsDollars(h - l), Color.WHITE);

#Testing#
input test = yes;
AddChartBubble(test and SecondsFromTime(0930) == 0, low - .1, high + "\n" + open + "\n" + (high - open) + "\nSum Highs " + AsDollars(h) + "\nSum Lows " + AsDollars(l) + "\nDays " + (thisDay ), Color.GRAY);``````

This uses a 15m agg bar and is dependent on the number of days showing on the chart. I had to use a 180 days chart timeframe to get 90 days of data.
Thank you. Ill heck it out.

Not the exact question you're looking for?

87k+ Posts
194 Online

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
• Exclusive indicators
• Proven strategies & setups
• Private Discord community
• Exclusive members-only content
• 1 full year of unlimited support

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?