Flashtrader´s Statistical BandwidthsThe vast majority of traders exclusively concern 
themselves with trend-following in all its facets. Scoring 
points with trends on a regular basis is a difficult task 
since prices do not constantly move in one direction 
or another. In the case of the DAX future, for example, 
only about 30 per cent of all trading days in a year are 
trend days. And of these, there are x percent long ones 
 and x per cent short ones. Catching the very days when 
prices rise or fall from the opening to the close is a major 
challenge for a trader who also needs to have previously 
recognised the corresponding direction.
 However, there are also other ways of profit-taking 
every day – for example, by using the mean reversion 
strategy. The idea behind this is the fact that prices reach 
a high and a low every day – but very rarely close at the 
high or the low. This means that prices always move 
away from these extreme points and the closing price is 
somewhere in between. A profitable trading strategy can 
be developed out of this.
 But how can you know where the high and the low 
will be tomorrow? Is it possible for you to know this in
advance? No – because no one can predict the future. Or 
can they? At least it can be statistically determined how 
high or low prices could go tomorrow. There is a high 
degree of probability that one of the two possibilities 
will materialise. It will then be necessary to act.
Calculation
 Classic pivot points for the following day are calculated 
from the high, low and closing price. But does it really 
make sense to use such a mix? I don’t think so and 
use a different calculation for this strategy. In a first step, 
only the differences between the start and the high or low 
are calculated on a daily basis. To avoid being dependent 
on individual days and outliers, it is advisable to calculate, 
in a second step, the average of these differences over 
the past five days. Finally, this average will then be added 
at the opening price of the current trading day for the 
upper statistical bandwidth and subtracted for the lower 
bandwidth.
upper bandwidth = oSTB (violet dashed line in the chart)
lower bandwidth = uSTB (violet dashedline in the chart)
The second interesting question is, if the previous day's high has been exceeded, how much further can the price rise from a mathematical/statistical point of view?
These calculated previous day highs expansions are shown as red dashed lines
Previous day's high expansion = VTHA
Previous day's low expansion = VTTA
For further orientation, the previous day's high (VTH) and the previous day's low (VTT) are shown in light blue dashed lines
And as a supplement, the previous day's close in the DAX Future at 10:00 p.m. VTSA in violet solid lines and the previous day's close in the cash register at 5:30 p.m. VTSN in yellow solid lines
Reaching the calculated extreme values does not mean that the trend has to change immediately, but there is at least temporary exhaustion potential with which you can earn a few points every day in the area of scalping.
Example for cheap entry long:
  
Example for cheap entry short:
  
Deutsch:
Die Masse der Trader beschäftigt sich ausschließlich mit Trendfolge in all ihren Facetten. Mit Trends regelmäßig zu punkten ist ein schwieriges Unterfangen, da die Kurse nicht ständig in die eine oder andere Richtung laufen. Beim DAX-Future zum Beispiel sind von allen Börsentagen im Jahr lediglich zirka 30 Prozent Trendtage. Davon sind dann auch noch x Prozent Long und x Prozent Short. Hier genau die Tage abzupassen, an denen die Kurse von Börsenbeginn bis zum Schluss steigen beziehungsweise fallen, ist eine große Herausforderung – wobei der Trader zuvor noch die entsprechende Richtung erkannt haben muss. Es gibt jedoch auch noch andere Methoden täglich Gewinne mitzunehmen, zum Beispiel mit der Mean-Reversion-Strategie (Mittelwertumkehr).
Hintergrund ist die Tatsache, dass die Kurse jeden Tag ein Hoch und ein Tief erreichen – aber sehr selten am Hoch oder am Tief schließen. Das bedeutet, dass die Preise sich immer wie der von diesen Extrempunkten wegbewegen und der Schlusskurs irgendwo dazwischen liegt. Hieraus lässt sich eine profitable Handelsstrategie entwickeln. Aber woher kannst Du wissen, wo morgen das Hoch und das Tief sein wird? Kannst Du das vorher schon wissen? Nein – denn niemand kann die Zukunft vorhersagen. Oder doch? Statistisch lässt sich zumindest bestimmen, wie hoch und wie tief die Kurse morgen steigen oder fallen könnten. Eine Seite wird mit sehr hoher Wahrscheinlichkeit ein treffen. Dann gilt es zu handeln.
Berechnung Klassischer Pivot-Punkte für den folgenden Tag werden aus Hoch, Tief und Schlusskurs berechnet. Aber ist es wirklich sinnvoll, einen solchen Mix zu verwenden? Ich finde das nicht und verwenden für diese Strategie eine andere Berechnung. Im ersten Schritt werden täglich die Differenzen nur vom Start bis zum Hoch beziehungsweise Tief errechnet. Um nicht von einzelnen Tagen und Ausreißern abhängig zu sein, empfiehlt es sich, in einem zweiten Schritt den Durchschnitt dieser Differenzen über die letzten fünf Tage zu errechnen. Zuletzt wird dann dieser Durchschnitt zum Eröffnungskurs des aktuellen Handelstages für die obere statistische Bandbreite addiert und für die untere Bandbreite subtrahiert.
Obere statistische Bandbreite = oSTB (violette gestrichelte Linie im Chart)
Untere statistische Bandbreite = uSTB (violette gestrichelte  Linie im Chart)
Die zweite interessante Frage ist, wenn das Vortageshoch überschritten wurde, wie weit kann der Kurs dann noch steigen aus mathematisch/statistischer Sicht?
Diese berechneten Vortagesextremausdehnungen sind als rote gestrichelte Linien dargestellt
Vortageshochausdehnung = VTHA
Vortagestiefausdehnung = VTTA
Für die weitere Orientierung sind die Vortageshochs (VTH) und die Vortagestiefs (VTT) als hellblaue gestrichelte Linien abgebildet.
Als Ergänzung wird noch der Vortages Schluss im Dax Future um 22:00 Uhr VTSA mit einer violetten durchgezogenen Linie und  der Kassamarktschluss um 17:30 Uhr mit einer gelben durchgezogenen Linie gezeigt. 
Das Erreichen der berechneten Extremwerte bedeutet nicht, das der Trend sofort drehen muss, aber es sind zumindest temporäre Erschöpfungspotentiale mit denen sich im Bereich scalping täglich einige Punkte verdienen lassen.
Beispiel für günstigen Einstieg Long:
  
Beispiel für günstigen Einstieg Short:
  
Cari dalam skrip untuk "one一季度财报"
LV Stock QualityCritical financial and technical values are listed in the table.
PIOTROSKI_F_SCORE (expect. >5) -> The Piotroski score is a discrete score between zero and nine that reflects nine criteria used to determine the strength of a firm's financial position. The Piotroski score is used to determine the best value stocks, with nine being the best and zero being the worst. Having a score bigger than 5 is a good sign for the strength of a firm's financial position
ROE (expect. >11) --> Return on equity (ROE) is a measure of a company's financial performance. It is calculated by dividing net income by shareholders' equity. Because shareholders' equity is equal to a company’s assets minus its debt, ROE is a way of showing a company's return on net assets. A “good” ROE will depend on the company’s industry and competitors.
EPS_GROWTH (expect. >11) --> This indicator is calculated as the percentage change in Basic earnings per share for one year. This indicator reflects the growth rate of a company's basic profit per share outstanding for one year. It is calculated based using only common shares. An increase in EPS growth may signal that a company is becoming more profitable and efficient in its operations. A decline in EPS growth may signal that a company is spending more or losing business share. EPS growth should be viewed alongside other metrics like revenue and costs.
CURRENT_RATIO (expect. >1.25) --> The current ratio measures a company’s ability to pay current, or short-term, liabilities (debt and payables) with its current, or short-term, assets (cash, inventory, and receivables). Current ratios over 1.00 indicate that a company's current assets are greater than its current liabilities, meaning it could more easily pay of short-term debts.
OPERATING_MARGIN(expect. >11) --> The operating margin measures how much profit a company makes on a dollar of sales after paying for variable costs of production, such as wages and raw materials, but before paying interest or tax. 
RETURN_CAPITAL (expect. >11) --> Return of capital (ROC) is a payment that an investor receives as a portion of their original investment and that is not considered income or capital gains from the investment. 
ALTMAN_Z_SCORE (expect. >1.8) --> The Altman Z-score is the output of a credit-strength test that gauges a publicly traded manufacturing company's likelihood of bankruptcy. An Altman Z-score close to 0 suggests a company might be headed for bankruptcy, while a score closer to 3 suggests a company is in solid financial positioning.
REVENUE_GROWTH (expect. >11) --> Quarterly revenue growth is an increase in a company's sales in one quarter compared to sales of a different quarter. Comparing a company's financials from one period to another gives a clear picture of its revenue growth rate and can help investors identify the catalyst for such growth.
SUSTAINABLE_GROWTH (expect. >11) --> The sustainable growth rate (SGR) is the maximum rate of growth that a company or social enterprise can sustain without having to finance growth with additional equity or debt. In other words, it is the rate at which the company can grow while using its own internal revenue without borrowing from outside sources.
DEBT TO INCOME (expect. <0.4) --> A debt-to-income (DTI) ratio is a financial metric used by lenders to determine your borrowing risk. Your DTI ratio represents the total amount of debt you owe compared to the total amount of money you earn each month. 
NORMALIZED ATR (expect. <8, W) --> The Normalized Average True Range (Normalized ATR) is an indicator used to measure market volatility by normalizing the average true range values. It does this by dividing the Average True Range (ATR) by the asset's closing price, converting it into a percentage. This normalization allows for the comparison of volatility levels across different securities or market conditions, regardless of the asset's price levels. The Normalized ATR helps traders to adjust their strategies based on relative volatility, rather than absolute price movements.
INDEX expect. EMA10>EMA20 --> it is expected to have EMA 10 > EMA 20 in weekly basis graph. It is known that having a strong trend in index will also increases chance of strong trend on stock levels. You need to select INDEX Market of stock via settings.
M. RELATIVE STRENGTH expect. MRS>1 --> Stan Weinstein uses the Mansfield RS indicator as another relative strength indicator. The indicator measures the variation in the 52-week ratio of stock and market.
VOLUME CHANGE (expect. >30) --> Having an increase on volume comparing to previous week can be a good sign if it occurs at the same time of breakout.
PRICE CHANGE (expect. >5 and <20) --> Having an increase on price comparing to previous week can be a good sign if it occurs at the same time of breakout.
It is better to look on weekly basis graphs.
Momentum Nexus Oscillator [UAlgo]The "Momentum Nexus Oscillator  " indicator is a comprehensive momentum-based tool designed to provide traders with visual cues on market conditions using multiple oscillators. By combining four popular technical indicators—RSI (Relative Strength Index), VZO (Volume Zone Oscillator), MFI (Money Flow Index), and CCI (Commodity Channel Index)—this heatmap offers a holistic view of the market's momentum.
The indicator plots two lines: one representing the current chart’s combined momentum score and the other representing a higher timeframe’s (HTF) score, if enabled. Through smooth gradient color transitions and easy-to-read signals, the Momentum Nexus Heatmap allows traders to easily identify potential trend reversals or continuation patterns.
Traders can use this tool to detect overbought or oversold conditions, helping them anticipate possible long or short trade opportunities. The option to use a higher timeframe enhances the flexibility of the indicator for longer-term trend analysis.
  
 🔶 Key Features 
 Multi-Oscillator Approach:  Combines four popular momentum oscillators (RSI, VZO, MFI, and CCI) to generate a weighted score, providing a comprehensive picture of market momentum.
  
 Dynamic Color Heatmap:  Utilizes a smooth gradient transition between bullish and bearish colors, reflecting market momentum across different thresholds.
 Higher Timeframe (HTF) Compatibility:  Includes an optional higher timeframe input that displays a separate score line based on the same momentum metrics, allowing for multi-timeframe analysis.
 Customizable Parameters:  Adjustable RSI, VZO, MFI, and CCI lengths, as well as overbought and oversold levels, to match the trader’s strategy or preference.
 Signal Alerts:  Built-in alert conditions for both the current chart and higher timeframe scores, notifying traders when long or short entry signals are triggered.
 Buy/Sell Signals:  Displays visual signals (▲ and ▼) on the chart when combined scores reach overbought or oversold levels, providing clear entry cues.
 User-Friendly Visualization:  The heatmap is separated into four sections representing each indicator, providing a transparent view of how each contributes to the overall momentum score.
 🔶 Interpreting Indicator: 
 Combined Score 
The indicator generates a combined score by weighing the individual contributions of RSI, VZO, MFI, and CCI. This score ranges from 0 to 100 and is plotted as a line on the chart. Lower values suggest potential oversold conditions, while higher values indicate overbought conditions.
 Color Heatmap 
The indicator divides the combined score into four distinct sections, each representing one of the underlying momentum oscillators (RSI, VZO, MFI, and CCI). Bullish (greenish) colors indicate upward momentum, while bearish (grayish) colors suggest downward momentum.
  
 Long/Short Signals 
When the combined score drops below the oversold threshold (default is 26), a long signal (▲) is displayed on the chart, indicating a potential buying opportunity.
When the combined score exceeds the overbought threshold (default is 74), a short signal (▼) is shown, signaling a potential sell or short opportunity.
  
 Higher Timeframe Analysis 
If enabled, the indicator also plots a line representing the combined score for a higher timeframe. This can be used to align lower timeframe trades with the broader trend of a higher timeframe, providing added confirmation.
Signals for long and short entries are also plotted for the higher timeframe when its combined score reaches overbought or oversold levels.
  
 🔶Purpose of Using Multiple Technical Indicators 
The combination of RSI, VZO, MFI, and CCI in the Momentum Nexus Heatmap provides a comprehensive approach to analyzing market momentum by leveraging the unique strengths of each indicator. This multi-indicator method minimizes the limitations of using just one tool, resulting in more reliable signals and a clearer understanding of market conditions.
 RSI (Relative Strength Index) 
RSI contributes by measuring the strength and speed of recent price movements. It helps identify overbought or oversold levels, signaling potential trend reversals or corrections. Its simplicity and effectiveness make it one of the most widely used indicators in technical analysis, contributing to momentum assessment in a straightforward manner.
 VZO (Volume Zone Oscillator) 
VZO adds the critical element of volume to the analysis. By assessing whether price movements are supported by significant volume, VZO distinguishes between price changes that are driven by real market conviction and those that might be short-lived. It helps validate the strength of a trend or alert the trader to potential weakness when price moves are unsupported by volume.
 MFI (Money Flow Index) 
MFI enhances the analysis by combining price and volume to gauge money flow into and out of an asset. This indicator provides insight into the participation of large players in the market, showing if money is pouring into or exiting the asset. MFI acts as a volume-weighted version of RSI, giving more weight to volume shifts and helping traders understand the sustainability of price trends.
 CCI (Commodity Channel Index) 
CCI contributes by measuring how far the price deviates from its statistical average. This helps in identifying extreme conditions where the market might be overextended in either direction. CCI is especially useful for spotting trend reversals or continuations, particularly during market extremes, and for identifying divergence signals.
 🔶 Disclaimer 
Use with Caution: This indicator is provided for educational and informational purposes only and should not be considered as financial advice. Users should exercise caution and perform their own analysis before making trading decisions based on the indicator's signals.
Not Financial Advice: The information provided by this indicator does not constitute financial advice, and the creator (UAlgo) shall not be held responsible for any trading losses incurred as a result of using this indicator.
Backtesting Recommended: Traders are encouraged to backtest the indicator thoroughly on historical data before using it in live trading to assess its performance and suitability for their trading strategies.
Risk Management: Trading involves inherent risks, and users should implement proper risk management strategies, including but not limited to stop-loss orders and position sizing, to mitigate potential losses.
No Guarantees: The accuracy and reliability of the indicator's signals cannot be guaranteed, as they are based on historical price data and past performance may not be indicative of future results.
Autotable█  OVERVIEW 
The library allows to automatically draw a table based on a string or float matrix (or both) controlling all of the parameters of the table (including merging cells) with parameter matrices (like, e.g. matrix of cell colors).   
All things you would normally do with table.new() and table.cell() are now possible using respective parameters of library's main function,  autotable()  (as explained further below).  
Headers can be supplied as arrays.
Merging of the cells is controlled with a special matrix of "L" and "U" values which instruct a cell to merged with the cell to the left or upwards (please see examples in the script and in this description).
█  USAGE EXAMPLES 
The simplest and most straightforward: 
 
mxF = matrix.new(3,3, 3.14)
mxF.autotable(bgcolor = color.rgb(249, 209, 29))  // displays float matrix as a table in the top right corner with defalult settings
mxS = matrix.new(3,3,"PI")
// displays string matrix as a table in the top right corner with defalult settings
mxS.autotable(Ypos = "bottom", Xpos = "right", bgcolor = #b4d400)  
// displays matrix displaying a string value over a float value in each cell
mxS.autotable(mxF, Ypos = "middle", Xpos = "center", bgcolor = color.gray, text_color = #86f62a)  
 
Draws this: 
Tables with headers: 
 
if barstate.islast 
    mxF = matrix.new(3,3, 3.14)
    mxS = matrix.new(3,3,"PI")
    arColHeaders = array.from("Col1", "Col2", "Col3")
    arRowHeaders = array.from("Row1", "Row2", "Row3")
    // float matrix with col headers
    mxF.autotable(
              bgcolor = #fdfd6b
              , arColHeaders = arColHeaders
              )  
    // string matrix with row headers
    mxS.autotable(arRowHeaders = arRowHeaders, Ypos = "bottom", Xpos = "right", bgcolor = #b4d400)  
    // string/float matrix with both row and column headers
    mxS.autotable(mxF
              , Ypos = "middle", Xpos = "center"
              , arRowHeaders = arRowHeaders
              , arColHeaders = arColHeaders
              , cornerBgClr = #707070, cornerTitle = "Corner\ncell", cornerTxtClr = #ffdc13
              , bgcolor = color.gray, text_color = #86f62a
              )  
 
Draws this: 
█  FUNCTIONS 
One main function is  autotable()  which has only one required argument mxValS, a string matrix.
Please see below the description of all of the function parameters:
The table: 
   tbl (table)   (Optional) If supplied, this table will be deleted.
The data:
   mxValS (matrix )  (Required) Cell text values        
   mxValF (matrix)    (Optional) Numerical part of cell text values. Is concatenated to the mxValS values via `string_float_separator` string (default "\n")     
Table properties, have same effect as in  table.new() :
   defaultBgColor (color)    (Optional) bgcolor to be used if mxBgColor is not supplied             
   Ypos (string)     (Optional) "top", "bottom" or "center" 
   Xpos (string)     (Optional) "left", "right", or "center"
   frame_color (color)   (Optional) frame_color  like in table.new()          
   frame_width (int)     (Optional) frame_width  like in table.new()         
   border_color (color)  (Optional) border_color like in table.new()         
   border_width (int)    (Optional) border_width like in table.new()         
   force_overlay (simple bool)   (Optional) If true draws table on main pane.          
Cell parameters, have same effect as in  table.cell() ):
   mxBgColor (matrix)     (Optional) like bgcolor argument in table.cell()
   mxTextColor (matrix)   (Optional) like text_color argument in table.cell()     
   mxTt (matrix)     (Optional) like tooltip argument in table.cell()
   mxWidth (matrix)   (Optional) like width argument in table.cell()
   mxHeight (matrix)  (Optional) like height argument in table.cell()
   mxHalign (matrix)     (Optional) like text_halign argument in table.cell()     
   mxValign (matrix)     (Optional) like text_valign argument in table.cell()          
   mxTextSize (matrix)   (Optional) like text_size argument in table.cell()
   mxFontFamily (matrix)     (Optional) like text_font_family argument in table.cell()         
Other table properties:
   tableWidth (float)    (Optional) Overrides table width if cell widths are non zero. E.g. if there are four columns  and cell widths are 20 (either as set via cellW or via mxWidth) then if tableWidth is set to e.g. 50 then cell widths will be 50 * (20 / 80), where 80 is 20*4 = total width of all cells. Works simialar for widths set via mxWidth - determines max sum of widths across all cloumns of mxWidth and adjusts cell widths proportionally to it. If cell widths are 0 (i.e. auto-adjust) tableWidth has no effect.         
   tableHeight (float)  (Optional) Overrides table height if cell heights are non zero. E.g. if there are four rows and cell heights are 20 (either as set via cellH or via mxHeight) then if tableHeigh is set to e.g. 50 then cell heights will be 50 * (20 / 80), where 80 is 20*4 = total height of all cells. Works simialar for heights set via mxHeight - determines max sum of heights across all cloumns of mxHeight and adjusts cell heights proportionally to it. If cell heights are 0 (i.e. auto-adjust) tableHeight has no effect.   
   defaultTxtColor (color)   (Optional) text_color to be used if mxTextColor is not supplied
   text_size (string)    (Optional) text_size to be used if mxTextSize is not supplied                  
   font_family (string)  (Optional) cell text_font_family value to be used if a value in mxFontFamily is no supplied                     
   cellW (float)     (Optional) cell width to be used if a value in mxWidth is no supplied  
   cellH (float)     (Optional) cell height to be used if a value in mxHeight is no supplied   
   halign (string)   (Optional) cell text_halign value to be used if a value in mxHalign is no supplied       
   valign (string)   (Optional) cell text_valign value to be used if a value in mxValign is no supplied            
Headers parameters:
   arColTitles (array)   (Optional) Array of column titles. If not na a header row is added.          
   arRowTitles (array)   (Optional) Array of row titles. If not na a header column is added.          
   cornerTitle (string)  (Optional) If both row and column titles are supplied allows to set the value of the corner cell.           
   colTitlesBgColor (color)  (Optional) bgcolor for header row
   colTitlesTxtColor (color)     (Optional) text_color for header row
   rowTitlesBgColor (color)  (Optional) bgcolor for header column             
   rowTitlesTxtColor (color)     (Optional) text_color for header column             
   cornerBgClr (color)   (Optional) bgcolor for the corner cell
   cornerTxtClr (color)  (Optional) text_color for the corner cell
Cell merge parameters: 
   mxMerge (matrix)  (Optional) A matrix determining how cells will be merged. "L" - cell merges to the left, "U" - upwards.     
   mergeAllColTitles (bool)  (Optional) Allows to print a table title instead of column headers, merging all header row cells and leaving just the value of the first cell. For more flexible options use matrix arguments leaving header/row arguments na.
   mergeAllRowTitles (bool)  (Optional) Allows to print one text value merging all header row cells and leaving just the value of the first cell. For more flexible options use matrix arguments leaving header/row arguments na.
Format: 
   string_float_separator (string)   (Optional) A string used to separate string and float parts of cell values (mxValS and mxValF). Default is "\n"                    
   format (string)   (Optional) format string like in str.format() used to format numerical values     
   nz (string)   (Optional) Determines how na numerical values are displayed.   
The only other available function is  autotable(string,... )  with a string parameter instead of string and float matrices which draws a one cell table. 
█  SAMPLE USE 
E.g.,  CSVParser  library demo uses Autotable's for generating complex tables with merged cells.
█  CREDITS 
The library was inspired by @kaigouthro's  matrixautotable . A true master. Many thanks to him for his creative, beautiful and very helpful libraries. 
Ultra Money FlowIntroduction 
The  Ultra Money Flow  script is a technical indicator for analyzing stock trends. It highlights buying and selling power, helping you identify bullish (rising) or bearish (falling) market trends.
 Detailed Description 
The  Ultra Money Flow  script calculates and visually displays two main components: Fast and Slow money flow. These components represent short-term and long-term trends, respectively.
Here's how it works:
.........
 
 Inputs 
 You can adjust the speed of analysis (Fast Length and Slow Length) and the type of smoothing applied (e.g., Simple Moving Average, Exponential Moving Average). 
 Choose colors for visualizing the trends, with blue for bullish (positive) and orange for bearish (negative) movements. 
.....
 Money Flow Calculation 
 The script analyzes price changes (delta) over specified periods. 
 It separates upward price movements (buying power) from downward ones (selling power). 
 It then calculates the difference between these powers for both Fast and Slow components. 
 The types of smoothing methods range from traditional ones like the Simple Moving Average (SMA) to advanced ones like the Double Expotential Moving Average (DEMA) or the Triple Exponential Moving Average (TEMA) or the Recursive Moving Average (RMA) or the Weigthend Moving Average (WMA) or the Volume Weigthend Moving Average (VWMA) or Hull Moving Average (HMA). 
 Very Special ones are the Triple Weigthend Moving Average (TWMA) wich created  RedKTrader .
I created the Multi Weigthend Moving Average (MWMA) wich is a simple signal line to the TWMA. 
.....
 Divergence 
 This indicator can show divergence by comparing the direction of price movements with the indicator value. 
 If the price and the indicator move in opposite directions, you can use these signals to help decide when to buy or sell. 
.....
 Auto Scaling 
 The script adjusts its calculations based on the time frame you are viewing, whether it's minutes, hours, or days, ensuring accurate representation across different time scales. 
.....
 Plotting 
 The script plots the Fast component as a histogram and the Slow component as a line, using the chosen colors to indicate bullish or bearish trends. 
 The thickness and transparency of these plots give additional clues about the strength of the trend. 
 
.........
By using this indicator, traders can easily spot shifts in buying and selling power, allowing for better-informed decisions in the market.
 Special Thanks 
I use the TWMA-Function created from  RedKTrader  to smooth the values.
 Special thanks to him for creating and sharing this function!
Descriptive Backtesting Framework (DBF)As the name suggests, this is a backtesting framework made to offer full backtesting functionality to any custom indicator in a visually descriptive way.
Any trade taken will be very clear to visualize on the chart and the equity line will be updated live allowing us to use the REPLAY feature to view the strategy performing in real time.
Stops and Targets will also get draw on the chart with labels and tooltips and there will be a table on the top right corner displaying lots of descriptive metrics to measure your strategy's performance.
IF YOU DECIDE TO USE THIS FRAMEWORK,  PLEASE READ **EVERYTHING** BELOW 
 HOW TO USE IT 
 Step 1 - Insert Your Strategy Indicators: 
Inside this framework's code, right at the beginning, you will find a dedicated section where you can manually insert any set of indicators you desire.
Just replace the example code in there with your own strategy indicators.
 Step 2 - Specify The Conditions To Take Trades: 
After that, there will be another section where you need to specify your strategy's conditions to enter and exit trades.
When met, those conditions will fire the trading signals to the trading engine inside the framework.
If you don't wish to use some of the available signals, please just assign  false  to the signal. 
DO NOT DELETE THE SIGNAL VARIABLES
 Step 3 - Specify Entry/Exit Prices, Stops & Targets: 
Finally you'll reach the last section where you'll be able to specify entry/exit prices as well as add stops and targets.
On most cases, it's easier and more reliable to just use the close price to enter and exit trades.
If you decide to use the open price instead, please remember to change step 2 so that trades are taken on the open price of the next candle and not the present one to avoid the look ahead bias.
Stops and targets can be set in any way you want.
Also, please don't forget to update the spread. If your broker uses commissions instead of spreads or a combination of both, you'll need to manually incorporate those costs in this step.
 And that's it! That's all you have to do. 
Below this section you'll now see a sign warning you about not making any changes to the code below. 
From here on, the framework will take care of executing the trades and calculating the performance metrics for you and making sure all calculations are consistent.
 VISUAL FEATURES: 
Price candles get painted according to the current trade.
They will be blue during long trades, purple on shorts and white when no trade is on.
When the framework receives the signals to start or close a trade, it will display those signals as shapes on the upper and lower limits of the chart:
 
  DIAMOND: represents a signal to open a trade, the trade direction is represented by the shape's color;
  CROSS: means a stop loss was triggered;
  FLAG: means a take profit was triggered;
  CIRCLE: means an exit trade signal was fired;
 
Hovering the mouse over the trade labels will reveal: 
 
 Asset Quantity;
 Entry/Exit Prices;
 Stops & Targets;
 Trade Profit;
  Profit As Percentage Of Trade Volume;
 
 **Please note that there's a limit as to how many labels can be drawn on the chart at once.** 
If you which to see labels from the beginning of the chart, you'll probably need to use the replay feature.
 PERFORMANCE TABLE: 
The performance table displays several performance metrics to evaluate the strategy.
All the performance metrics here are calculated by the framework. It does not uses the oficial pine script strategy tester.
All metrics are calculated in real time. If using the replay feature, they will be updated up to the last played bar.
Here are the available metrics and their definition:
 
  INITIAL EQUITY: the initial amount of money we had when the strategy started, obviously...;
  CURRENT EQUITY: the amount of money we have now. If using the replay feature, it will show the current equity up to the last bar played. The number on it's right side shows how many times our equity has been multiplied from it's initial value;
  TRADE COUNT: how many trades were taken;
  WIN COUNT: how many of those trades were wins. The percentage at the right side is the strategy WIN RATE;
  AVG GAIN PER TRADE: the average percentage gain per trade. Very small values can indicate a fragile strategy that can behave in unexpected ways under high volatility conditions;
  AVG GAIN PER WIN: the average percentage gain of trades that were profitable;
  AVG GAIN PER LOSS: the average percentage loss on trades that were not profitable;
  EQUITY MAX DD: the maximum drawdown experienced by our equity during the entire strategy backtest;
  TRADE MAX DD: the maximum drawdown experienced by our equity after one single trade;
  AVG MONTHLY RETURN: the compound monthly return that our strategy was able to create during the backtested period;
  AVG ANNUAL RETURN: this is the strategy's CAGR (compound annual growth rate);
  ELAPSED MONTHS: number of months since the backtest started;
  RISK/REWARD RATIO: shows how profitable the strategy is for the amount of risk it takes. Values above 1 are very good (and rare). This is calculated as follows: (Avg Annual Return) / mod(Equity Max DD). Where mod() is the same as math.abs();
 
 AVAILABLE SETTINGS: 
 
 SPREAD: specify your broker's asset spread
 ENABLE LONGS / SHORTS: you can keep both enable or chose to take trades in only one direction
 MINIMUM BARS CLOSED: to avoid trading before indicators such as a slow moving average have had time to populate, you can manually set the number of bars to wait before allowing trades.
  INITIAL EQUITY: you can specify your starting equity
  EXPOSURE: is the percentage of equity you wish to risk per trade. When using stops, the strategy will automatically calculate your position size to match the exposure with the stop distance. If you are not using stops then your trade volume will be the percentage of equity specified here. 100 means you'll enter trades with all your equity and 200 means you'll use a 2x leverage.
  MAX LEVERAGE ALLOWED: In some situations a short stop distance can create huge levels of leverage. If you want to limit leverage to a maximum value you can set it here.
  SEVERAL PLOTTING OPTIONS: You'll be able to specify which of the framework visuals you wish to see drawn on the chart.
 
 FRAMEWORK **LIMITATIONS**: 
 
  When stop and target are both triggered in the same candle, this framework isn't able to enter faster timeframes to check which one was triggered first, so it will take the pessimistic assumption and annul the take profit signal;
  This framework doesn't support pyramiding;
  This framework doesn't support both long and short positions to be active at the same time. So for example, if a short signal is received while a long trade is open, the framework will close the long trade and then open a short trade;
 
 FINAL CONSIDERATIONS: 
I've been using this framework for a good time and I find it's better to use and easier to analyze a strategy's performance then relying on the oficial pine script strategy tester. However, I CANNOT GUARANTEE IT TO BE BUG FREE.
 **PLEASE PERFORM A MANUAL BACKTEST BEFORE USING ANY STRATEGY WITH REAL MONEY**
Price Action Smart Money Concepts [BigBeluga]THE SMART MONEY CONCEPTS  Toolkit
 The Smart Money Concepts   [ BigBeluga ] is a comprehensive toolkit built around the principles of "smart money" behavior, which refers to the actions and strategies of institutional investors.
The Smart Money Concepts Toolkit brings together a suite of advanced indicators that are all interconnected and built around a unified concept: understanding and trading like institutional investors, or "smart money." These indicators are not just randomly chosen tools; they are features of a single overarching framework, which is why having them all in one place creates such a powerful system. 
This all-in-one toolkit provides the user with a unique experience by automating most of the basic and advanced concepts on the chart, saving them time and improving their trading ideas.
 
  Real-time market structure analysis simplifies complex trends by pinpointing key support, resistance, and breakout levels.
  Advanced order block analysis leverages detailed volume data to pinpoint high-demand zones, revealing internal market sentiment and predicting potential reversals. This analysis utilizes bid/ask zones to provide supply/demand insights, empowering informed trading decisions.
  Imbalance Concepts (FVG and Breakers) allows traders to identify potential market weaknesses and areas where price might be attracted to fill the gap, creating opportunities for entry and exit.
  Swing failure patterns help traders identify potential entry points and rejection zones based on price swings.
  Liquidity Concepts, our advanced liquidity algorithm, pinpoints high-impact events, allowing you to predict market shifts, strong price reactions, and potential stop-loss hunting zones. This gives traders an edge to make informed trading decisions based on liquidity dynamics.
 
🔵  FEATURES 
The indicator has quite a lot of features that are provided below:
 
  Swing market structure
  Internal market structure
  Mapping structure
  Adjustable market structure
  Strong/Weak H&L
  Sweep
  Volumetric Order block / Breakers
  Fair Value Gaps / Breakers (multi-timeframe)
  Swing Failure Patterns (multi-timeframe)
  Deviation area
  Equal H&L
  Liquidity Prints
  Buyside & Sellside
  Sweep Area
  Highs and Lows (multi-timeframe)
 
🔵  BASIC DEMONSTRATION OF ALL FEATURES 
1. MARKET STRUCTURE
  
The preceding image illustrates the market structure functionality within the Smart Money Concepts indicator.
➤ Solid lines: These represent the core indicator's internal structure, forming the foundation for most other components. They visually depict the overall market direction and identify major reversal points marked by significant price movements (denoted as 'x').
➤ Internal Structure: These represent an alternative internal structure with the potential to drive more rapid market shifts. This is particularly relevant when a significant gap exists in the established swing structure, specifically between the Break of Structure (BOS) and the most recent Change of High/Low (CHoCH). Identifying these formations can offer opportunities for quicker entries and potential short-term reversals.
  
➤ Sweeps (x): These signify potential turning points in the market where liquidity is removed from the structure. This suggests a possible trend reversal and presents crucial entry opportunities. Sweeps are identified within both swing and internal structures, providing valuable insights for informed trading decisions.
  
➤ Mapping structure: A tool that automatically identifies and connects significant price highs and lows, creating a zig-zag pattern. It visualizes market structure, highlights trends, support/resistance levels, and potential breakouts. Helps traders quickly grasp price action patterns and make informed decisions.
  
➤ Color-coded candles based on market structure: These colors visually represent the underlying market structure, making it easier for traders to quickly identify trends. 
  
➤ Extreme H&L: It visualizes market structure with extreme high and lows, which gives perspective for macro Market Structure.
  
2. VOLUMETRIC ORDER BLOCKS
Order blocks are specific areas on a financial chart where significant buying or selling activity has occurred. These are not just simple zones; they contain valuable information about market dynamics. Within each of these order blocks, volume bars represent the actual buying and selling activity that took place. These volume bars offer deeper insights into the strength of the order block by showing how much buying or selling power is concentrated in that specific zone.
Additionally, these order blocks can be transformed into Breaker Blocks. When an order block fails—meaning the price breaks through this zone without reversing—it becomes a breaker block. Breaker blocks are particularly useful for trading breakouts, as they signal that the market has shifted beyond a previously established zone, offering opportunities for traders to enter in the direction of the breakout. 
Here's a breakdown:
➤ Bear Order Blocks (Red): These are zones where a lot of selling happened. Traders see these areas as places where sellers were strong, pushing the price down. When the price returns to these zones, it might face resistance and drop again.
➤ Bull Order Blocks (Green): These are zones where a lot of buying happened. Traders see these areas as places where buyers were strong, pushing the price up. When the price returns to these zones, it might find support and rise again.
  
These Order Blocks help traders identify potential areas for entering or exiting trades based on past market activity. The volume bars inside blocks show the amount of trading activity that occurred in these blocks, giving an idea of the strength of buying or selling pressure.
➤ Breaker Block: When an order block fails, meaning the price breaks through this zone without reversing, it becomes a breaker block. This indicates a significant shift in market liquidity and structure.
  
➤ A bearish breaker block occurs after a bullish order block fails. This typically happens when there's an upward trend, and a certain level that was expected to support the market's rise instead gives way, leading to a sharp decline. This decline indicates that sellers have overcome the buyers, absorbing liquidity and shifting the sentiment from bullish to bearish. 
  
Conversely, a bullish breaker block is formed from the failure of a bearish order block. In a downtrend, when a level that was expected to act as resistance is breached, and the price shoots up, it signifies that buyers have taken control, overpowering the sellers. 
3. FAIR VALUE GAPS:
A fair value gap (FVG), also referred to as an imbalance, is an essential concept in Smart Money trading. It highlights the supply and demand dynamics. This gap arises when there's a notable difference between the volume of buy and sell orders. FVGs can be found across various asset classes, including forex, commodities, stocks, and cryptocurrencies. 
  
FVGs in this toolkit have the ability to detect raids of FVG which helps to identify potential price reversals. 
  
Mitigation option helps to change from what source FVGs will be identified: Close, Wicks or AVG.
4. SWING FAILURE PATTERN (SFP): 
The Swing Failure Pattern is a liquidity engineering pattern, generally used to fill large orders. This means, the SFP generally occurs when larger players push the price into liquidity pockets with the sole objective of filling their own positions. 
SFP is a technical analysis tool designed to identify potential market reversals. It works by detecting instances where the price briefly breaks a previous high or low but fails to maintain that breakout, quickly reversing direction.
How it works:
 
  Pattern Detection: The indicator scans for price movements that breach recent highs or lows.
  Reversal Confirmation: If the price quickly reverses after breaching these levels, it's identified as an SFP.
 
➤ SFP Display: 
  Bullish SFP: Marked with a green symbol when price drops below a recent low before reversing upwards.
  Bearish SFP: Marked with a red symbol when price rises above a recent high before reversing downwards.
  
➤ Deviation Levels: After detecting an SFP, the indicator projects white lines showing potential price deviation:
  For bullish SFPs, the deviation line appears above the current price.
  For bearish SFPs, the deviation line appears below the current price.
 
  
These deviation levels can serve as a potential trading opportunity or areas where the reversal might lose momentum.
With Volume Threshold and Filtering of SFP traders can adjust their trading style:
 
  Volume Threshold: This setting allows traders to filter SFPs based on the volume of the reversal candle. By setting a higher volume threshold, traders can focus on potentially more significant reversals that are backed by higher trading activity. 
  SFP Filtering: This feature enables traders to filter SFP detection. It includes parameters such as:
 
  
5. LIQUIDITY CONCEPTS:
➤ Equal Lows (EQL) and Equal Highs (EQH) are important concepts in liquidity-based trading.
 
  EQL: A series of two or more swing lows that occur at approximately the same price level. 
  EQH: A series of two or more swing highs that occur at approximately the same price level. 
 
  
EQLs and EQHs are seen as potential liquidity pools where a large number of stop loss orders or limit orders may be clustered. They can be used as potential reverse points for trades. 
  
This multi-period feature allows traders to select less and more significant EQL and EQH:
➤ Liquidity wicks: 
Liquidity wicks are a minor representation of a stop-loss hunt during the retracement of a pivot point:
  
➤ Buy and Sell side liquidity:
 
  The buy side liquidity represents a concentration of potential buy orders below the current price level. When price moves into this area, it can lead to increased buying pressure due to the execution of these orders. 
  The sell side liquidity indicates a pool of potential sell orders below the current price level. Price movement into this area can result in increased selling pressure as these orders are executed. 
 
  
➤ Sweep Liquidation Zones:
Sweep Liquidation Zones are crucial for understanding market structure and potential future price movements. They provide insights into areas where significant market participants have been forced out of their positions, potentially setting up new trading opportunities. 
  
🔵  USAGE & EXAMPLES 
The core principle behind the success of this toolkit lies in identifying "confluence." This refers to the convergence of multiple trading indicators all signaling the same information at a specific point or area. By seeking such alignment, traders can significantly enhance the likelihood of successful trades.
 MS + OBs 
  
The chart illustrates a highly bullish setup where the price is rejecting from a bullish order block (POC), while simultaneously forming a bullish Swing Failure Pattern (SFP). This occurs after an internal structure change, marked by a bullish Change of Character (CHoCH). The price broke through a bearish order block, transforming it into a breaker block, further confirming the bullish momentum.
The combination of these elements—bullish order blocks, SFP, and CHoCH—creates a powerful bullish signal, reinforcing the potential for upward movement in the market.
 SFP + Bear OB 
  
This chart above displays a bearish setup with a high probability of a price move lower. The price is currently rejecting from a bear order block, which represents a key resistance area where significant selling pressure has previously occurred. A Swing Failure Pattern (SFP) has also formed near this bear order block, indicating that the price briefly attempted to break above a recent high but failed to sustain that upward movement. This failure suggests that buyers are losing momentum, and the market could be preparing for a move to the downside. 
Additionally, we can toggle on the Deviation Area in the SFP section to highlight potential levels where price deviation might occur. These deviation areas represent zones where the price is likely to react after the Swing Failure Pattern:
  
 BUY – SELL sides + EQL 
  
The chart showcases a bullish setup with a high probability of price breaking out of the current sell-side resistance level. The market structure indicates a formation of Equal Lows (EQL), which often suggests a build-up of liquidity that could drive the price higher.
The presence of strong buy-side pressure (69%), indicated by the green zone at the bottom, reinforces this bullish outlook. This area represents a key support zone where buyers are outpacing sellers, providing the foundation for a potential upward breakout.
 EQL + Bull ChoCh 
  
This chart illustrates a potential bullish setup, driven by the formation of Equal Lows (EQL) followed by a bullish Change of Character (CHoCH). The presence of Equal Lows often signals a liquidity build-up, which can lead to a reversal when combined with additional bullish signals. 
 Liquidity grab + Bull ChoCh + FVGs 
  
This chart demonstrates a strong bullish scenario, where several important market dynamics are at play. The price begins its upward momentum from Liquidity grab following a bullish Change of Character (CHoCH), signaling the transition from a bearish phase to a bullish one.
As the price progresses, it performs liquidity grabs, which serve to gather the necessary fuel for further movement. These liquidity grabs often occur before significant price surges, as large market participants exploit these areas to accumulate positions before pushing the price higher.
The chart also highlights a market imbalance area, showing strong momentum as the price moves swiftly through this zone.
In this examples, we see how the combination of multiple “smart money” tools helps identify a potential trade opportunities. This is just one of the many scenarios that traders can spot using this toolkit. Other combinations—such as order blocks, liquidity grabs, fair value gaps, and Swing Failure Patterns (SFPs)—can also be layered on top of these concepts to further refine your trading strategy. 
🔵  SETTINGS 
 
  Window: limit calculation period
  Swing: limit drawing function
  Mapping structure: show structural points
  Algorithmic Logic: (Extreme-Adjusted) Use max high/low or pivot point calculation
  Algorithmic loopback: pivot point look back
  Show Last: Amount of Order block to display
  Hide Overlap: hide overlapping order blocks
  Construction: Size of the order blocks
  Fair value gaps: Choose between normal FVG or Breaker FVG
  Mitigation: (close - wick - avg) point to mitigate the order block/imbalance
  SFP lookback: find a higher / lower point to improve accuracy
  Threshold: remove less relevant SFP
  Equal H&L: (short-mid-long term) display longer term
  Liquidity Prints: Shows wicks of candles where liquidity was grabbed
  Sweep Area: Identify Sweep Liquidation areas
 
By combining these indicators in one toolkit, traders are equipped with a comprehensive suite of tools that address every angle of the Smart Money Concept. Instead of relying on disparate tools spread across various platforms, having them integrated into a single, cohesive system allows traders to easily see confluence and make more informed trading decisions. 
VWAP Bands [TradingFinder] 26 Brokers Data (Forex + Crypto)🔵 Introduction 
Indicators are tools that help analysts predict the price trend of a stock through mathematical calculations on price or trading volume. It is evident that trading volume significantly impacts the price trend of a stock symbol. 
The Volume-Weighted Average Price (VWAP) indicator combines the influence of trading volume and price, providing technical analysts with a practical tool. 
This technical indicator determines the volume-weighted average price of a symbol over a specified time period. Consequently, this indicator can be used to identify trends and entry or exit points.
🟣 Calculating the VWAP Indicator 
Adding the VWAP indicator to a chart will automatically perform all calculations for you. However, if you wish to understand how this indicator is calculated, the following explains the steps involved.
Consider a 5-minute chart. In the first candle of this chart (which represents price information in the first 5 minutes), sum the high, low, and close prices, and divide by 3. Multiply the resulting number by the volume for the period and call it a variable (e.g., X). 
Then, divide the resulting output by the total volume for that period to calculate your VWAP. To maintain the VWAP sequence throughout the trading day, it is necessary to add the X values obtained from each period to the previous period and divide by the total volume up to that time. It is worth noting that the calculation method is the same for intervals shorter than a day.
 The mathematical formula for this VWAP indicator :  VWAP  =  ∑ (Pi×Vi) / ∑ Vi
  
🔵 How to Use 
Traders might consider the VWAP indicator as a tool for predicting trends. For example, they might buy a stock when the price is above the VWAP level and sell it when the price is below the VWAP. 
In other words, when the price is above the VWAP, the price is rising, and when it is below the VWAP, the price is falling. Major traders and investment funds also use the VWAP ratio to help enter or exit stocks with the least possible market impact.
It is important to note that one should not rely solely on the VWAP indicator when analyzing symbols. This is because if prices rise quickly, the VWAP indicator may not adequately describe the conditions. This indicator is generally used for daily or shorter time frames because using longer intervals can distort the average.
Since this indicator uses past data in its calculations, it can be considered a lagging indicator. As a result, the more data there is, the greater the delay.
🟣 Difference Between VWAP and Simple Moving Average 
On a chart, the VWAP and the simple moving average may look similar, but these two indicators have different calculations. The VWAP calculates the total price considering volume, while the simple moving average does not consider volume. 
In simpler terms, the VWAP indicator measures each day's price change relative to the trading volume that occurred that day. In contrast, the simple moving average implicitly assumes that all trading days have the same volume.
🟣 Reasons Why Traders Like the VWAP Indicator 
 
 The VWAP Considers Volume: Since VWAP takes volume into account, it can be more reliable than a simple arithmetic average of prices. Theoretically, one person can buy 200,000 shares of a symbol in one transaction at a single price.
 However, during the same time frame, 100 other people might place 200 different orders at various prices that do not total 100,000 shares. In this case, if you only consider the average price, you might be mistaken because trading volume is ignored.
 The Indicator Can Help Day Traders: While reviewing your trades, you might notice that the shares you bought at market price are trading below the VWAP indicator. 
In this case, there's no need to worry because with the help of VWAP, you always get a price below the average. By knowing the volume-weighted average price of a stock, you can easily make an informed decision about paying more or less than other traders for the stock.
 VWAP Can Signal Market Trend Changes: Buying low and selling high can be an excellent strategy for individuals. However, you are looking to buy when prices start to rise and sell your shares when prices start to fall.
 Since the VWAP indicator simulates a balanced price in the market, when the price crosses above the VWAP line, one can assume that traders are willing to pay more to acquire shares, and as a result, the market will grow. Conversely, when the price crosses below the line, this can be considered a sign of a downward movement.
 
🔵 Setting  
 Period : Indicator calculation time frame.
 Source : The Price used for calculations.
 Market Ultra Data : If you turn on this feature, 26 large brokers will be included in the calculation of the trading volume. 
The advantage of this capability is to have more reliable volume data. You should be careful to specify the market you are in, FOREX brokers and Crypto brokers are different.
 Multiplier : Coefficient of band lines.
Harmonic Patterns Library [TradingFinder]🔵 Introduction 
Harmonic patterns blend geometric shapes with Fibonacci numbers, making these numbers fundamental to understanding the patterns.
One person who has done a lot of research on harmonic patterns is Scott Carney.Scott Carney's research on harmonic patterns in technical analysis focuses on precise price structures based on Fibonacci ratios to identify market reversals. 
Key patterns include the Gartley, Bat, Butterfly, and Crab, each with specific alignment criteria. These patterns help traders anticipate potential market turning points and make informed trading decisions, enhancing the predictability of technical analysis.
🟣 Understanding 5-Point Harmonic Patterns 
In the current library version, you can easily draw and customize most XABCD patterns. These patterns often form M or W shapes, or a combination of both. By calculating the Fibonacci ratios between key points, you can estimate potential price movements. 
All five-point patterns share a similar structure, differing only in line lengths and Fibonacci ratios. Learning one pattern simplifies understanding others.
  
🟣 Exploring the Gartley Pattern 
The Gartley pattern appears in both bullish (M shape) and bearish (W shape) forms. In the bullish Gartley, point X is below point D, and point A surpasses point C. Point D marks the start of a strong upward trend, making it an optimal point to place a buy order. 
The bearish Gartley mirrors the bullish pattern with inverted Fibonacci ratios. In this scenario, point D indicates the start of a significant price drop. Traders can place sell orders at this point and buy at lower prices for profit in two-way markets.
🟣 Analyzing the Butterfly Pattern 
The Butterfly pattern also manifests in bullish (M shape) and bearish (W shape) forms. It resembles the Gartley pattern but with point D lower than point X in the bullish version. 
The Butterfly pattern involves deeper price corrections than the Gartley, leading to more significant price fluctuations. Point D in the bullish Butterfly indicates the beginning of a sharp price rise, making it an entry point for buy orders. 
The bearish Butterfly has inverted Fibonacci ratios, with point D marking the start of a sharp price decline, ideal for sell orders followed by buying at lower prices in two-way markets.
🟣 Insights into the Bat Pattern 
The Bat pattern, appearing in bullish (M shape) and bearish (W shape) forms, is one of the most precise harmonic patterns. It closely resembles the Butterfly and Gartley patterns, differing mainly in Fibonacci levels. 
The bearish Bat pattern shares the Fibonacci ratios with the bullish Bat, with an inverted structure. Point D in the bearish Bat marks the start of a significant price drop, suitable for sell orders followed by buying at lower prices for profit.
🟣 The Crab Pattern Explained 
The Crab pattern, found in both bullish (M shape) and bearish (W shape) forms, is highly favored by analysts. Discovered in 2000, the Crab pattern features a larger final wave correction compared to other harmonic patterns. 
The bearish Crab shares Fibonacci ratios with the bullish version but in an inverted form. Point D in the bearish Crab signifies the start of a sharp price decline, making it an ideal point for sell orders followed by buying at lower prices for profitable trades.
🟣 Understanding the Shark Pattern 
The Shark pattern appears in bullish (M shape) and bearish (W shape) forms. It differs from previous patterns as point C in the bullish Shark surpasses point A, with unique level measurements. 
The bearish Shark pattern mirrors the Fibonacci ratios of the bullish Shark but is inverted. Point D in the bearish Shark indicates the start of a sharp price drop, ideal for placing sell orders and buying at lower prices to capitalize on the pattern.
🟣 The Cypher Pattern Overview 
The Cypher pattern is another that appears in both bullish (M shape) and bearish (W shape) forms. It resembles the Shark pattern, with point C in the bullish Cypher extending beyond point A, and point D forming within the XA line. 
The bearish Cypher shares the Fibonacci ratios with the bullish Cypher but in an inverted structure. Point D in the bearish Cypher marks the start of a significant price drop, perfect for sell orders followed by buying at lower prices.
🟣 Introducing the Nen-Star Pattern 
The Nen-Star pattern appears in both bullish (M shape) and bearish (W shape) forms. In the bullish Nen-Star, point C extends beyond point A, and point D, the final point, forms outside the XA line, making CD the longest wave. 
The bearish Nen-Star has inverted Fibonacci ratios, with point D indicating the start of a significant price drop. Traders can place sell orders at point D and buy at lower prices to profit from this pattern in two-way markets.
The 5-point harmonic patterns, commonly referred to as XABCD patterns, are specific geometric price structures identified in financial markets. These patterns are used by traders to predict potential price movements based on historical price data and Fibonacci retracement levels. 
 Here are the main 5-point harmonic patterns :
 
 Gartley Pattern
 Anti-Gartley Pattern
 Bat Pattern
 Anti-Bat Pattern
 Alternate Bat Pattern
 Butterfly Pattern
 Anti-Butterfly Pattern
 Crab Pattern	
 Anti-Crab Pattern
 Deep Crab Pattern
 Shark Pattern
 Anti- Shark Pattern
 Anti Alternate Shark Pattern
 Cypher Pattern
 Anti-Cypher Pattern
 
 
🔵 How to Use 
To add "Order Block Refiner Library", you must first add the following code to your script.
 import TFlab/Harmonic_Chart_Pattern_Library_TradingFinder/1 as HP 
🟣 Parameters 
 XABCD(Name, Type, Show, Color, LineWidth, LabelSize, ShVF, FLPC, FLPCPeriod, Pivot, ABXAmin, ABXAmax, BCABmin, BCABmax, CDBCmin, CDBCmax, CDXAmin, CDXAmax) =>
Parameters: 
Name (string) 
Type (string) 
Show (bool) 
Color (color) 
LineWidth (int) 
LabelSize (string) 
ShVF (bool) 
FLPC (bool) 
FLPCPeriod (int) 
Pivot (int) 
ABXAmin (float) 
ABXAmax (float) 
BCABmin (float) 
BCABmax (float) 
CDBCmin (float) 
CDBCmax (float) 
CDXAmin (float) 
CDXAmax (float)
 
🟣 Genaral Parameters 
 Name : The name of the pattern.
 Type:  Enter "Bullish" to draw a Bullish pattern and "Bearish" to draw an Bearish pattern.
 Show : Enter "true" to display the template and "false" to not display the template.
 Color : Enter the desired color to draw the pattern in this parameter.
 LineWidth : You can enter the number 1 or numbers higher than one to adjust the thickness of the drawing lines. This number must be an integer and increases with increasing thickness.
 LabelSize : You can adjust the size of the labels by using the "size.auto", "size.tiny", "size.smal", "size.normal", "size.large" or "size.huge" entries.
🟣 Logical Parameters 
 ShVF : If this parameter is on "true" mode, only patterns will be displayed that they have exact format and no noise can be seen in them. If "false" is, the patterns displayed that maybe are noisy and do not exactly correspond to the original pattern.
  
 FLPC : if Turned on, you can see this ability of patterns when their last pivot is formed. If this feature is off, it will see the patterns as soon as they are formed. The advantage of this option being clear is less formation of fielded patterns, and it is accompanied by the lateest pattern seeing and a sharp reduction in reward to risk.
 FLPCPeriod : Using this parameter you can determine that the last pivot is based on Pivot period.
  
 Pivot : You need to determine the period of the zigzag indicator. This factor is the most important parameter in pattern recognition.
 ABXAmin : Minimum retracement of "AB" line compared to "XA" line.
 ABXAmax : Maximum retracement of "AB" line compared to "XA" line.
 BCABmin : Minimum retracement of "BC" line compared to "AB" line.
 BCABmax : Maximum retracement of "BC" line compared to "AB" line.
 CDBCmin : Minimum retracement of "CD" line compared to "BC" line.
 CDBCmax : Maximum retracement of "CD" line compared to "BC" line.
 CDXAmin : Minimum retracement of "CD" line compared to "XA" line.
 CDXAmax : Maximum retracement of "CD" line compared to "XA" line.
  
  
🟣 Function Outputs 
This library has two outputs. The first output is related to the alert of the formation of a new pattern. And the second output is related to the formation of the candlestick pattern and you can draw it using the "plotshape" tool.
 Candle Confirmation Logic :
  
 Example :
 import TFlab/Harmonic_Chart_Pattern_Library_TradingFinder/1 as HP
PP = input.int(3, 'ZigZag Pivot Period')
ShowBull = input.bool(true, 'Show Bullish Pattern')
ShowBear = input.bool(true, 'Show Bearish Pattern')
ColorBull = input.color(#0609bb, 'Color Bullish Pattern')
ColorBear = input.color(#0609bb, 'Color Bearish Pattern')
LineWidth = input.int(1 , 'Width Line')
LabelSize = input.string(size.small , 'Label size' , options =  )
ShVF = input.bool(false , 'Show Valid Format')
FLPC = input.bool(false , 'Show Formation Last Pivot Confirm')
FLPCPeriod =input.int(2, 'Period of Formation Last Pivot')
//Call function
  = HP.XABCD('Bullish Bat', 'Bullish', ShowBull, ColorBull , LineWidth, LabelSize ,ShVF,  FLPC, FLPCPeriod, PP, 0.382, 0.50, 0.382, 0.886, 1.618, 2.618, 0.85, 0.9)
  = HP.XABCD('Bearish Bat', 'Bearish', ShowBear, ColorBear , LineWidth, LabelSize ,ShVF,  FLPC, FLPCPeriod, PP, 0.382, 0.50, 0.382, 0.886, 1.618, 2.618, 0.85, 0.9)
//Alert
if BearAlert
    alert('Bearish Harmonic')
if BullAlert
    alert('Bulish Harmonic')
//CandleStick Confirm
plotshape(BearCandleConfirm, style = shape.arrowdown, color = color.red)
plotshape(BullCandleConfirm, style = shape.arrowup, color = color.green, location = location.belowbar )
 
FVG Instantaneous Mitigation Signals [LuxAlgo]The FVG Instantaneous Mitigation Signals indicator detects and highlights "instantaneously" mitigated fair value gaps (FVG), that is FVGs that get mitigated one bar after their creation, returning signals upon mitigation.
Take profit/stop loss areas, as well as a trailing stop loss are also included to complement the signals.
🔶  USAGE 
  
Instantaneous Fair Value Gap mitigation is a new concept introduced in this script and refers to the event of price mitigating a fair value gap one bar after its creation.
The resulting signal sentiment is opposite to the bias of the mitigated fair value gap. As such an instantaneously mitigated bearish FGV results in a bullish signal, while an instantaneously mitigated bullish FGV results in a bearish signal.
  
Fair value gap areas subject to instantaneous mitigation are highlighted alongside their average level, this level is extended until reached in a direction opposite to the FVG bias and can be used as a potential support/resistance level.
  
Users can filter out less volatile fair value gaps using the "FVG Width Filter" setting, with higher values highlighting more volatile fair value gaps subject to instantaneous mitigation.
🔹 TP/SL Areas 
  
Users can enable take-profit/stop-loss areas. These are displayed upon a new signal formation, with an area starting from the mitigated FVG area average to this average plus/minus  N  ATRs, where  N  is determined by their respective multiplier settings.
Using a higher multiplier will return more distant areas from the price, requiring longer-term variations to be reached.
🔹 Trailing Stop Loss 
  
A trailing-stop loss is included, increasing when the price makes a new higher high or lower low since the trailing has been set. Using a higher trailing stop multiplier will allow its initial position to be further away from the price, reducing its chances of being hit.
The trailing stop can be reset on "Every Signal", whether they are bullish or bearish, or only on an "Inverse Signal", which will reset the trailing when a signal of opposite bias is detected, this will preserve an existing trailing stop when a new signal of the same bias to the present one is detected.
🔶  DETAILS 
  
Fair Value Gaps are ubiquitous to price action traders. These patterns arise when there exists a disparity between supply and demand. The action of price coming back and filling these imbalance areas is referred to as "mitigation" or "rebalancing".
"Instantaneous mitigation" refers to the event of price quickly mitigating a prior fair value gap, which in the case of this script is one bar after their creation. These events are indicative of a market more attentive to imbalances, and more willing to correct disparities in supply and demand.
If the market is particularly sensitive to imbalances correction then these can be excessively corrected, leading to further imbalances, highlighting a potential feedback process.
🔶  SETTINGS 
 
 FVG Width Filter: Filter out FVGs with thinner areas from returning a potential signal.
 
🔹 TP/SL 
 
 TP Area: Enable take-profit areas for new signals.
 Multiplier: Control the distance from the take profit and the price, with higher values returning more distant TP's.
 
 
 SL Area: Enable stop-loss areas for new signals.
 Multiplier: Control the distance from the stop loss and the price, with higher values returning more distant SL's.
 
🔹 Trailing Stop 
 
 Reset Trailing Stop: Determines when the trailing stop is reset.
 Multiplier: Controls the initial position of the trailing stop, with higher values returning more distant trailing stops.
chrono_utilsLibrary   "chrono_utils" 
Collection of objects and common functions that are related to datetime windows session days and time
ranges. The main purpose of this library is to handle time-related functionality and make it easy to reason about a
future bar checking if it will be part of a predefined session and/or inside a datetime window. All existing session
functionality I found in the documentation e.g. "not na(time(timeframe, session, timezone))" are not suitable for
strategy scripts, since the execution of the orders is delayed by one bar, due to the script execution happening at
the bar close. Moreover, a history operator with a negative value that looks forward is not allowed in any pinescript
expression. So, a prediction for the next bar using the bars_back argument of "time()"" and "time_close()" was
necessary. Thus, I created this library to overcome this small but very important limitation. In the meantime, I
added useful functionality to handle session-based behavior. An interesting utility that emerged from this
development is the data anomaly detection where a comparison between the prediction and the actual value is happening.
If those two values are different then a data inconsistency happened between the prediction bar and the actual bar
(probably due to a holiday, half session day, a timezone change etc..)
 exTimezone(timezone) 
  exTimezone - Convert extended timezone to timezone string
  Parameters:
     timezone (simple string) : - The timezone or a special string
  Returns: string representing the timezone
 nameOfDay(day) 
  nameOfDay - Convert the day id into a short nameOfDay
  Parameters:
     day (int) : - The day id to convert
  Returns: - The short name of the day
 today() 
  today - Get the day id of this day
  Returns: - The day id
 nthDayAfter(day, n) 
  nthDayAfter - Get the day id of n days after the given day
  Parameters:
     day (int) : - The day id of the reference day
     n (int) : - The number of days to go forward
  Returns: - The day id of the day that is n days after the reference day
 nextDayAfter(day) 
  nextDayAfter - Get the day id of next day after the given day
  Parameters:
     day (int) : - The day id of the reference day
  Returns: - The day id of the next day after the reference day
 nthDayBefore(day, n) 
  nthDayBefore - Get the day id of n days before the given day
  Parameters:
     day (int) : - The day id of the reference day
     n (int) : - The number of days to go forward
  Returns: - The day id of the day that is n days before the reference day
 prevDayBefore(day) 
  prevDayBefore - Get the day id of previous day before the given day
  Parameters:
     day (int) : - The day id of the reference day
  Returns: - The day id of the previous day before the reference day
 tomorrow() 
  tomorrow - Get the day id of the next day
  Returns: - The next day day id
 normalize(num, min, max) 
  normalizeHour - Check if number is inthe range of  
  Parameters:
     num (int) 
     min (int) 
     max (int) 
  Returns: - The normalized number
 normalizeHour(hourInDay) 
  normalizeHour - Check if hour is valid and return a noralized hour range from  
  Parameters:
     hourInDay (int) 
  Returns: - The normalized hour
 normalizeMinute(minuteInHour) 
  normalizeMinute - Check if minute is valid and return a noralized minute from  
  Parameters:
     minuteInHour (int) 
  Returns: - The normalized minute
 monthInMilliseconds(mon) 
  monthInMilliseconds - Calculate the miliseconds in one bar of the timeframe
  Parameters:
     mon (int) : - The month of reference to get the miliseconds
  Returns: - The number of milliseconds of the month
 barInMilliseconds() 
  barInMilliseconds - Calculate the miliseconds in one bar of the timeframe
  Returns: - The number of milliseconds in one bar
 method to_string(this) 
  to_string - Formats the time window into a human-readable string
  Namespace types: DateTimeWindow
  Parameters:
     this (DateTimeWindow) : - The time window object with the from and to datetimes
  Returns: - The string of the time window
 method to_string(this) 
  to_string - Formats the session days into a human-readable string with short day names
  Namespace types: SessionDays
  Parameters:
     this (SessionDays) : - The session days object with the day selection
  Returns: - The string of the session day short names
 method to_string(this) 
  to_string - Formats the session time into a human-readable string
  Namespace types: SessionTime
  Parameters:
     this (SessionTime) : - The session time object with the hour and minute of the time of the day
  Returns: - The string of the session time
 method to_string(this) 
  to_string - Formats the session time into a human-readable string
  Namespace types: SessionTimeRange
  Parameters:
     this (SessionTimeRange) : - The session time range object with the start and end time of the daily session
  Returns: - The string of the session time
 method to_string(this) 
  to_string - Formats the session into a human-readable string
  Namespace types: Session
  Parameters:
     this (Session) : - The session object with the day and the time range selection
  Returns: - The string of the session
 method init(this, fromDateTime, toDateTime) 
  init - Initialize the time window object from boolean values of each session day
  Namespace types: DateTimeWindow
  Parameters:
     this (DateTimeWindow) : - The time window object that will hold the from and to datetimes
     fromDateTime (int) : - The starting datetime of the time window
     toDateTime (int) : - The ending datetime of the time window
  Returns: - The time window object
 method init(this, refTimezone, chTimezone, fromDateTime, toDateTime) 
  init - Initialize the time window object from boolean values of each session day
  Namespace types: DateTimeWindow
  Parameters:
     this (DateTimeWindow) : - The time window object that will hold the from and to datetimes
     refTimezone (simple string) : - The timezone of reference of the 'from' and 'to' dates
     chTimezone (simple string) : - The target timezone to convert the 'from' and 'to' dates
     fromDateTime (int) : - The starting datetime of the time window
     toDateTime (int) : - The ending datetime of the time window
  Returns: - The time window object
 method init(this, sun, mon, tue, wed, thu, fri, sat) 
  init - Initialize the session days object from boolean values of each session day
  Namespace types: SessionDays
  Parameters:
     this (SessionDays) : - The session days object that will hold the day selection
     sun (bool) : - Is Sunday a trading day?
     mon (bool) : - Is Monday a trading day?
     tue (bool) : - Is Tuesday a trading day?
     wed (bool) : - Is Wednesday a trading day?
     thu (bool) : - Is Thursday a trading day?
     fri (bool) : - Is Friday a trading day?
     sat (bool) : - Is Saturday a trading day?
  Returns: - The session days object
 method init(this, unixTime) 
  init - Initialize the object from the hour and minute of the session time in exchange timezone (syminfo.timezone)
  Namespace types: SessionTime
  Parameters:
     this (SessionTime) : - The session time object with the hour and minute of the time of the day
     unixTime (int) : - The unix time
  Returns: - The session time object
 method init(this, hourInDay, minuteInHour) 
  init - Initialize the object from the hour and minute of the session time in exchange timezone (syminfo.timezone)
  Namespace types: SessionTime
  Parameters:
     this (SessionTime) : - The session time object with the hour and minute of the time of the day
     hourInDay (int) : - The hour of the time
     minuteInHour (int) : - The minute of the time
  Returns: - The session time object
 method init(this, hourInDay, minuteInHour, refTimezone) 
  init - Initialize the object from the hour and minute of the session time
  Namespace types: SessionTime
  Parameters:
     this (SessionTime) : - The session time object with the hour and minute of the time of the day
     hourInDay (int) : - The hour of the time
     minuteInHour (int) : - The minute of the time
     refTimezone (string) : - The timezone of reference of the 'hour' and 'minute'
  Returns: - The session time object
 method init(this, startTime, endTime) 
  init - Initialize the object from the start and end session time in exchange timezone (syminfo.timezone)
  Namespace types: SessionTimeRange
  Parameters:
     this (SessionTimeRange) : - The session time range object that will hold the start and end time of the daily session
     startTime (SessionTime) : - The time the session begins
     endTime (SessionTime) : - The time the session ends
  Returns: - The session time range object
 method init(this, startTimeHour, startTimeMinute, endTimeHour, endTimeMinute, refTimezone) 
  init - Initialize the object from the start and end session time
  Namespace types: SessionTimeRange
  Parameters:
     this (SessionTimeRange) : - The session time range object that will hold the start and end time of the daily session
     startTimeHour (int) : - The time hour the session begins
     startTimeMinute (int) : - The time minute the session begins
     endTimeHour (int) : - The time hour the session ends
     endTimeMinute (int) : - The time minute the session ends
     refTimezone (string) 
  Returns: - The session time range object
 method init(this, days, timeRanges) 
  init - Initialize the session object from session days and time range
  Namespace types: Session
  Parameters:
     this (Session) : - The session object that will hold the day and the time range selection
     days (SessionDays) : - The session days object that defines the days the session is happening
     timeRanges (array) : - The array of all the session time ranges during a session day
  Returns: - The session object
 method init(this, days, timeRanges, names, colors) 
  init - Initialize the session object from session days and time range
  Namespace types: SessionView
  Parameters:
     this (SessionView) : - The session view object that will hold the session, the names and the color selections
     days (SessionDays) : - The session days object that defines the days the session is happening
     timeRanges (array) : - The array of all the session time ranges during a session day
     names (array) : - The array of the names of the sessions
     colors (array) : - The array of the colors of the sessions
  Returns: - The session object
 method get_size_in_secs(this) 
  get_size_in_secs - Count the seconds from start to end in the given timeframe
  Namespace types: DateTimeWindow
  Parameters:
     this (DateTimeWindow) : - The time window object with the from and to datetimes
  Returns: - The number of seconds inside the time widow for the given timeframe
 method get_size_in_secs(this) 
  get_size_in_secs - Calculate the seconds inside the session
  Namespace types: SessionTimeRange
  Parameters:
     this (SessionTimeRange) : - The session time range object with the start and end time of the daily session
  Returns: - The number of seconds inside the session
 method get_size_in_bars(this) 
  get_size_in_bars - Count the bars from start to end in the given timeframe
  Namespace types: DateTimeWindow
  Parameters:
     this (DateTimeWindow) : - The time window object with the from and to datetimes
  Returns: - The number of bars inside the time widow for the given timeframe
 method get_size_in_bars(this) 
  get_size_in_bars - Calculate the bars inside the session
  Namespace types: SessionTimeRange
  Parameters:
     this (SessionTimeRange) : - The session time range object with the start and end time of the daily session
  Returns: - The number of bars inside the session for the given timeframe
 method is_bar_included(this, offset_forward) 
  is_bar_included - Check if the given bar is between the start and end dates of the window
  Namespace types: DateTimeWindow
  Parameters:
     this (DateTimeWindow) : - The time window object with the from and to datetimes
     offset_forward (simple int) : - The number of bars forward. Default is 1
  Returns: - Whether the current bar is inside the datetime window
 method is_bar_included(this, offset_forward) 
  is_bar_included - Check if the given bar is inside the session as defined by the input params (what "not na(time(timeframe.period, this.to_sess_string()) )" should return if you could write it
  Namespace types: Session
  Parameters:
     this (Session) : - The session with the day and the time range selection
     offset_forward (simple int) : - The bar forward to check if it is between the from and to datetimes. Default is 1
  Returns: - Whether the current time is inside the session
 method to_sess_string(this) 
  to_sess_string - Formats the session days into a session string with day ids
  Namespace types: SessionDays
  Parameters:
     this (SessionDays) : - The session days object
  Returns: - The string of the session day ids
 method to_sess_string(this) 
  to_sess_string - Formats the session time into a session string
  Namespace types: SessionTime
  Parameters:
     this (SessionTime) : - The session time object with the hour and minute of the time of the day
  Returns: - The string of the session time
 method to_sess_string(this) 
  to_sess_string - Formats the session time into a session string
  Namespace types: SessionTimeRange
  Parameters:
     this (SessionTimeRange) : - The session time range object with the start and end time of the daily session
  Returns: - The string of the session time
 method to_sess_string(this) 
  to_sess_string - Formats the session into a session string
  Namespace types: Session
  Parameters:
     this (Session) : - The session object with the day and the time range selection
  Returns: - The string of the session
 method from_sess_string(this, sess) 
  from_sess_string - Initialize the session days object from the session string
  Namespace types: SessionDays
  Parameters:
     this (SessionDays) : - The session days object that will hold the day selection
     sess (string) : - The session string part that represents the days  
  Returns: - The session days object
 method from_sess_string(this, sess) 
  from_sess_string - Initialize the session time object from the session string in exchange timezone (syminfo.timezone)
  Namespace types: SessionTime
  Parameters:
     this (SessionTime) : - The session time object that will hold the hour and minute of the time
     sess (string) : - The session string part that represents the time HHmm
  Returns: - The session time object
 method from_sess_string(this, sess, refTimezone) 
  from_sess_string - Initialize the session time object from the session string
  Namespace types: SessionTime
  Parameters:
     this (SessionTime) : - The session time object that will hold the hour and minute of the time
     sess (string) : - The session string part that represents the time HHmm
     refTimezone (simple string) : - The timezone of reference of the 'hour' and 'minute'
  Returns: - The session time object
 method from_sess_string(this, sess) 
  from_sess_string - Initialize the session time range object from the session string in exchange timezone (syminfo.timezone)
  Namespace types: SessionTimeRange
  Parameters:
     this (SessionTimeRange) : - The session time range object that will hold the start and end time of the daily session
     sess (string) : - The session string part that represents the time range HHmm-HHmm
  Returns: - The session time range object
 method from_sess_string(this, sess, refTimezone) 
  from_sess_string - Initialize the session time range object from the session string
  Namespace types: SessionTimeRange
  Parameters:
     this (SessionTimeRange) : - The session time range object that will hold the start and end time of the daily session
     sess (string) : - The session string part that represents the time range HHmm-HHmm
     refTimezone (simple string) : - The timezone of reference of the time ranges
  Returns: - The session time range object
 method from_sess_string(this, sess) 
  from_sess_string - Initialize the session object from the session string in exchange timezone (syminfo.timezone)
  Namespace types: Session
  Parameters:
     this (Session) : - The session object that will hold the day and the time range selection
     sess (string) : - The session string that represents the session HHmm-HHmm,HHmm-HHmm:ddddddd
  Returns: - The session time range object
 method from_sess_string(this, sess, refTimezone) 
  from_sess_string - Initialize the session object from the session string
  Namespace types: Session
  Parameters:
     this (Session) : - The session object that will hold the day and the time range selection
     sess (string) : - The session string that represents the session HHmm-HHmm,HHmm-HHmm:ddddddd
     refTimezone (simple string) : - The timezone of reference of the time ranges
  Returns: - The session time range object
 method nth_day_after(this, day, n) 
  nth_day_after - The nth day after the given day that is a session day (true) in the object
  Namespace types: SessionDays
  Parameters:
     this (SessionDays) : - The session days object with the day selection
     day (int) : - The day id of the reference day
     n (int) : - The number of days after
  Returns: - The day id of the nth session day of the week after the given day
 method nth_day_before(this, day, n) 
  nth_day_before - The nth day before the given day that is a session day (true) in the object
  Namespace types: SessionDays
  Parameters:
     this (SessionDays) : - The session days object with the day selection
     day (int) : - The day id of the reference day
     n (int) : - The number of days after
  Returns: - The day id of the nth session day of the week before the given day
 method next_day(this) 
  next_day - The next day that is a session day (true) in the object
  Namespace types: SessionDays
  Parameters:
     this (SessionDays) : - The session days object with the day selection
  Returns: - The day id of the next session day of the week
 method previous_day(this) 
  previous_day - The previous day that is session day (true) in the object
  Namespace types: SessionDays
  Parameters:
     this (SessionDays) : - The session days object with the day selection
  Returns: - The day id of the previous session day of the week
 method get_sec_in_day(this) 
  get_sec_in_day - Count the seconds since the start of the day this session time represents
  Namespace types: SessionTime
  Parameters:
     this (SessionTime) : - The session time object with the hour and minute of the time of the day
  Returns: - The number of seconds passed from the start of the day until that session time
 method get_ms_in_day(this) 
  get_ms_in_day - Count the milliseconds since the start of the day this session time represents
  Namespace types: SessionTime
  Parameters:
     this (SessionTime) : - The session time object with the hour and minute of the time of the day
  Returns: - The number of milliseconds passed from the start of the day until that session time
 method is_day_included(this, day) 
  is_day_included - Check if the given day is inside the session days
  Namespace types: SessionDays
  Parameters:
     this (SessionDays) : - The session days object with the day selection
     day (int) : - The day to check if it is a trading day
  Returns: - Whether the current day is included in the session days
 DateTimeWindow 
  DateTimeWindow - Object that represents a datetime window with a beginning and an end
  Fields:
     fromDateTime (series int) : - The beginning of the datetime window
     toDateTime (series int) : - The end of the datetime window
 SessionDays 
  SessionDays - Object that represent the trading days of the week
  Fields:
     days (map) : - The map that contains all days of the week and their session flag
 SessionTime 
  SessionTime - Object that represents the time (hour and minutes)
  Fields:
     hourInDay (series int) : - The hour of the day that ranges from 0 to 24
     minuteInHour (series int) : - The minute of the hour that ranges from 0 to 59
     minuteInDay (series int) : - The minute of the day that ranges from 0 to 1440. They will be calculated based on hourInDay and minuteInHour when method is called
 SessionTimeRange 
  SessionTimeRange - Object that represents a range that extends from the start to the end time
  Fields:
     startTime (SessionTime) : - The beginning of the time range
     endTime (SessionTime) : - The end of the time range
     isOvernight (series bool) : - Whether or not this is an overnight time range
 Session 
  Session - Object that represents a session
  Fields:
     days (SessionDays) : - The map of the trading days
     timeRanges (array) : - The array with all time ranges of the session during the trading days
 SessionView 
  SessionView - Object that visualize a session
  Fields:
     sess (Session) : - The Session object to be visualized
     names (array) : - The names of the session time ranges
     colors (array) : - The colors of the session time ranges
Alert Sender Library [TradingFinder]Library   "AlertSenderLibrary_TradingFinder" 
🔵 Introduction 
The "Alert Sender Library" is a management and production program for "Alert Messages" that enables the creation of unique messages for any type of signal generated by indicators or strategies.
These messages include the direction of the signal, symbol, time frame, the date and time the condition was triggered, prices related to the signal, and a personal message from you. To make better and more optimal use of this "library", you should carefully study " Key Features" and "How to Use".
🔵 Key Features 
 Automatic Detection of Appropriate Type :
Using two parameters, "AlertType" and "DetectionType", which you must enter at the beginning into the "AlertSender" function, the type of the alert message is determined. 
For example, if you select one of the "DetectionType"s such as "Order Block Signal", "Signal", and "Setup", your alert type will be chosen based on "Long" and "Short". Whether it's "Long" or "Short" depends on the "AlertType" you have set to either "Bullish" or "Bearish".
 Automatic Symbol Detection :
Whenever you add an alert for a specific symbol, if you want the name of that symbol to be in your message text, you must manually write the name of the symbol in your message. One of the capabilities of the "Alert Sender" is the automatic detection of the symbol and adding it to the message text.
 Automatic Time Frame Detection :
When adding your alert, the "Alert Sender" detects the time frame of the symbol you intend to add the alert for and adds it to the text. This feature is very practical and can prevent traders from making mistakes. 
For example, a trader might add alerts for a specific symbol using a specific indicator in different time frames, taking the main signal in the 1-hour time frame and only a confirmation signal in the 15-minute time frame. This feature helps to identify in which time frame the signal is set.
 Detection of Date and Time When the Signal is Triggered :
You can have the date and time at the moment the message is sent. This feature has various uses. For example, if you use the Webhook URL feature to send messages to a Telegram channel, there might be issues with alert delivery on your server, causing delays, and you might receive the message when it has lost its validity.
 With this feature, you can match the sending time of the message from TradingView with the receipt time in your messenger and detect if there is a delay in message delivery.
 Important :
You can also set the Time Zone you wish to receive the date and time based on.
 Display of "Key Prices" :
Key prices can vary based on the type of signals. For example, when the "DetectionType" is in "Order Block Signal" mode, the key prices are the "Distal" and "Proximal" prices. Or if the "DetectionType" is in "Setup" mode, the key prices are "Entry", "Stop Loss", and "Take Profit".
 Receipt of Personal "Messages" :
You can enter your personal message using "input.string" or "input.text_area" in addition to the messages that are automatically created.
 Beautiful and Functional Display of Messages :
The titles of messages sent by "AlertSender" are displayed using related emojis to prevent mistakes due to visual errors, enhancing beauty.
  
  
🔵 How to Use 
🟣 Familiarity with Function and Parameters 
 AlertSender(Condition, Alert, AlertName, AlertType, DetectionType, SetupData, Frequency, UTC, MoreInfo, Message, o, h, l, c, Entry, TP, SL, Distal, Proximal)
 Parameters:
  - Condition (bool)
  - Alert (string)
  - AlertName (string)
  - AlertType (string)
  - DetectionType (string)
  - SetupData (string)
  - Frequency (string)
  - UTC (string)
  - MoreInfo (string)
  - Message (string)
  - o (float)
  - h (float)
  - l (float)
  - c (float)
  - Entry (float)
  - TP (float)
  - SL (float)
  - Distal (float)
  - Proximal (float) 
To add "Alert Sender Library", you must first add the following code to your script.
 import TFlab/AlertSenderLibrary_TradingFinder/1 
🟣 Parameters 
 "Condition" : This parameter is a Boolean. You need to set it based on the condition that, when met (or fired), you want to receive an alert. The output should be either "true" or "false".
 "Alert" : This parameter accepts one of two inputs, "On" or "Off". If set to "On", the alarm is active; if "Off", the alarm is deactivated. This input is useful when you have numerous alerts in an indicator or strategy and need to activate only a few of them. "Alert" is a string parameter.
 Alert = input.string('On', 'Alert',  , 'If you turn on the Alert, you can receive alerts and notifications after setting the "Alert".', group = 'Alert') 
 "AlertName" : This is a string parameter where you can enter the name you choose for your alert.
 AlertName = input.string('Order Blocks Finder  ', 'Alert Name', group = 'Alert') 
 "AlertType" : The inputs for this parameter are "Bullish" or "Bearish". If the condition selected in the "Condition" parameter is of a bullish bias, you should set this parameter to "Bullish", and if the condition is of a bearish bias, it should be set to "Bearish". "AlertType" is a string parameter.
 "DetectionType" : This parameter's predefined inputs include "Order Block Signal", "Signal", "Setup", and "Analysis". You may provide other inputs, but some functionalities, like "Key Price", might be lost. "DetectionType" is a string parameter.
 "SetupData" : 
If "DetectionType" is set to "Setup", you must specify "SetupData" as either "Basic" or "Full". In "Basic" mode, only the "Entry" price needs to be defined in the function, and "TP" (Take Profit) and "SL" (Stop Loss) can be any number or NA. In "Full" mode, you need to define "Entry", "SL", and "TP". "Setup" is a string parameter.
 "Frequency" : This string parameter defines the announcement frequency. Choices include: "All" (activates the alert every time the function is called), "Once Per Bar" (activates the alert only on the first call within the bar), and "Once Per Bar Close" (the alert is activated only by a call at the last script execution of the real-time bar upon closing). The default setting is "Once per Bar".
 Frequency = input.string('Once Per Bar', 'Message Frequency',  , 'The triggering frequency. Possible values are: All (all function calls trigger the alert), Once Per Bar (the first function call during the bar triggers the alert), Per Bar Close (the function call triggers the alert only when it occurs during the last script iteration of the real-time bar, when it closes). The default is alert.freq_once_per_bar.', group = 'Alert') 
 "UTC" : With this parameter, you can set the Time Zone for the date and time of the alert's dispatch. "UTC" is a string parameter and can be set as "UTC-4", "UTC+1", "UTC+9", or any other Time Zone.
 UTC = input.string('UTC', 'Show Alert time by Time Zone', group = 'Alert') 
 "MoreInfo" : This parameter can take one of two inputs, "On" or "Off", which are strings. Additional information, including "Time" and "Key Price", is included. If set to "On", this information is received; if "Off", it is not displayed in the sent message.
 MoreInfo = input.string('On', 'Display More Info',  , group = 'Alert') 
 "Message" : This parameter captures the user's personal message through an input and displays it at the end of the sent message. It is a string input.
 MessageBull = input.text_area('Long Position', 'Long Signal Message', group = 'Alert') MessageBear = input.text_area('Short Position', 'Short Signal Message', group = 'Alert') 
 "o"  (Open Price): A floating-point number representing the opening price of the candle. This input is necessary when the "DetectionType" is set to "Signal". Otherwise, it can be any number or "na".
 "h"  (High Price): A float variable for the highest price of the candle. Required when "DetectionType" is "Signal"; in other cases, any number or "na" is acceptable.
 "l"  (Low Price): A float representing the lowest price of the candle. This field must be filled if "DetectionType" is "Signal". If not, it can be any number or "na".
 "c"  (Close Price): A floating-point variable indicating the closing price of the candle. Needed for "Signal" type detections; otherwise, it can take any value or "na".
 "Entry" : A float variable indicating the entry price into a trading setup. This is relevant when "DetectionType" is in "Setup" mode. In other scenarios, it can be any number or "na". It denotes the price at which the trade setup is entered.
 "TP"  (Take Profit): A float that is necessary when "DetectionType" is "Setup" and "SetupData" is "Full". Otherwise, it can be any number or "na". It signifies the price target for taking profits in a trading setup.
 "SL"  (Stop Loss): A float required when "DetectionType" is "Setup" and "SetupData" is "Full". It can be any number or "na" in other cases. This value represents the price at which a stop loss is set to limit losses.
 "Distal" : A float important for "Order Block Signal" detection. It can be any number or "na" if not in use. This variable indicates the price reaching the distal line of an order block.
 "Proximal" : A float needed for "Order Block Signal" detection mode. It can take any value or "na" otherwise. It marks the price reaching the proximal line of an order block.
Danger Signals from The Trading MindwheelThe " Danger Signals " indicator, a collaborative creation from the minds at Amphibian Trading and MARA Wealth, serves as your vigilant lookout in the volatile world of stock trading. Drawing from the wisdom encapsulated in "The Trading Mindwheel" and the successful methodologies of legends like William O'Neil and Mark Minervini, this tool is engineered to safeguard your trading journey.
 Core Features: 
 Real-Time Alerts:  Identify critical danger signals as they emerge in the market. Whether it's a single day of heightened risk or a pattern forming, stay informed with specific danger signals and a tally of signals for comprehensive decision-making support. The indicator looks for over 30 different signals ranging from simple closing ranges to more complex signals like blow off action.
 Tailored Insights with Portfolio Heat Integration:  Pair with the "Portfolio Heat" indicator to customize danger signals based on your current positions, entry points, and stops. This personalized approach ensures that the insights are directly relevant to your trading strategy. Certain signals can have different meanings based on where your trade is at in its lifecycle. Blow off action at the beginning of a trend can be viewed as strength, while after an extended run could signal an opportunity to lock in profits. 
 Forward-Looking Analysis:  Leverage the 'Potential Danger Signals' feature to assess future risks. Enter hypothetical price levels to understand potential market reactions before they unfold, enabling proactive trade management.
The indicator offers two different modes of 'Potential Danger Signals', Worst Case or Immediate. Worst Case allows the user to input any price and see what signals would fire based on price reaching that level, while the Immediate mode looks for potential Danger Signals that could happen on the next bar.  
This is achieved by adding and subtracting the average daily range to the current bars close while also forecasting the next values of moving averages, vwaps, risk multiples and the relative strength line to see if a Danger Signal would trigger. 
  
 User Customization:  Flexibility is at your fingertips with toggle options for each danger signal. Tailor the indicator to match your unique trading style and risk tolerance. No two traders are the same, that is why each signal is able to be turned on or off to match your trading personality.
 Versatile Application:  Ideal for growth stock traders, momentum swing traders, and adherents of the CANSLIM methodology. Whether you're a novice or a seasoned investor, this tool aligns with strategies influenced by trading giants.
 Validation and Utility: 
Inspired by the trade management principles of Michael Lamothe, the " Danger Signals " indicator is more than just a tool; it's a reflection of tested strategies that highlight the importance of risk management. Through rigorous validation, including the insights from "The Trading Mindwheel," this indicator helps traders navigate the complexities of the market with an informed, strategic approach.
Whether you're contemplating a new position or evaluating an existing one, the " Danger Signals " indicator is designed to provide the clarity needed to avoid potential pitfalls and capitalize on opportunities with confidence. Embrace a smarter way to trade, where awareness and preparation open the door to success.
Let's dive into each of the components of this indicator.
 Volume:  Volume refers to the number of shares or contracts traded in a security or an entire market during a given period. It is a measure of the total trading activity and liquidity, indicating the overall interest in a stock or market.
 Price Action:  the analysis of historical prices to inform trading decisions, without the use of technical indicators. It focuses on the movement of prices to identify patterns, trends, and potential reversal points in the market.
 Relative Strength Line:  The RS line is a popular tool used to compare the performance of a stock, typically calculated as the ratio of the stock's price to a benchmark index's price. It helps identify outperformers and underperformers relative to the market or a specific sector. The RS value is calculated by dividing the close price of the chosen stock by the close price of the comparative symbol (SPX by default).
 Average True Range (ATR):  ATR is a market volatility indicator used to show the average range prices swing over a specified period. It is calculated by taking the moving average of the true ranges of a stock for a specific period. The true range for a period is the greatest of the following three values:
 
 The difference between the current high and the current low.
 The absolute value of the current high minus the previous close.
 The absolute value of the current low minus the previous close.
 
 Average Daily Range (ADR):  ADR is a measure used in trading to capture the average range between the high and low prices of an asset over a specified number of past trading days. Unlike the Average True Range (ATR), which accounts for gaps in the price from one day to the next, the Average Daily Range focuses solely on the trading range within each day and averages it out.
 Anchored VWAP:   AVWAP gives the average price of an asset, weighted by volume, starting from a specific anchor point. This provides traders with a dynamic average price considering both price and volume from a specific start point, offering insights into the market's direction and potential support or resistance levels.
 Moving Averages:  Moving Averages smooth out price data by creating a constantly updated average price over a specific period of time. It helps traders identify trends by flattening out the fluctuations in price data.
 Stochastic:  A stochastic oscillator is a momentum indicator used in technical analysis that compares a particular closing price of an asset to a range of its prices over a certain period of time. The theory behind the stochastic oscillator is that in a market trending upwards, prices will tend to close near their high, and in a market trending downwards, prices close near their low.
While each of these components offer unique insights into market behavior, providing sell signals under specific conditions,  the power of combining these different signals lies in their ability to confirm each other's signals. This in turn reduces false positives and provides a more reliable basis for trading decisions
These signals can be recognized at any time, however the indicators power is in it's ability to take into account where a trade is in terms of your entry price and stop.
If a trade just started, it hasn’t earned much leeway. Kind of like a new employee that shows up late on the first day of work. It’s less forgivable than say the person who has been there for a while, has done well, is on time, and then one day comes in late. 
 Contextual Sensitivity:  
For instance, a high volume sell-off coupled with a bearish price action pattern significantly strengthens the sell signal. When the price closes below an Anchored VWAP or a critical moving average in this context, it reaffirms the bearish sentiment, suggesting that the momentum is likely to continue downwards.
By considering the relative strength line (RS) alongside volume and price action, the indicator can differentiate between a normal retracement in a strong uptrend and a when a stock starts to become a laggard. 
The integration of ATR and ADR provides a dynamic framework that adjusts to the market's volatility. A sudden increase in ATR or a character change detected through comparing short-term and long-term ADR can alert traders to emerging trends or reversals. 
The "Danger Signals" indicator exemplifies the power of integrating diverse technical indicators to create a more sophisticated, responsive, and adaptable trading tool. This approach not only amplifies the individual strengths of each indicator but also mitigates their weaknesses.
 Portfolio Heat Indicator  can be found by clicking on the image below
  
 Danger Signals Included 
 
 Price Closes Near Low - Daily Closing Range of 30% or Less
 Price Closes Near Weekly Low - Weekly Closing Range of 30% or Less
 Price Closes Near Daily Low on Heavy Volume - Daily Closing Range of 30% or Less on Heaviest  Volume of the Last 5 Days
 Price Closes Near Weekly Low on Heavy Volume - Weekly Closing Range of 30% or Less on  Heaviest Volume of the Last 5 Weeks
 Price Closes Below Moving Average - Price Closes Below One of 5 Selected Moving Averages
 Price Closes Below Swing Low - Price Closes Below Most Recent Swing Low
 Price Closes Below 1.5 ATR - Price Closes Below Trailing ATR Stop Based on Highest High of Last 10 Days
 Price Closes Below AVWAP - Price Closes Below Selected Anchored VWAP (Anchors include:  High of base, Low of base, Highest volume of base, Custom date)
 Price Shows Aggressive Selling - Current Bars High is Greater Than Previous Day's High and  Closes Near the Lows on Heaviest Volume of the Last 5 Days
 Outside Reversal Bar - Price Makes a New High and Closes Near the Lows, Lower Than the Previous Bar's Low
 Price Shows Signs of Stalling - Heavy Volume with a Close of Less than 1%
 3 Consecutive Days of Lower Lows - 3 Days of Lower Lows
 Close Lower than 3 Previous Lows - Close is Less than 3 Previous Lows
 Character Change - ADR of Last Shorter Length is Larger than ADR of Longer Length
 Fast Stochastic Crosses Below Slow Stochastic - Fast Stochastic Crosses Below Slow Stochastic
 Fast & Slow Stochastic Curved Down - Both Stochastic Lines Close Lower than Previous Day for 2 Consecutive Days
 Lower Lows & Lower Highs Intraday - Lower High and Lower Low on 30 Minute Timeframe
 Moving Average Crossunder - Selected MA Crosses Below Other Selected MA
 RS Starts Curving Down - Relative Strength Line Closes Lower than Previous Day for 2 Consecutive Days
 RS Turns Negative Short Term - RS Closes Below RS of 7 Days Ago
 RS Underperforms Price - Relative Strength Line Not at Highs, While Price Is
 Moving Average Begins to Flatten Out - First Day MA Doesn't Close Higher
 Price Moves Higher on Lighter Volume - Price Makes a New High on Light Volume and 15 Day Average Volume is Less than 50 Day Average
 Price Hits % Target - Price Moves Set % Higher from Entry Price
 Price Hits R Multiple - Price hits (Entry - Stop Multiplied by Setting) and Added to Entry
 Price Hits Overhead Resistance - Price Crosses a Swing High from a Monthly Timeframe Chart from at Least 1 Year Ago
 Price Hits Fib Level - Price Crosses a Fib Extension Drawn From Base High to Low
 Price Hits a Psychological Level - Price Crosses a Multiple of 0 or 5
 Heavy Volume After Significant Move - Above Average and Heaviest Volume of the Last 5 Days 35 Bars or More from Breakout
 Moving Averages Begin to Slope Downward - Moving Averages Fall for 2 Consecutive Days
 Blow Off Action - Highest Volume, Largest Spread, Multiple Gaps in a Row 35 Bars or More Post Breakout
 Late Buying Frenzy - ANTS 35 Bars or More Post Breakout
 Exhaustion Gap - Gap Up 5% or Higher with Price 125% or More Above 200sma
 
ATR Bands (Keltner Channel), Wick and SRSI Signals [MW]Introduction 
This indicator uses a novel combination of ATR Bands, candle wicks crossing the ATR upper and lower bands, and baseline, and combines them with the Stochastic SRSI oscillator to provide early BUY and SELL signals in uptrends, downtrends, and in ranging price conditions.
 How it’s unique 
People generally understand Bollinger Bands and Keltner Channels. Buy at the bottom band, sell at the top band. However, because the bands themselves are not static, impulsive moves can render them useless. People also generally understand wicks. Candles with large wicks can represent a change in pattern, or volatile price movement. Combining those two to determine if price is reaching a pivot point is relatively novel. When Stochastic RSI (SRSI) filtering is also added, it becomes a genuinely unique combination that can be used to determine trade entries and exits.
 What’s the benefit 
The benefit of the indicator is that it can help potentially identify pivots WHEN THEY HAPPEN, and with potentially minimal retracement, depending on the trader’s time window.  Many indicators wait for a trend to be established, or wait for a breakout to occur, or have to wait for some form of confirmation. In the interpretation used by this indicator, bands, wicks, and SRSI cycles provide both the signal and confirmation.
It takes into account 3 elements:
 
 Price approaching the upper or lower band or the baseline - MEANING: Price is becoming extended based on calculations that use the candle trading range.
 A candle wick of a defined proportion (e.g. wick is 1/2 the size of a full candle OR candle body) crosses a band or baseline, but the body does not cross the band or baseline - MEANING: Buyers and sellers are both very active.
 The Stochastic RSI reading is above 80 for SELL signals and below 20 for BUY signals - MEANING: Additional confirmation that price is becoming extended based on the current cyclic price pattern.
 
 How to Use 
SIGNALS
Buy Signals - Green(ish):
 B Signal  - Potential pivot up from the lower band when using the preferred multiplier
 B1 Signal  - Potential pivot up from the lower band when using phi * multiplier
 B2 Signal  - Potential pivot up from the lower band when using 1/2 * multiplier
 B3 Signal  - Potential pivot up from baseline
Sell Signals - Red(ish):
 S Signal  - Potential pivot down from the upper band when using the preferred multiplier
 S1 Signal  - Potential pivot down from the upper band when using
 S2 Signal  - Potential pivot down from the upper band when using 1/2 * multiplier
 S3 Signal  - Potential pivot down from the baseline
DISCUSSION
During an uptrend or downtrend, signals from the baseline can help traders identify areas where they may enter the trending move with the least amount of drawdown. In both cases, entry points can occur with baseline signals in the direction of the trend. 
For example, in an uptrend (when the price is forming higher highs and higher lows, or when the baseline is rising), price tends to oscillate between the upper band and baseline. In this case, the baseline BUY signal (B3) can show an entry point.
In a downtrend (when the price is forming lower highs and lower lows, or when the baseline is falling), price tends to oscillate between the baseline and the lower band. In this case, the baseline SELL signal (S3) can show an entry point.
During consolidation, when price is ranging, price tends to oscillate between the upper and lower bands, while crossing through the baseline unperturbed. Here, entry points can occur at the upper and lower bands. 
When all conditions are met at the lower band during consolidation, a BUY signal (B), can occur. This signal may also occur prior to a break out of consolidation to the upside.
When all conditions are met at the upper band during consolidation, a SELL signal (S), can occur. This signal may also occur prior to a break out of consolidation to the downside.
Additional B1, B2, and S1, and S2 signals can be displayed that use the bands based on a multiplier that is half that of the primary one, and phi (0.618) times the primary multiplier as a way to quickly check for signals occurring along different, but related, bands.
 Calculations 
ATR Bands, or Keltner Channels, are a technical analysis tool that are used to measure market volatility and identify overbought or oversold conditions in the trading of financial instruments, such as stocks, bonds, commodities, and currencies.  ATR Bands consist of three lines plotted on a price chart:
Middle Band, Basis, or Baseline: This is typically a simple moving average (SMA) of the closing prices over a certain period. It represents the intermediate-term trend of the asset's price.
Upper Band: This is calculated by adding a certain number of ATRs to the middle band (SMA). The upper band adjusts itself with the increase in volatility.
Lower Band: This is calculated by subtracting the same number of ATRs from the middle band (SMA). Like the upper band, the lower band adjusts to changes in volatility.
The candle wick signals occur if the wick is at the specified ratio compared to either the entire candle or the candle body. The upper band, lower band, and baseline signals happen if the wick is the specified ratio of the total candle size. For the major signals for upper and lower bands, these occur when the wick extends outside of the bands while closing a candle inside of the bands. For the baseline signals, they occur if a wick crosses a baseline but closes on the other side.
 Settings 
CHANNEL SETTINGS
 
 Baseline EMA Period (Default: 21): Period length of the moving average basis line.
 ATR Period (Default: 21): The number of periods over which the Average True Range (ATR) is calculated.
 Basis MA Type (Default: SMA): The moving average type for the basis line.
 Multiplier (Default: 2.5: The deviation multiplier used to calculate the band distance from the basis line.
 
ADDITIONAL CHANNELS
 
 Half of Multiplier Offset (Default: True): Toggles the display of the ATR bands that are set a distance of half of the ATR multiplier.
 Quarter of Multiplier Offset (Default: false): Toggles the display of the ATR bands that are set a distance of one quarter of the ATR multiplier.
 Phi (Φ) Offset (Default: false): Toggles the display of the ATR bands that are set a distance of phi (Φ) times the ATR multiplier.
 
WICK SETTINGS FOR CANDLE FILTERS
 
 Wick Ratio for Bands (Default: 0.4): The ratio of wick size to total candle size for use at upper and lower bands.
 Wick Ratio for Baseline (Default: 0.4): The ratio of wick size to total candle size for use at baseline.
 Use Candle Body (rather than full candle size) (Default: false): Determines whether wick calculations use the candle body or the entire candle size.
 
VISUAL PREFERENCES - SIGNALS
 
 Show Signals (Default: true): Allows signal labels to be shown.
 Show Signals from 1/2 Band Offset (Default: false): Toggle signals originating from 1/2 offset upper and lower bands.
 Show Signals from Phi (Φ) Band Offset (Default: false): Toggle signals originating from phi (Φ) offset upper and lower bands.
 Show Baseline Signals (Default: false): Toggle Baseline signals.
 
VISUAL PREFERENCES - BANDS
 
 Show ATR (Keltner) Bands (Default: true): Use a background color inside the Bollinger Bands.
 Fill Bands (Default: true): Use a background color inside the Bollinger Bands.
 
STOCHASTIC SETTINGS 
 
 Use Stochastic RSI Filtering (Default: False): This will only trigger some SELL signals when the stochastic RSI is above 80, and BUY signals when below 20.
 K (Default: 3): The smoothing level for the Stochastic RSI.
 RSI Length (Default: 14): The period length for the RSI calculation.
 Stochastic Length (Default: 8): The period length over which the stochastic calculation is performed.
 
 Other Usage Notes and Limitations 
To understand future price movement, this indicator assumes that 3 things must be known:
 
 Evidence of a change of market structure. This can be demonstrated by increased volatility, consolidation, volume spikes (which can be tracked with the MW Volume Impulse Indicator) or, in the case of this indicator, candle wicks. 
 The potential cause of the change. It could be a VWAP line (which can be tracked with the Multi VWAP  , and Multi VWAP from Gaps   indicators), an event, an important support or resistance level, a key moving average, or many other things. This indicator assumes the ATR bands can be a cause.
 The current position in the price cycle. Oscillators like the RSI, and MACD, are typical measures of price oscillation (other oscillators like the Price and Volume Stochastic Divergence   indicator can also be useful). This indicator uses the Stochastic RSI oscillator to determine overbought and oversold conditions.
 
When evidence of the change appears, and the potential cause of the change is identified, and the price oscillation is at a favorable position for the desired trading direction, this indicator will generate a signal.
ATR Bands (or Keltner Channels) are used to determine when price might “revert to the mean”. Crossing, or being near the upper or lower band, can indicate an overbought or oversold condition, which could lead to a price reversal. By tracking the behavior of candle wicks during these events, we can see how active the battle is between buyers and sellers. 
If the top of a wick is large, it may indicate that sellers are aggressively attempting to bring the price down. Conversely, if the bottom wick is large, it can indicate that buyers are actively trying to counter the price action caused by selling pressure.
When this wicking action occurs at times when price is not near the upper band, lower band, or baseline, it could indicate the presence of an important level. That could mean a nearby VWAP line, a supply or demand zone, a round price number, or a number of other factors. In any case, this wick may be the first indication of a price reversal.
Shorter baseline periods may be better for short period trading like scalping or day trading, while longer period baselines can show signals that are better suited to swing trading, or longer term investing. 
It's important for traders to be aware of the limitations of any indicator and to use them as part of a broader, well-rounded trading strategy that includes risk management, fundamental analysis, and other tools that can help with reducing false signals, determining trend direction, and providing additional confirmation for a trade decision. Diversifying strategies and not relying solely on one type of indicator or analysis can help mitigate some of these risks.
The TradingView platform allows a maximum of 500 labels per chart. This means that if your settings allow for a lot of signals, labels for earlier ones may not appear if the total number of labels exceeds 500 for the chart.
MTF HalfTrendIntroduction 
A half-trend indicator is a technical analysis tool that uses moving averages and price data to find potential trend reversal and entry points in the form of graphical arrows showing market turning points.
The salient features of this indicator are:
- It uses the phenomenon of moving averages.
- It is a momentum indicator.
- It can indicate a trend change.
- It is capable of detecting a bullish or bearish trend reversal.
- It can signal to sell/buy. 
- It is a real-time indicator.
 Multi-Timeframe Application 
A standout feature is its flexibility across timeframes. Traders have the liberty to choose any timeframe on the chart, enhancing the tool's versatility and making it suitable for both short-term and long-term analyses.
 Principle of the Half Trend indicator 
This indicator is based on the moving averages. The moving average is the average of the fluctuation or change in the price of an asset. These averages are taken for a time interval. 
So, a half-trend indicator takes the moving averages phenomenon as its principle for working. The most commonly used moving averages in a half trend indicator are:
- Relative strength index (RSI)
- EMA (estimated moving average)
 Components of a Half Trend indicator 
There are two main components of a half trend indicator:
- Half trend line
- Arrows
- ATR lines
 Half trend line 
Half trend line represents this indicator on a candlestick chart. This line shows the trend of a chart in real-time. A half-trend line is based on the moving averages.
There are two further components of a half-trend line:
- Redline
- Blue line
A red line represents a bearish trend. When the half-trend line turns red, a trend is facing a dip. It is time for the bears to take control of the market. A bearish control of the market represents the domination of sellers in the market. 
On the other hand, the blue line represents the bullish nature of the market. It tells a trader that the bullish sentiment of the market is prevailing. A bullish market means the number of buyers is significantly greater than the number of sellers.
Moreover, a trader can change these colors to his choice by customization.
 Arrows  
There are two types of arrows in this indicator which help a trader with the entry and exit points. These arrows are,
- Blue arrow
- Red arrow
A blue arrow signals a buying trade; on the other hand, a red arrow tells a trader about the selling of the assets. These arrows work with the moving average line to formulate a trading strategy.
The color of these arrows is changed if a trader desires so.
 ATR lines 
The ATR blue and red lines represent the Average True Range of the Half trend line. They may be used as stop loss or take profit levels.
 Pros and Cons 
Pros
- It is a very easy to eyes indicator.
- This is a very useful friendly indicator.
- It provides sufficient information to beginner traders.
- It provides sufficient information for entry points in a trade.
- A half-trend indicator provides a good exit strategy for a trader.
- It provides information about market reversals.
- It helps a trader to find a bullish and bearish sentiment in the market.
Cons
- It is a real-time indicator. So, it can lag.
- The lagging of this indicator can lead to miss opportunities.
- The most advanced and professional traders may not rely on this indicator for crucial trading decisions.
- The lagging of this indicator can predict false reversals of the market.
- It can create false signals.
- It requires the confluence of the other technical tools for a better success ratio.
 Settings for Half Trend indicator 
The default settings for half trend indicator are:
Amplitude = 2
Channel deviation = 2
Different markets or financial instruments may require different settings for optimal execution.   
Amplitude:  The degree that the Half trend line takes the internal variables into consideration.  The higher the number, the fewer trades.  The default value is 2.
Channel deviation: The ATR value calculation from the Half trend line.  The default value is 2.
 Trading strategy 
It is an effective indicator in terms of strategy formation for a trading setup. The new and beginner trades can take benefit from this indicator for the formulation of a good trading setup. This indicator also helps seasoned and professional traders formulate a good trading setup with other technical tools.
The trading strategy involving a half-trend indicator is divided into three parts:
- Entry and exit
- Risk management
- Take profit
 Entry and exit 
It is an effective indicator that provides sufficient information about the entry and exit points in a trading setup. The profit of a trader is directly proportional to the appropriate entry and exit points. So, it is a crucial step in any trading setup. 
The blue and red arrows provide information about the entry and exit points in a trading setup. Furthermore, the entry and exit for the bullish and bearish setups are as follows.
Entry and exit for a bullish setup
If a blue arrow appears under the half-trend line, it means the bullish sentiment of the market is getting stronger in the future. So, it is a signal for entry in a bullish setup.
As the red arrow appears on the chart, it is a signal to exit your trade. The red arrow represents a reversal in the market, so it is a good opportunity to close your trade in a bullish setup.
Entry and exit for a bearish setup
Suppose a red arrow appears above the red moving average line. It is a good opportunity to enter a trade in a bearish setup. The red line represents that sooner the sellers are going to take control and the value of the asset is about to face a dip. So it is the best time to make your move.
As the opposite arrow appears in the chart, it is time to exit from a bearish trade setup.
 Re-entering a position  
Bullish setup
- The half-trend line is blue.
- At least one candle closes below the blue half-trend line.
- Enter on the candle that closes above the blue half-trend line.
Bearish setup
- The half-trend line is red.
- At least one candle closes above the red half-trend line.
- Enter on the candle that closes below the red half-trend line.
 Risk management 
Risk management is an integral part of a trading setup. It is an important step to protect your potential profits and losses. 
When trading in a bullish market, place the stop loss at the prior swing low. It will help you to cut your losses in case the prices move to the lower end.
In the case of a bearish market, place your stop loss above the prior swing high.
A trader may trail the stop loss using the ATR lines.
 
The new trader often makes mistakes in the placement of the stop loss. If you don’t place the stop loss at an appropriate point. It can drain your bank account and ruin your trading experience. Is is recommended not to risk more than 2% of your trading account, per trade.
 Take profit 
The blue ATR line may be used as one take profit level on a bullish setup followed by the previous swing high. The signal reversal would indicate the final take profit and closing of any position.
The red ATR line may be used as one take profit level on a bearish setup followed by the previous swing low. The signal reversal would indicate the final take profit and closing of any position.
 Conclusion 
A half trend indicator is a decent indicator that can transform your trading experience. It is a dual indicator that is based on the moving averages as well as helps you to form a trading strategy. If you are a new trader, this indicator can help you to learn and flourish in the trading universe. If you are a seasoned trader, I recommend you use this indicator with other technical analysis tools to enhance your success ratio.
All credits go to:
- @everget the original creator of this indicator (I just added the MTF capability).
- Ali Muhammad original author of much of the description used.
ICT Concept [TradingFinder] Order Block | FVG | Liquidity Sweeps🔵 Introduction 
The "ICT" style is one of the subsets of "Price Action" technical analysis. ICT is a method created by "Michael Huddleston", a professional forex trader and experienced mentor. The acronym ICT stands for "Inner Circle Trader".
The main objective of the ICT trading strategy is to combine "Price Action" and the concept of "Smart Money" to identify optimal entry points into trades. However, finding suitable entry points is not the only strength of this approach. With the ICT style, traders can better understand price behavior and adapt their trading approach to market structure accordingly.
Numerous concepts are discussed in this style, but the key practical concepts for trading in financial markets include "Order Block," "Liquidity," and "FVG".
  
🔵 How to Use 
🟣Order Block
Order blocks are a specific type of "Supply and Demand" zones formed when a series of orders are placed in a block. These orders could be created by banks or other major players. Banks typically execute large orders in blocks during their trading sessions. If they were to enter the market directly with a small quantity, significant price movements would occur before the orders are fully executed, resulting in less profit. To avoid this, they divide their orders into smaller, manageable positions. Traders should look for "buy" opportunities in "demand order blocks" areas and "sell" opportunities in "supply order blocks".
  
🟣Liquidity 
These levels are where traders aim to exit their trades. "Market Makers" or smart money usually collects or distributes their trading positions near levels where many retail traders have placed their "Stop Loss" orders. When the liquidity resulting from these losses is collected, the price often reverses direction.
A "Stop Hunt" is a move designed to neutralize liquidity generated by triggered stop losses. Banks often use significant news events to trigger stop hunts and acquire the liquidity released in the market. If, for example, they intend to execute heavy buy orders, they encourage others to sell through stop hunts.
As a result, if there is liquidity in the market before reaching the order block region, the credibility of that order block is higher. Conversely, if liquidity is near the order block, meaning the price reaches the order block before reaching the liquidity area, the credibility of that order block is lower.
  
🟣FVG (Fair Value Gap)
To identify the "Fair Value Gap" on the chart, one must analyze candle by candle. Focus on candles with large bodies, examining one candle and the one before it. The candles before and after this central candle should have long shadows, and their bodies should not overlap with the body of the central candle. The distance between the shadows of the first and third candles is called the FVG range.
 These zone function in two ways :
    •Supply and Demand zone: In this case, the price reacts to these zone, and its trend reverses.
    •Liquidity zone: In this scenario, the price "fills" the zone and then reaches the order block.
 Important Note:  In most cases, FVG zone with very small width act as supply and demand zone, while zone with a significant width act as liquidity zone, absorbing the price.
  
🔵 Setting 
🟣Order Block 
 Refine Order Block : When the option for refining order blocks is Off, the supply and demand zones encompass the entire length of the order block (from Low to High) in their standard state and remain unaltered. On the option for refining order blocks triggers the improvement of supply and demand zones using the error correction algorithm. 
 Refine Type : The enhancement of order blocks via the error correction algorithm can be executed through two methods: Defensive and Aggressive. In the Aggressive approach, the widest possible range is taken into account for order blocks. 
 Show High Levels : If major high levels are to be displayed, set the option for showing high level to Yes. 
 Show Low Levels : If major low levels are to be displayed, set the option for showing low level to Yes. 
 Show Last Support : If showing the last support is desired, set the option for showing last support to Yes. 
 Show Last Resistance : If showing the last resistance is desired, set the option for showing last resistance to Yes.
  
🟣 FVG 
 FVG Filter : When FVG filtering is activated, the number of FVG areas undergoes filtration based on the specified algorithm. 
 FVG Filter Types :
1. Very Aggressive : Apart from the initial condition, an additional condition is introduced. For an upward FVG, the maximum price of the last candle should exceed the maximum price of the middle candle. Similarly, for a downward FVG, the minimum price of the last candle should be lower than the minimum price of the middle candle. This mode eliminates a minimal number of FVGs.
2. Aggressive : In addition to the conditions of the Very Aggressive mode, this mode considers the size of the middle candle; it should not be small. Consequently, a larger number of FVGs are eliminated in this mode.
3. Defensive : Alongside the conditions of the Very Aggressive mode, this mode takes into account the size of the middle candle, which should be relatively large with the majority of it comprising the body. Furthermore, to identify upward FVGs, the second and third candles must be positive, whereas for downward FVGs, the second and third candles must be negative. This mode filters out a considerable number of FVGs, retaining only those of suitable quality.
4. Very Defensive : In addition to the conditions of the Defensive mode, the first and third candles should not be very small-bodied doji candles. This mode filters out the majority of FVGs, leaving only the highest quality ones. Show Demand FVG: Enables the display of demand-related boxes, which can be toggled between off and on. Show Supply FVG: Enables the display of supply-related boxes along the path, which can also be toggled between off and on.
  
🟣 Liquidity 
 Statics Liquidity Line Sensitivity : A value ranging from 0 to 0.4. Increasing this value reduces the sensitivity of the "Statics Liquidity Line Detection" function and increases the number of identified lines. The default value is 0.3. 
 Dynamics Liquidity Line Sensitivity : A value ranging from 0.4 to 1.95. Increasing this value enhances the sensitivity of the "Dynamics Liquidity Line Detection" function and decreases the number of identified lines. The default value is 1.
 
 Statics Period Pivot : Default value is set to 8. By adjusting this value, you can specify the period for static liquidity line pivots. 
 Dynamics Period Pivot : Default value is set to 3. By adjusting this value, you can specify the period for dynamic liquidity line pivots.
You can activate or deactivate liquidity lines as necessary using the buttons labeled "Show Statics High Liquidity Line," "Show Statics Low Liquidity Line," "Show Dynamics High Liquidity Line," and "Show Dynamics Low Liquidity Line".
  
Moving Average PropertiesThis indicator calculates and visualizes the Relative Smoothness (RS) and Relative Lag (RL) or call it accuracy of a selected moving average (MA) in comparison to the SMA of length 2 (the lowest possible length for a moving average and also the one closest to the price). 
Median RS (Relative Smoothness):
Interpretation: The median RS represents the median value of the Relative Smoothness calculated for the selected moving average across a specified look-back period (max bar lookback is set at 3000).
Significance: A more negative (larger) median RS suggests that the chosen moving average has exhibited smoother price behavior compared to a simple moving average over the analyzed period. A less negative  value indicates a relatively choppier price movement.
Median RL (Relative Lag):
Interpretation: The median RL represents the median value of the Relative Lag calculated for the selected moving average compared to a simple moving average of length 2.
Significance: A higher median RL indicates that the chosen moving average tends to lag more compared to a simple moving average. Conversely, lower values suggest less lag in the selected moving average.
Ratio of Median RS to Median RL:
Interpretation: This ratio is calculated by dividing the median RS by the median RL.
Significance: Traders might use this ratio to assess the balance between smoothness and lag in the chosen moving average. This a measure of for every % of lag what is the smoothness achieved. This can be used a benchmark to decide what length to choose for a MA to get an equivalent value between two stocks. For example a TESLA stock on a 15 minute time frame with a length of 12 has a value (ratio of RS/RL)  of -150 , where as APPLE stock of length 35 on a 15 minute chart also has a value (ratio of RS/RL)  of -150.  
I imply that a MA of length 12 working on TESLA stock is equivalent to  MA of length 35 on a APPLE stock. (THIS IS A EXAMPLE). 
My assumption is that finding the right moving average length for a stock isn't a one-size-fits-all situation. It's not just about using a fixed length; it's about adapting to the unique characteristics of each stock. I believe that what works for one stock might not work for another because they have different levels of smoothness or lag in their price movements. So, instead of applying the same length to all stocks, I suggest adjusting the length of the moving average to match the values that we know work best for achieving the desired smoothness or lag  or its ratio (RS/RL). This way, we're customizing the indicator for each stock, tailoring it to their individual behaviors rather than sticking to a one-size-fits-all approach.
Users can choose from various types of moving averages (EMA, SMA, WMA, VWMA, HMA) and customize the length of the moving average. RS measures the smoothness of the MA, while RL measures its lag compared to a simple moving average. The script plots the median RS and RL values, the selected MA, and the ratio of median RS to median RL on the price chart. Traders can use this information to assess the performance of different moving averages and potentially inform their trading decisions.
Astro-CandlesThis script is just for fun. 
It generates a Planet and a Zodiac Sign at the close of each candle.
The candle is "sliced" into 7 sections, one for each Planet and the close lands in one of those sections.
The candle is "sliced" into 12 sections, one for each Zodiac and the open lands in one of those sections.
You could use it to generate a quick "answer" to a question.
You could use to contemplate your day if you use the daily candle.
You could even try to use it to trade and make some money, somehow.
Every combination should be possible, Moon in Aries, Mars in Capricorn, whatever.
Since it's based on candle structure, it might yield some interesting information.
Or not!
Enjoy!
Candlesticks Patterns [TradingFinder] Pin Bar Hammer Shooting🔵 Introduction 
Truly, the title "TradingView" doesn't do justice to this excellent website, and that's why I've written about its crucial aspect. In this indicator, the identification of all candlesticks known as "Pin bars" is explored. 
 These candlesticks include the following: 
-  Hammer : A Pin bar formed at the end of a bearish trend, with its body being either bearish or bullish.
-  Shooting Star : Formed at the end of a bullish trend, with its body being either bearish or bullish.
-  Hanging Man : Formed during an upward trend, characterized by a candle with a lower shadow.
-  Inverted Hammer : Formed during a downward trend, characterized by a candle with an upper shadow.
🟣  Important : For ease of use, we refer to these four candlestick patterns as Pin Bars and categorize them into the main friends "Bullish" and "Bearish."
🟣  Important : In all sources, Hanging Man and Inverted Hammer are referred to as "Reversal candles." However, in reality, whenever they appear after breaking a significant area (Break Out), we expect these candles to signal a continuation of the trend and confirmation in the direction of the trend.
🟣  Important : One of the best signs of market manipulation and entry by market giants is the "Ice Berg." So, it provides one of the best trading opportunities.
🔵 Reason for Creation 
Many traders, especially volume traders, use Pin bars as confirmation and enter the market after their occurrence. In this indicator, all four patterns are identified and displayed in a colored candle format, using "triangle" and "circle."
When they are evident on the chart, directly or by drawing a horizontal line, they give us good alerts for reversal or continuation areas.
🔵 Information Table 
1. Red circle: Pin bars formed in a downtrend.
2. Blue circle: Bullish Pin bars formed in an uptrend.
3. Black triangle: Bearish Pin bar candle in an uptrend.
4. Blue triangle: Bullish Pin bar candle in a downtrend.
  
🔵 Settings 
Trend Detection Period: A special feature that considers smaller or larger fluctuations. If individual price waves need to be considered, use lower numbers; if the overall trend direction is desired, use larger numbers (e.g., 5-7 or higher). This precisely sets the Zigzag or Pivot format, not displayed but considered in the indicator calculation.
 Trend Effect : By changing the Trend Effect status to "Off," all Pin bars, whether bullish or bearish, are displayed regardless of the current market trend. If the status remains "On," only Pin bars in the direction of the main market trend are shown.
🟣  Important : Black triangles "Number 3" and blue triangles "Number 4" displayed in the information table section, as explained in the "Information Table" section.
 Show Bullish Pin Bar : When set to "Yes," displays bullish Pin bars; when set to "No," does not display them.
 Show Bearish Pin Bar : When set to "Yes," allows the display of bearish Pin bars; when set to "No," does not display them.
 Bullish Pin Bar Setting : Using the "Ratio Lower Shadow to Body" and "Ratio Lower Shadow to Higher Shadow" settings, you can customize your bullish Pin bar candles. Larger numbers impose stricter conditions for identifying bullish Pin bars.
 Bearish Pin Bar Setting : Using the "Ratio Higher Shadow to Body" and "Ratio Higher Shadow to Lower Shadow" settings, you can customize your bearish Pin bar candles. Larger numbers impose stricter conditions for identifying bearish Pin bars.
 Show Info Table : Allows the display or non-display of the information table (located at the bottom of the page and on the right side).
  
🔵 How to Use 
At the end of a downtrend, look for "Hammer" candles, easily identified one by one.
  
To identify the "Shooting Star" candle pattern at the end of an uptrend; expect a price reversal in the downtrend.
  
For trades in the downward direction, wait for the formation of an "Inverted Hammer" Pin bar.
  
And finally, in an uptrend, where a "Hanging Man" candle can form.
  
🔵 Features 
For better visualization, triangles and circles are used above the candles, but they can be easily removed. All Pin bars are displayed in color with the following meanings:
- Black-bodied candle: Inverted Hammer
- Turquoise blue candle: Hammer
- Pink candle: Hanging Man
- Red candle: Shooting Star
🟣 Important : The capability to detect the powerful two-candle pattern "Tweezer Top" at the end of an uptrend emerges by forming two "Shooting Star" candles side by side.
  
Similarly, the two-candle pattern "Tweezer Bottom" is created at the end of a downtrend with the formation of two "Hammer" candles side by side. To identify the "Tweezer" pattern, make sure the settings in the "Trend Effect" section are set to "Off."
  
🟣 Auxiliary Indicators 
During the start of trading sessions such as Asia, London, and New York, where the highest liquidity exists, alongside this indicator, you can use the Trading Sessions indicator.
 Sessions 
The combination of Order Blocks "-OB" and "+OB" with candles is one of the best trading methods. The indicator that identifies order blocks, along with this indicator, can yield remarkable results in the success of Pin bar candles.
 Order Blocks Finder 
The trading toolset "TFlab" presents this indicator. To benefit from all indicators, we invite you to visit our page " TFlab Scripts ".
Live Economic Calendar by toodegrees⚠️ PLEASE READ ⚠️ 
Although this indicator is accurate in showcasing live and upcoming News Events, checking the original sources is always suggested. This indicator aims to save Time, but due to limitations it may not be 100% correct 100% of the Time.
 Description: 
The Live Economic Calendar indicator seamlessly integrates with external news sources to provide real-Time, upcoming, and past financial news directly on your Tradingview chart.
By having a clear understanding of when news are planned to be released, as well as their respective impact, analysts can prepare their weeks and days in advance. These injections of volatility can be harnessed by analysts to support their thesis, or may want to be avoided to ensure higher probability market conditions. Fundamentals and news releases transcend the boundaries of technical analysis, as their effects are difficult to predict or estimate.
Designed for both novice and experienced traders, the Live Economic Calendar indicator enhances your analysis by keeping you informed of the latest and upcoming market-moving news.
 This is achieved with three different visual components: 
 
 News Table:  A dedicated News Table shows the Day of the Week, Date, Time of the Day, Currency, Expected Impact, and News Name for each event (in chronological order). Once a news event has occurred, or the day is over, it will be greyed out – helping to focus on the next upcoming news events.
  
 News Lines:  Vertical lines plotted in the future help analysts monitor upcoming news events; vertical lines in the past help analysts spot and backtest previous news events that already occurred.
  
 News Labels:  Color-coded news labels will plot once the news events have occurred. This not only gives analysts a minimalistic visual cue, but also retains the information of which news were released at that Time in their tooltips.
  
 
 Forex Factory Calendar News Feed: 
The Forex Factory Data Feed includes news events from January 2007 to the present. The data is updated daily. Please see the  Technical Description  below for more information.
  
Forex Factory provides news for all major currencies and markets:
 
 Australia (AUD)
 Canada (CAD)
 Switzerland (CHF)
 China (CNY)
 European Union (EUR)
 United Kingdom (GBP)
 Japan (JPY)
 New Zealand (NZD)
 United States of America (USD)
 
Further, there are four types of news impact, defined by respective color-coding which is retained to avoid confusion:
 
 ⚪ Holiday 
 🟡 Low Impact
 🟠 Medium Impact
 🔴 High Impact
 
News' Time of the day data is in 24H format, and 'All Day' news are marked at Daily candle open.
 ⚠️ Original Release Notes ⚠️ 
 
 The original release of this indicator supports the  Forex Factory News Calendar in EST  (New York Time). Future updates will include multiple news sources, as well as supporting different Timezones.
 Given Data limitations, the  Daily chart  can omit some data due to the market being close on some days. This will be fixed in the future once an efficient solution is implemented.
 
 Key Features: 
 
 Impact-Based News Filtering:  Filter news items based on their expected impact (holiday, low, medium, high) to focus on the most market-critical information.
 Symbol-Specific News:  Automatically filter news to display only what's relevant to the currency pair or trading symbol you are analyzing.
 Custom Currency News:  Want to see more than the news relevant to the current symbol? Toggle which markets' news you are most interested in.
 Chart History:  Keep your charts clean by displaying only the drawings of Today's news, or This Week's news.
 Custom Lookback:  Look further back in Time by choosing a custom number of Lookback Days, allowing you to backtest and keep in mind salient news events from the past.
 Line and Label Customization:  Both the News Lines and Labels are highly customizable (except the colors), allowing you to make the indicator yours.
 Table History:  Choose whether to focus on Today's news only, or the news for This Week.
 Table Customization:  The table colors and position are highly customizable, allowing you to make it fit your visual preference and your layouts' aesthetic.
 
 "Wondering how it's done? 👇" 
 Technical Description: 
This script utilizes  Pine Seeds , a service integrated with TradingView for importing custom data. This stunning feature enables users to upload and access custom End Of Day (EOD) data, which can be updated as frequently as five times daily.
This data can be imported in one of two formats:
 
 Single Value: integer or float
 Candle Data: open, high, low, close, volume
 
Upon encountering Pine Seeds, I recognized its potential for importing financial news events. Given that Forex Factory is a primary source of financial news in my personal analysis, integrating it into my layouts seemed like an exciting opportunity. This integration is expected to provide significant value to users looking to integrate additional news feeds all in one place.
 Development Challenges: 
 
 Format Limitations:  News events must be converted into numerical values for import, due to the required Pine Seeds format.
 Amount of Data:  With all currencies considered, the system may encounter over 40 news events in a single day.
 Data Availability:  The reliance on End Of Day (EOD) data means that information for the current day is displayed with a delay, and accessing future data is not possible.
 
 Solutions: 
 
 Encoding:  Each news event is encoded as an integer in the "DCHHMMITYP" format.
D = day of the week
C = currency
HHMM = Time of day
I = news impact
TYP = event ID (see  Event Library A  and  Event Library B )
To ensure data assignment for each candle across the open, high, low, close, and volume series, the value "999" is used as a placeholder:
  
 Importing:  Utilizing the encoding system, up to five news events per day can be imported for a singular Pine Seeds custom symbol. 
By creating multiple custom Pine Seeds Symbols, efficient imports of a larger number of events is then easily achievable. Nine unique symbols have been established, accommodating up to 45 news events per day. 
These symbols are searchable, and accessible as " TOODEGREES_FOREX_FACTORY_SLOT_N " where N ranges from 1 to 9. 
The Pine Seeds data feed appears as follows:
  
 Uploading Schedule:  To ensure analysts are informed about current and upcoming week's news, events are uploaded one week in advance. 
This approach is vital for preparing for potential market impacts across various asset classes and currencies, allowing visibility of an entire week's news ahead of Time.
  
 
 Data Scraping: 
Unfortunately Forex Factory doesn't offer an API to fetch their news feed.
Hence an ad hoc python scraper was developed to read and save news events from January 2007 till the present leveraging Selenium. The scraper algorithm is part of a larger script responsible for scraping data, formatting data, and creating all necessary datasets.
The pseudo-code for the python script is as follows:
 
 Read and save news event data on Forex Factory
 Format day of the week, currency, Time of the day, and impact data for the Encoding
 Encode and save News Event IDs – Event ID dataset is created
 Format news data for Pine Seeds (roll-back date by one week, assign news to open, high, low, close, and volume values)
 Create Pine Seeds Datasets
 
 This script is ran everyday at Futures market close (16:00 EST) to update the last part of the each dataset, ensuring accuracy, and taking into account last-minute news additions or revisions. 
Once the data (next week's news) is imported by the Live Economic Calendar indicator, it's immediately decoded by leveraging the  Forex Factory Decoding Library , and saved into an array.
Upon a new week open, the decoded data is used to plot news events on the chart and in the news table. 
See the inner workings of these processes in the  Forex Factory Utility Library .
Although these libraries are specifically built for this indicator, feel free to use them to create your own scripts. Looking forward to see what the Pine Script community comes up with!
Thank you for making it this far. Enjoy!
Ciao,
toodegrees
This tool is available ONLY on the TradingView platform.
 Terms and Conditions 
 
 Our charting tools are provided for informational and educational purposes only and do not constitute financial, investment, or trading advice. Our charting tools are not designed to predict market movements or provide specific recommendations. Users should be aware that past performance is not indicative of future results and should not be relied upon for making financial decisions. By using our charting tools, the user agrees that Toodegrees and the Toodegrees Team are not responsible for any decisions made based on the information provided by these charting tools. The user assumes full responsibility and liability for any actions taken and the consequences thereof, including any loss of money or investments that may occur as a result of using these products. Hence, by using these charting tools, the user accepts and acknowledges that Toodegrees and the Toodegrees Team are not liable nor responsible for any unwanted outcome that arises from the development, or the use of these charting tools. Finally, the user indemnifies Toodegrees and the Toodegrees Team from any and all liability.
 By continuing to use these charting tools, the user acknowledges and agrees to the Terms and Conditions outlined in this legal disclaimer.
VIX Statistical Sentiment Index [Nasan]** THIS IS ONLY FOR US STOCK MARKET**
The indicator analyzes market sentiment by computing the Rate of Change (ROC) for the VIX and S&P 500, visualizing the data as histograms with conditional coloring. It measures the correlation between the VIX, the specific stock, and the S&P 500, displaying the results on the chart. The reliability measure combines these correlations, offering an overall assessment of data robustness. One can use this information to gauge the inverse relationship between VIX and S&P 500, the alignment of the specific stock with the market, and the overall reliability of the correlations for informed decision-making based on the inverse relationship of  VIX and price movement.   
**WHEN THE VIX ROC IS ABOVE ZERO (RED COLOR) AND RASING ONE CAN EXPECT THE PRICE TO MOVE DOWNWARDS, WHEN THE VIX ROC IS BELOW ZERO (GREEN)AND DECREASING ONE CAN EXPECT THE PRICE TO MOVE UPWARDS"
Understanding the VIX Concept:
The VIX, or Volatility Index, is a widely used indicator in finance that measures the market's expectation of volatility over the next 30 days. Here are key points about the VIX:
Fear Gauge:
Often referred to as the "fear gauge," the VIX tends to rise during periods of market uncertainty or fear and fall during calmer market conditions.
Inverse Relationship with Market:
The VIX typically has an inverse relationship with the stock market. When the stock market experiences a sell-off, the VIX tends to rise, indicating increased expected volatility.
Implied Volatility:
The VIX is derived from the prices of options on the S&P 500. It represents the market's expectations for future volatility and is often referred to as "implied volatility."
Contrarian Indicator:
Extremely high VIX levels may indicate oversold conditions, suggesting a potential market rebound. Conversely, very low VIX levels may signal complacency and a potential reversal.
VIX vs. SPX Correlation:
This correlation measures the strength and direction of the relationship between the VIX (Volatility Index) and the S&P 500 (SPX).
A negative correlation indicates an inverse relationship. When the VIX goes up, the SPX tends to go down, and vice versa.
The correlation value closer to -1 suggests a stronger inverse relationship between VIX and SPX.
Stock vs. SPX Correlation:
This correlation measures the strength and direction of the relationship between the closing price of the stock (retrieved using src1) and the S&P 500 (SPX).
This correlation helps assess how closely the stock's price movements align with the broader market represented by the S&P 500.
A positive correlation suggests that the stock tends to move in the same direction as the S&P 500, while a negative correlation indicates an opposite movement.
Reliability Measure:
Combines the squared values of the VIX vs. SPX and Stock vs. SPX correlations and takes the square root to create a reliability measure.
This measure provides an overall assessment of how reliable the correlation information is in guiding decision-making.
Interpretation:
A higher reliability measure implies that the correlations between VIX and SPX, as well as between the stock and SPX, are more robust and consistent.
One  can use this reliability measure to gauge the confidence they can place in the correlations when making decisions about the specific stock based on VIX data and its correlation with the broader market.
Liquidity Price Depth Chart [LuxAlgo]The Liquidity Price Depth Chart is a unique indicator inspired by the visual representation of order book depth charts, highlighting sorted prices from bullish and bearish candles located on the chart's visible range, as well as their degree of liquidity.
Note that changing the chart's visible range will recalculate the indicator.
🔶  USAGE 
The indicator can be used to visualize sorted bullish/bearish prices (in descending order), with bullish prices being highlighted on the left side of the chart, and bearish prices on the right. Prices are highlighted by dots, and connected by a line.
  
The displacement of a line relative to the x-axis is an indicator of liquidity, with a higher displacement highlighting prices with more volume.
  
These can also be easily identified by only keeping the dots, visible voids can be indicative of a price associated with significant volume or of a large price movement if the displacement is more visible for the price axis. These areas could play a key role in future trends.
  
Additionally, the location of the bullish/bearish prices with the highest volume is highlighted with dotted lines, with the returned horizontal lines being useful as potential support/resistances.
🔹 Liquidity Clusters 
  
Clusters of liquidity can be spotted when the Liquidity Price Depth Chart exhibits more rectangular shapes rather than "V" shapes. 
The steepest segments of the shape represent periods of non-stationarity/high volatility, while zones with clustered prices highlight zones of potential liquidity clusters, that is zones where traders accumulate positions.
🔹 Liquidity Sentiment 
  
At the bottom of each area, a percentage can be visible. This percentage aims to indicate if the traded volume is more often associated with bullish or bearish price variations.
In the chart above we can see that bullish price variations make 63.89% of the total volume in the range visible range.
🔶  SETTINGS 
🔹 Bullish Elements 
 
 Bullish Price Highest Volume Location: Shows the location of the bullish price variation with the highest associated volume using one horizontal and one vertical line.
 Bullish Volume %: Displays the bullish volume percentage at the bottom of the depth chart.
 
🔹 Bearish Elements 
 
 Bearish Price Highest Volume Location: Shows the location of the bearish price variation with the highest associated volume using one horizontal and one vertical line.
 Bearish Volume %: Displays the bearish volume percentage at the bottom of the depth chart.
 
🔹 Misc 
 
 Volume % Box Padding: Width of the volume % boxes at the bottom of the Liquidity Price Depth Chart as a percentage of the chart visible range
MACD_RSI_trend_followingINFO: 
This indicator can be used to build-up a strategy for trading of assets which are currently in trending phase. 
My preference is to use it on slowly moving assets like GOLD and on higher timeframes, but practice may show that we find more usefull cases.
This script uses two indicators - MACD and RSI, as the timeframe that those are extracted for is configurable (defaults with the Chart TF, but can be any other selected by the user).
The strategy has the following simple idea - buy if any if the conditions below is true:
 
   The selected TF MACD line crosses above the signal line and the TF RSI is above the user selected trigger value
   The selected TF MACD line is above the signal line and the TF RSI crosses above the user selected trigger value
 
Once we're in position we wait for the selected TF MACD line to cross below the signal line, and then we set a SL at the low of that bar
 DETAILS and USAGE: 
In the current implementation I find two possible use cases for the indicator:
 
 as a stand-alone indicator on the chart which can also fire alerts that can help to determine if we want to manually enter/exit trades based on them
  can be used to connect to the Signal input of the TTS (TempalteTradingStrategy) by jason5480 in order to backtest it, thus effectively turning it into a strategy (instructions below in TTS CONNECTIVITY section) 
In the example below we see a position opened at the bar after the buy indicator from the script has been triggered, and then later after the SL indicator from the script has been triggered a SL has been set on the lower wick of the closing candle, and the position eventually got closed once the price hit that level. Note that most of the drawing on the example snapshot below are from the TTS indicator following the buy/sell/SL conditions themseves:
 
Trading period can be selected from the indicator itself to limit to more interesting periods.
Arrow indications are drawn on the chart to indicate the trading conditions met in the script - green arrow for a buy signal indication and orange for LTF crossunder to indicate setting of SL.
 SETTINGS: 
Leaving all of the settings as in vanilla use case, as both the MACD and RSI indicator's settings follow the default ones for the stand-alone indicators themselves.
The start-end date is a time filter that can be extermely usefull when backtesting different time periods.
Pesonal preference is using the script on a D/W timeframe, while the indicator is configured to use Monthly chart.
The default value of the RSI filter is left to 50, which can be changed. I.e. if the RSI is above 50 we have a regime filter based on the MACD criteria.
 EXTERNAL LIBRARIES: 
The script uses a couple of external libraries:
 
  HeWhoMustNotBeNamed/enhanced_ta/14 - collection of TA indicators
  jason5480/tts_convention/3 - more details about the Template Trading Strategy below
 
I would like to highly appreciate and credit the work of both HeWhoMustNotBeNamed and jason5480 for providing them to the community.
 TTS SETTINGS (NEEDED IF USED TO BACKTEST WITH TTS): 
The TempalteTradingStrategy is a strategy script developed in Pine by jason5480, which I recommend for quick turn-around of testing different ideas on a proven and tested framework
I cannot give enough credit to the developer for the efforts put in building of the infrastructure, so I advice everyone that wants to use it first to get familiar with the concept and by checking 
by checking jason5480's profile www.tradingview.com
The TTS itself is extremely functional and have a lot of properties, so its functionality is beyond the scope of the current script - 
Again, I strongly recommend to be thoroughly epxlored by everyone that plans on using it.
In the nutshell it is a script that can be feed with buy/sell signals from an external indicator script and based on many configuration options it can determine how to execute the trades.
The TTS has many settings that can be applied, so below I will cover only the ones that differ from the default ones, at least according to my testing - do your own research, you may find something even better :)
The current/latest version that I've been using as of writing and testing this script is TTSv48
Settings which differ from the default ones:
 
  from                   - False                                               (time filter is from the indicator script itself)
  Deal Conditions Mode   - External                                            (take enter/exit conditions from an external script)
   🔌Signal 🛈➡          - MACD_RSI_trend_following: 🔌Signal to TTSv48        (this is the output from the indicator script, according to the TTS convention)
   Sat/Sun                - true                                                (for crypto, in order to trade 24/7)
   Order Type             - STOP                                                (perform stop order)
   Distance Method        - HHLL                                                (HigherHighLowerLow - in order to set the SL according to the strategy definition from above)
 
The next are just personal preferenes, you can feel free to experiment according to your trading style
 
   Take Profit Targets    - 0                                                   (either 100% in or out, no incremental stepping in or out of positions)
   Dist Mul|Len Long/Short- 10                                                  (make sure that we don't close on profitable trades by any reason)
   Quantity Method        - EQUITY                                              (personal backtesting preference is to consider each backtest as a separate portfolio, so determine the position size by 100% of the allocated equity size)
   Equity %               - 100                                                 (note above)
 






















