#Current Day Change from Premarket Open
input openingPMTime = 0400.0; #hint OrMeanS: Begin Mean Period. Usually Market Open EST.
input endTime = 1600.0; #hint OrMeanS: Begin Mean Period. Usually Market Open EST.
def na = Double.NaN;
def isDaily = If (GetAggregationPeriod() == AggregationPeriod.DAY, yes, no);
def isBelowDaily = If (GetAggregationPeriod() < AggregationPeriod.DAY, yes, no);
def isToday = If (GetDay() == GetLastDay() and SecondsFromTime(openingPMTime) >= 0, yes, no);
def day = GetDay();
def PMopenBar = day != day[1];
def PMOpen = if PMopenBar then open else PMOpen[1];
def MClose = !IsNaN(close) and IsNaN(close[-1]);
def PMO = if isToday and isBelowDaily then PMOpen else na;
def PMC = if isToday and MClose then close else na;
def Change = PMC-PMO;
def Change_Percent= round((Change/PMO)*100,2);
AddLabel (yes, "Change: " + (Change) );
AddLabel (yes, " % Change: " + ( Change_Percent) );
def Change = PMC-PMO;
def Change_Percent= round((Change/PMO)*100,2);
plot scan = Change_Percent > 10;
def Change = PMC-PMO;
def Change_Percent= round((Change/PMO)*100,2);
plot scan = Change_Percent > 10;
input openingPMTime = 0400.0; #hint OrMeanS: Begin Mean Period. Usually Market Open EST.
input endTime = 1600.0; #hint OrMeanS: Begin Mean Period. Usually Market Open EST.
def na = Double.NaN;
def isDaily = If (GetAggregationPeriod() == AggregationPeriod.DAY, yes, no);
def isBelowDaily = If (GetAggregationPeriod() < AggregationPeriod.DAY, yes, no);
def isToday = If (GetDay() == GetLastDay() and SecondsFromTime(openingPMTime) >= 0, yes, no);
def day = GetDay();
def PMopenBar = day != day[1];
def PMOpen = if PMopenBar then open else PMOpen[1];
def MClose = !IsNaN(close) and IsNaN(close[-1]);
def PMO = if isToday and isBelowDaily then PMOpen else na;
def PMC = if isToday and MClose then close else na;
def Change = PMC-PMO;
def Change_Percent= round((Change/PMO)*100,2);
plot scan = Change_Percent > 10;
Ahh OK for some reason it isn't working for me. I will keep trying. Thanks!yes sir, thats correct
Yeah I made sure to set aggregation to D (day) and it doesn't throw up any errors just doesn't come back with any results.Make sure to set your time/chart aggregation correctly in the scan.
thats why its not working for you, you have it set to DAY... you said you wanted to scan for premarket and aftermarket, if you set it to DAY, it wont let you can for EXT (EXTENDED HOURS). if you want it to scan for extended hours you have to have extended hours checked. there is not EXTEDNED hours (a.k.a premarket/aftermarket) if you set it to DAY. Minute or 5mins would probably be your best scenarioYeah I made sure to set aggregation to D (day) and it doesn't throw up any errors just doesn't come back with any results.
Does all the Yes/No and GetAggregation stuff stay or does that need to be answered or deleted by me?
Btw I changed the change to 1% and still didn't get any results.
OK will give that a try! Thanks Xeo!thats why its not working for you, you have it set to DAY... you said you wanted to scan for premarket and aftermarket, if you set it to DAY, it wont let you can for EXT (EXTENDED HOURS). if you want it to scan for extended hours you have to have extended hours checked. there is not EXTEDNED hours (a.k.a premarket/aftermarket) if you set it to DAY. Minute or 5mins would probably be your best scenario
Works perfectly you're the man thanks XeoNoX!thats why its not working for you, you have it set to DAY... you said you wanted to scan for premarket and aftermarket, if you set it to DAY, it wont let you can for EXT (EXTENDED HOURS). if you want it to scan for extended hours you have to have extended hours checked. there is not EXTEDNED hours (a.k.a premarket/aftermarket) if you set it to DAY. Minute or 5mins would probably be your best scenario
Join useThinkScript to post your question to a community of 21,000+ developers and traders.
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
J | Percent From Daily Open For ThinkOrSwim | Questions | 8 | |
Average Daily Volume Watchlist Column for ThinkorSwim | Questions | 7 | ||
Daily Watchlist of Stocks Discussion for ThinkOrSwim | Questions | 125 | ||
Trend Levels [ChartPrime] For ThinkOrSwim | Questions | 2 | ||
C_EMAmeter For ThinkOrSwim | Questions | 4 |
Start a new thread and receive assistance from our community.
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.
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.