Weekly Profiles [TFO]This Weekly Profiles indicator was built to overlay historical data to show how prior weeks of price action have unfolded under specified input conditions.
When "Show Historical Weekly Profiles" is enabled, the indicator draws out how prior weeks have traded. This is done by tracking weekly price movements, measuring the percent change from each week's respective weekly open price, and translating that percent change to the current week's open price to visually describe how price fluctuated in those previous weeks.
With "Show Weekly Profile Table" enabled, we can observe some basic statistics on the weekly profiles that have been collected, such as the average range and which days have made the high/low of the week from the given dataset.
There are also options to refine the dataset by specifying which days have made the high/low of the week, which will only show profiles that meet said criteria. For instance, by enabling "Low of Week" and selecting "Monday", the indicator will show every weekly profile that made its low on a Monday. In the following chart, we can again use the table to observe that we currently have 14 such weeks on NQ1! (from the data available on our current chart timeframe and TradingView plan), whose average range is 3.65% from the week's low to the week's high, and from those 14 weeks, the high of the week was made on a Friday 10 times or 71% of the time.
The "Profile Resolution" option specifies the interval at which to show changes in price (given that it is greater than or equal to the current chart timeframe). In the below chart, the Profile Resolution is set to 4 hours. As such, it simplifies the profiles by tracking the close price of each 4 hour candle (again as a percent change from each profile's respective open price). The larger Profile Resolution can make it easier to observe commonalities between profiles, such as the below chart of NQ1! that highlights a noticeable price decrease during the New York morning session across several of the available weekly profiles.
There is also an option to "Highlight Closest Profiles" which does exactly that. Essentially, all weekly profiles are given a score according to how close the current week's price action is matching each profile up until the current point in time. For example, if one were observing this indicator on a Wednesday afternoon, each profile would be scored according to how close price is to each profile, starting from the weekly open, up until the Wednesday afternoon of each profile. Everything after that point in time is disregarded since it hasn't happened yet and can't be measured. With this in mind, profiles with greater similarity to the current week are highlighted with deeper colors, and profiles with lesser similarity are given lighter, more transparent colors.
The "Randomize Colors" option will use various colors for the weekly profiles for easier visual differentiation (especially where there are several profiles crowding each other), as opposed to otherwise having one color for all profiles. Lastly, there are basic styling options to control the table position, table size, and the line width of all weekly profiles.
Weeklyprofile
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: