Intraday Alerts At Overnight Highs and Lows
A quick Google search on the term “Overnight Range Trading Setups” nets some very interesting results. So I spent some time writing code and looking at charts. I think there is some real evidence to support the inclusion of the overnight range in your trading setups. I’m not here to show you how to trade the overnight range. However I did build you the best tool I can dream up, given my current knowledge and experience. The rest is up to you.
In this video named Thinkorswim Overnight Range Scan Alert, we show you many examples of how this tool may be applied. In addition to some special levels, we also include the ability to build custom scans based on its signals. As if that wasn’t enough, we throw in a bonus by showing how you can generate real time alerts based on the scan results. I am really excited to be able to present this material. I think this may end up being a valuable tool for many. It was a real eye-opener for me.
The code for the scan is included at the very bottom of this post. So be sure when you are done watching the video to scroll down past the video to get to that code. In the video we show you how to use that code to build your own custom scans, with alerts!
Link to study file: Chart_OvernightRangeSTUDY.ts
Lean More:
Would you like to learn how to master the chart settings on Thinkorswim? Click here for our 3 part series: Thinkorswim Chart Settings Tutorial
*Thinkorswim is a chart analysis platform offered by TD Ameritrade: www.tdameritrade.com
TD Ameritrade provides financial services including the trading of Stocks, Futures, Options and Forex.
Please be sure to share this page with your friends and colleagues. Leaving comments below is the best way to help make the content of this site even better.
Watch the video, Thinkorswim Overnight Range Scan Alert below:
input alertPeriodStart = 730;
input alertPeriodEnd = 930;
input minimumRange = 10;
input alertOnBreak = yes;
input alertOnPullBack = yes;
input numberOfDays = 0;
input numberOfYears = 0;
def okToPlot = GetLastDay() - numberOfDays <= GetDay() and GetLastYear() - numberOfYears <= GetYear() ;
def startCounter = SecondsFromTime(alertPeriodStart);
def endCounter = SecondsTillTime(alertPeriodEnd);
def alertPeriod = if startCounter >= 0 and endCounter >= 0 then 1 else 0;
def regularSessionHours = RegularTradingStart(GetYYYYMMDD()) <= GetTime();
def extendedSessionHours = RegularTradingStart(GetYYYYMMDD()) >= GetTime();
def extendedSessionStart = regularSessionHours[1] and extendedSessionHours;
def regularSessionStart = extendedSessionHours[1] and regularSessionHours;
def extendedSessionHigh = CompoundValue(1, if extendedSessionStart then high else if extendedSessionHours then Max(high, extendedSessionHigh[1]) else extendedSessionHigh[1], 0);
def extendedSessionLow = CompoundValue(1, if extendedSessionStart then low else if extendedSessionHours then Min(low, extendedSessionLow[1]) else extendedSessionLow[1], 0);
def regularSessionHigh = CompoundValue(1, if regularSessionStart then high else if regularSessionHours then Max(high, regularSessionHigh[1]) else regularSessionHigh[1], 0);
def regularSessionLow = CompoundValue(1, if regularSessionStart then low else if regularSessionHours then Min(low, regularSessionLow[1]) else regularSessionLow[1], 0);
def overnightHigh = if okToPlot and regularSessionHours then extendedSessionHigh else Double.NaN;
def overnightLow = if okToPlot and regularSessionHours then extendedSessionLow else Double.NaN;
def breakOfHigh = extendedSessionHigh[1] > regularSessionHigh[1] and regularSessionHigh > extendedSessionHigh;
def breakOfLow = extendedSessionLow[1] < regularSessionLow[1] and regularSessionLow < extendedSessionLow;
def pullbackToHigh = low[1] > extendedSessionHigh[1] and low < extendedSessionHigh;
def pullbackToLow = high[1] < extendedSessionLow[1] and high > extendedSessionLow;
def overnightRange = overnightHigh - overnightLow;
plot scan = if alertPeriod and overnightRange >= minimumRange * TickSize() then breakOfHigh or breakOfLow else no;
#plot scan = if alertPeriod and overnightRange >= minimumRange * TickSize() then pullbackToHigh or pullbackToLow else no;
Is there anyway you can modify this code, so that it does the same for yesterday high and low instead?
Yes, it is possible. But you cannot do this by simply adjusting the settings. large sections of the code would need to be entirely rewritten. Something which is well beyond the scope of a solution I can provide in the comments section of this video.
I suggest you browse existing solution in our Q&A Forum. You will find many solutions in the forum which show the previous day high and low. Here is a link to search results using the term “previous day”: https://www.hahn-tech.com/ans/cat/studies/?question_type=all&category=%2Fans%2Fcat%2Fstudies%2F&search=previous+day