Tops & Bottoms - Day of Week Report█ OVERVIEW
The indicator tracks when the weekly tops and bottoms occur and reports the statistics by the days of the week.
█ CONCEPTS
Not all the days of the week are equal, and the market dynamic can follow through or shift over the trading week. Tops and bottoms are vital when entering a trade, as they will decide if you are catching the train or being straight offside. They are equally crucial when exiting a position, as they will determine if you are closing at the optimal price or seeing your unrealized profits vanish.
This indicator is before all for educational purposes. It aims to make the knowledge available to all traders, facilitate understanding of the various markets, and ultimately get to know your trading pairs by heart (and saving a lot of your time backtesting!).
USDJPY tops and bottoms percentages on any given week.
USDJPY tops and bottoms percentages on up weeks versus down weeks.
█ FEATURES
Custom interval
By default, the indicator uses the weekly interval defined by the symbol (e.g., Monday to Sunday). This option allows you to specify your custom interval.
Weekly interval type filter
Analyze the weekly interval on any weeks, up weeks, or down weeks.
Configurable time range filter
Select the period to report from.
█ NOTES
Trading session
The indicator analyzes the days of the week from the daily chart. The daily trading sessions are defined by the symbol (e.g., 17:00 - 17:00 on EURUSD).
Extended/electronic trading session
The indicator can include the extended hours when activated on the chart, using the 24-hour or 1440-minute timeframe.
█ HOW TO USE
Plot the indicator and navigate on the 1-day or 24-hour timeframe.
Dayofweek
High/Low of week: Stats & Day of Week tendencies// Purpose:
-To show High of Week (HoW) day and Low of week (LoW) day frequencies/percentages for an asset.
-To further analyze Day of Week (DoW) tendencies based on averaged data from all various custom weeks. Giving a more reliable measure of DoW tendencies ('Meta Averages').
-To backtest day-of-week tendencies: across all asset history or across custom user input periods (i.e. consolidation vs trending periods).
-Education: to see how how data from a 'hard-defined-week' may be misleading when seeking statistical evidence of DoW tendencies.
// Notes & Tips:
-Only designed for use on DAILY timeframe.
-Verification table is to make sure HoW / LoW DAY (referencing previous finished week) is printing correctly and therefore the stats table is populating correctly.
-Generally, leaving Timezone input set to "America/New_York" is best, regardless of your asset or your chart timezone. But if misaligned by 1 day =>> tweak this timezone input to correct
-If you want to use manual backtesting period (e.g. for testing consolidation periods vs trending periods): toggle these settings on, then click the indicator display line three dots >> 'Reset Points' to quickly set start & end dates.
// On custom week start days:
-For assets like BTC which trade 7 days a week, this is quite simple. Pick custom start day, use verification table to check all is well. See the start week day & time in said verification table.
-For traditional assets like S&P which trade only 5 days a week and suffer from occasional Holidays, this is a bit more complicated. If the custom start day input is a bank holiday, its custom 'week' will be discounted from the data set. E.g.1: if you choose 'use custom start day' and set it to Monday, then bank holiday Monday weeks will be discounted from the data set. E.g.2: If you choose 'use custom start day' and set it to Thursday, then the Holiday Thursday custom week (e.g Thanksgiving Thursday >> following Weds) would be discounted from the data set.
// On 'Meta Averages':
-The idea is to try and mitigate out the 'continuation bias' that comes from having a fixed week start/end time: i.e. sometimes a market is trending through the week start/end time, so the start/end day stats are over-weighted if one is trying to tease out typical weekly profile tendencies or typical DoW tendencies. You'll notice this if you compare the stats with various custom start days ('bookend' start/end days are always more heavily weighted). I wanted to try to mitigate out this 'bias' by cycling through all the possible new week start/end days and taking an average of the results. i.e. on BTC/USD the 'meta average' for Tuesday would be the average of the Tuesday HoW frequencies from the set of all 7 possible custom weeks(Mon-Sun, Tues-Mon, Weds-Tues, etc etc).
// User Inputs:
~Week Start:
-use custom week start day (default toggled OFF); Choose custom week start day
-show Meta Averages (default toggled ON)
~Verification Table:
-show table, show new week lines, number of new week lines to show
-table formatting options (position, color, size)
-timezone (only for tweaking if printed DoW is misaligned by 1 day)
~Statistics Table:
-show table, table formatting options (position, color, size)
~Manual Backtesting:
-Use start date (default toggled OFF), choose start date, choose vline color
-Use end date (defautl toggled OFF), choose end date, choose vline color
// Demo charts:
NQ1! (Nasdaq), Full History, Traditional week (Mon>>Friday) stats. And Meta Averages. Annotations in purple:
NQ1! (Nasdaq), Full History, Custom week (custom start day = Wednesday). And Meta Averages. Annotations in purple:
High of Day Low of Day hourly timings: Statistics. Time of day %High of Day (HoD) & Low of Day (LoD) hourly timings: Statistics. Time of day % likelihood for high and low.
//Purpose:
To collect stats on the hourly occurrences of HoD and LoD in an asset, to see which times of day price is more likely to form its highest and lowest prices.
//How it works:
Each day, HoD and LoD are calculated and placed in hourly 'buckets' from 0-23. Frequencies and Percentages are then calculated and printed/tabulated based on the full asset history available.
//User Inputs:
-Timezone (default is New York); important to make sure this matches your chart's timezone
-Day start time: (default is Tradingview's standard). Toggle Custom input box to input your own custom day start time.
-Show/hide day-start vertical lines; show/hide previous day's 'HoD hour' label (default toggled on). To be used as visual aid for setting up & verifying timezone settings are correct and table is populating correctly).
-Use historical start date (default toggled off): Use this along with bar-replay to backtest specific periods in price (i.e. consolidated vs trending, dull vs volatile).
-Standard formatting options (text color/size, table position, etc).
-Option to show ONLY on hourly chart (default toggled off): since this indicator is of most use by far on the hourly chart (most history, max precision).
// Notes & Tips:
-Make sure Timezone settings match (input setting & chart timezone).
-Play around with custom input day start time. Choose a 'dead' time (overnight) so as to ensure stats are their most meaningful (if you set a day start time when price is likely to be volatile or trending, you may get a biased / misleadingly high readout for the start-of-day/ end-of-day hour, due to price's tendency for continuation through that time.
-If you find a time of day with significantly higher % and it falls either side of your day start time. Try adjusting day start time to 'isolate' this reading and thereby filter out potential 'continuation bias' from the stats.
-Custom input start hour may not match to your chart at first, but this is not a concern: simply increment/decrement your input until you get the desired start time line on the chart; assuming your timezone settings for chart and indicator are matching, all will then work properly as designed.
-Use the the lines and labels along with bar-replay to verify HoD/LoD hours are printing correctly and table is populating correctly.
-Hour 'buckets' represent the start of said hour. i.e. hour 14 would be populated if HoD or LoD formed between 14:00 and 15:00.
-Combined % is simply the average of HoD % and LoD %. So it is the % likelihood of 'extreme of day' occurring in that hour.
-Best results from using this on Hourly charts (sub-hourly => less history; above hourly => less precision).
-Note that lower tier Tradingview subscriptions will get less data history. Premium acounts get 20k bars history => circa 900 days history on hourly chart for ES1!
-Works nicely on Btc/Usd too: any 24hr assets this will give meaningful data (whereas some commodities, such as Lean Hogs which only trade 5hrs in a day, will yield less meaningful data).
Example usage on S&P (ES1! 1hr chart): manual day start time of 11pm; New York timezone; Visual aid lines and labels toggled on. HoD LoD hour timings with 920 days history:
Week & Day Boxes Projected forward; with day-of-week labelsProjecting Week and Day boxes forward into the future, as an aide in framing the shape/profile of the coming week(s)/day(s).
////user inputs////
~toggle on/off daily and/or weekly boxes.
~input number of 2week blocks or number of 2day blocks to project forward.
~independently format colors and opacities of weekly and daily boxes.
~toggle on/off day-of-week labels (if you just want day labels, make opacity of day boxes&borders zero).
////notes////
-I have limited the project-forward numbers to keep it neat. If you want to play around with them, edit UP the FIRST integer in lines 56, 58, 62, 64 (currently set to 11,10, 41, 40 respectively). And edit UP maxvals in lines 9 and 15.
-To change the height of weekly and/or daily boxes, tweak the SECOND integer in lines 56, 58, 62, 64.
-Written for ES (S&P); tested/working on FX and BTC too.
-Starts painting/Resets at the beginning of a new week (i.e. Sunday eve).
-Sunday is blended into Monday; day's are defined as finishing at 6pm (New York Time).
DAYOFWEEK performance1 -Objective
"What is the ''best'' day to trade .. Monday, Tuesday...."
This script aims to determine if there are different results depending on the day of the week.
The way it works is by dividing data by day of the week (Monday, Tuesday, Wednesday ... ) and perform calculations for each day of the week.
1 - Objective
2 - Features
3 - How to use (Examples)
4 - Inputs
5 - Limitations
6 - Notes
7 - Final Tooughs
2 - Features
AVG OPEN-CLOSE
Calculate de Percentage change from day open to close
Green % (O-C)
Percentage of days green (open to close)
Average Change
Absolute day change (O-C)
AVG PrevD. Close-Close
Percentage change from the previous day close to the day of the week close
(Example: Monday (C-C) = Friday Close to Monday close
Tuesday (C-C) = Monday C. to Tuesday C.
Green % (C1-C)
Percentage of days green (open to close)
AVG Volume
Day of the week Average Volume
Notes:
*Mon(Nº) - Nº = Number days is currently calculated
Example: Monday (12) calculation based on the last 12 Mondays. Note: Discrepancies in numbers example Monday (12) - Friday (11) depend on the initial/end date or the market was closed (Holidays).
3 - How to use (Examples)
For the following example, NASDAQ:AAPL from 1 Jan 21 to 1 Jul 21 the results are following.
The highest probability of a Close being higher than the Open is Monday with 52.17 % and the Lowest Tuesday with 38.46 %. Meaning that there's a higher chance (for NASDAQ:AAPL ) of closing at a higher value on Monday while the highest chance of closing is lower is Tuesday. With an average gain on Tuesday of 0.21%
Long - The best day to buy (long) at open (on average) is Monday with a 52.2% probability of closing higher
Short - The best day to sell (short) at open (on average) is Tuesday with a 38.5% probability of closing higher (better chance of closing lower)
Since the values change from ticker to ticker, there is a substantial change in the percentages and days of the week. For example let's compare the previous example ( NASDAQ:AAPL ) to NYSE:GM (same settings)
For the same period, there is a substantial difference where there is a 62.5% probability Friday to close higher than the open, while Tuesday there is only a 28% probability.
With an average gain of 0.59% on Friday and an average loss of -0.34%
Also, the size of the table (number of days ) depends if the ticker is traded or not on that day as an example COINBASE:BTCUSD
4 - Inputs
DATE RANGE
Initial Date - Date from which the script will start the calculation.
End Date - Date to which the script will calculate.
TABLE SETTINGS
Text Color - Color of the displayed text
Cell Color - Background color of table cells
Header Color - Color of the column and row names
Table Location - Change the position where the table is located.
Table Size - Changes text size and by consequence the size of the table
5 - LIMITATIONS
The code determines average values based on the stored data, therefore, the range (Initial data) is limited to the first bar time.
As a consequence the lower the timeframe the shorter the initial date can be and fewer weeks can be calculated. To warn about this limitation there's a warning text that appears in case the initial date exceeds the bar limit.
Example with initial date 1 Jan 2021 and end date 18 Jul 2021 in 5m and 10 m timeframe:
6 - Notes and Disclosers
The script can be moved around to a new pane if need. -> Object Tree > Right Click Script > Move To > New pane
The code has not been tested in higher subscriptions tiers that allow for more bars and as a consequence more data, but as far I can tell, it should work without problems and should be in fact better at lower timeframes since it allows more weeks.
The values displayed represent previous data and at no point is guaranteed future values
7 - Final Tooughs
This script was quite fun to work on since it analysis behavioral patterns (since from an abstract point a Tuesday is no different than a Thursday), but after analyzing multiple tickers there are some days that tend to close higher than the open.
PS: If you find any mistake ex: code/misspelling please comment.
Day and Time HighlightYet another sweet little tool that highlights only specific days and time.
For example, you can highlight only Tuesday's and Friday's from 0930-1600
You can adjust to any day of the week and any time of the day.
You can request more improvements upon this version. Cheers!
Like if you Like and Follow me for upcoming indicators/strategies: www.tradingview.com
KZ SessionsThis shows killzone sessions for London NY, Asia sessions.
In addition to the opening hours of session, the pre-market and closing time periods are also marked with a grey color
Generally these are consided period of high activity and can experience more volatility in these periods
I also have enabled it to display the session times even on weekends. There is no session open at such times but heightened activity is noticed in these periods even on weekends.
If want to disable showing it on weekends, then remove ":1234567" from all the lines in code
Time rangesThis script visualizes the different time sessions during the day.
The time ranges are set to the default Frankfurt, London, NY, Sydney and Tokyo, but can be
freely modified and turned off (I personally use to display only Tokyo and NY).
If you are a day trader, e.g. you trade with the Market Makers, this tool is a "must have".
It also displays the day of the week, which can be set off as well.
vitelot/yanez/Vts Sept 2019
PS I chose this script to belong to the "volatility" category since it can be used to highlight the Asian session,
and there was no suitable category available.
DurFriSatSunMonShows green if close > open on a given day, red is close < open.
Dur is for Thursday, which is optional.
Pine Script Tutorial #2In this second tutorial we build upon the previous tutorial. We add color shading for each different day and highlight Wednesday.
The idea here is to manually count if on Wednesdays close is bigger then open.
Hope it helps.
Feel free to comment.
MartinMystere
UCS_FridaysA simple script to show the Fridays (Weekly Option Expiry), of course this is a basic script we can make a few more improvement.
One of many ways to utilize the "dayofweek" variable.
Currently there are no options to draw a vertical line, you can do a background color for the candle.
Future plans - Include monthly option expiry.