Swing Counter [theEccentricTrader]█ OVERVIEW
This indicator counts the number of confirmed swing high and swing low scenarios on any given candlestick chart and displays the statistics in a table, which can be repositioned and resized at the user's discretion.
█ CONCEPTS
Green and Red Candles
• A green candle is one that closes with a high price equal to or above the price it opened.
• A red candle is one that closes with a low price that is lower than the price it opened.
Swing Highs and Swing Lows
• A swing high is a green candle or series of consecutive green candles followed by a single red candle to complete the swing and form the peak.
• A swing low is a red candle or series of consecutive red candles followed by a single green candle to complete the swing and form the trough.
Peak and Trough Prices (Basic)
• The peak price of a complete swing high is the high price of either the red candle that completes the swing high or the high price of the preceding green candle, depending on which is higher.
• The trough price of a complete swing low is the low price of either the green candle that completes the swing low or the low price of the preceding red candle, depending on which is lower.
Peak and Trough Prices (Advanced)
• The advanced peak price of a complete swing high is the high price of either the red candle that completes the swing high or the high price of the highest preceding green candle high price, depending on which is higher.
• The advanced trough price of a complete swing low is the low price of either the green candle that completes the swing low or the low price of the lowest preceding red candle low price, depending on which is lower.
Green and Red Peaks and Troughs
• A green peak is one that derives its price from the green candle/s that constitute the swing high.
• A red peak is one that derives its price from the red candle that completes the swing high.
• A green trough is one that derives its price from the green candle that completes the swing low.
• A red trough is one that derives its price from the red candle/s that constitute the swing low.
Historic Peaks and Troughs
The current, or most recent, peak and trough occurrences are referred to as occurrence zero. Previous peak and trough occurrences are referred to as historic and ordered numerically from right to left, with the most recent historic peak and trough occurrences being occurrence one.
Upper Trends
• A return line uptrend is formed when the current peak price is higher than the preceding peak price.
• A downtrend is formed when the current peak price is lower than the preceding peak price.
• A double-top is formed when the current peak price is equal to the preceding peak price.
Lower Trends
• An uptrend is formed when the current trough price is higher than the preceding trough price.
• A return line downtrend is formed when the current trough price is lower than the preceding trough price.
• A double-bottom is formed when the current trough price is equal to the preceding trough price.
█ FEATURES
Inputs
• Start Date
• End Date
• Position
• Text Size
• Show Sample Period
• Show Plots
• Show Lines
Table
The table is colour coded, consists of three columns and nine rows. Blue cells denote neutral scenarios, green cells denote return line uptrend and uptrend scenarios, and red cells denote downtrend and return line downtrend scenarios.
The swing scenarios are listed in the first column with their corresponding total counts to the right, in the second column. The last row in column one, row nine, displays the sample period which can be adjusted or hidden via indicator settings.
Rows three and four in the third column of the table display the total higher peaks and higher troughs as percentages of total peaks and troughs, respectively. Rows five and six in the third column display the total lower peaks and lower troughs as percentages of total peaks and troughs, respectively. And rows seven and eight display the total double-top peaks and double-bottom troughs as percentages of total peaks and troughs, respectively.
Plots
I have added plots as a visual aid to the swing scenarios listed in the table. Green up-arrows with ‘HP’ denote higher peaks, while green up-arrows with ‘HT’ denote higher troughs. Red down-arrows with ‘LP’ denote higher peaks, while red down-arrows with ‘LT’ denote lower troughs. Similarly, blue diamonds with ‘DT’ denote double-top peaks and blue diamonds with ‘DB’ denote double-bottom troughs. These plots can be hidden via indicator settings.
Lines
I have also added green and red trendlines as a further visual aid to the swing scenarios listed in the table. Green lines denote return line uptrends (higher peaks) and uptrends (higher troughs), while red lines denote downtrends (lower peaks) and return line downtrends (lower troughs). These lines can be hidden via indicator settings.
█ HOW TO USE
This indicator is intended for research purposes and strategy development. I hope it will be useful in helping to gain a better understanding of the underlying dynamics at play on any given market and timeframe. It can, for example, give you an idea of any inherent biases such as a greater proportion of higher peaks to lower peaks. Or a greater proportion of higher troughs to lower troughs. Such information can be very useful when conducting top down analysis across multiple timeframes, or considering entry and exit methods.
What I find most fascinating about this logic, is that the number of swing highs and swing lows will always find equilibrium on each new complete wave cycle. If for example the chart begins with a swing high and ends with a swing low there will be an equal number of swing highs to swing lows. If the chart starts with a swing high and ends with a swing high there will be a difference of one between the two total values until another swing low is formed to complete the wave cycle sequence that began at start of the chart. Almost as if it was a fundamental truth of price action, although quite common sensical in many respects. As they say, what goes up must come down.
The objective logic for swing highs and swing lows I hope will form somewhat of a foundational building block for traders, researchers and developers alike. Not only does it facilitate the objective study of swing highs and swing lows it also facilitates that of ranges, trends, double trends, multi-part trends and patterns. The logic can also be used for objective anchor points. Concepts I will introduce and develop further in future publications.
█ LIMITATIONS
Some higher timeframe candles on tickers with larger lookbacks such as the DXY , do not actually contain all the open, high, low and close (OHLC) data at the beginning of the chart. Instead, they use the close price for open, high and low prices. So, while we can determine whether the close price is higher or lower than the preceding close price, there is no way of knowing what actually happened intra-bar for these candles. And by default candles that close at the same price as the open price, will be counted as green. You can avoid this problem by utilising the sample period filter.
The green and red candle calculations are based solely on differences between open and close prices, as such I have made no attempt to account for green candles that gap lower and close below the close price of the preceding candle, or red candles that gap higher and close above the close price of the preceding candle. I can only recommend using 24-hour markets, if and where possible, as there are far fewer gaps and, generally, more data to work with. Alternatively, you can replace the scenarios with your own logic to account for the gap anomalies, if you are feeling up to the challenge.
The sample size will be limited to your Trading View subscription plan. Premium users get 20,000 candles worth of data, pro+ and pro users get 10,000, and basic users get 5,000. If upgrading is currently not an option, you can always keep a rolling tally of the statistics in an excel spreadsheet or something of the like.
█ NOTES
I feel it important to address the mention of advanced peak and trough price logic. While I have introduced the concept, I have not included the logic in my script for a number of reasons. The most pertinent of which being the amount of extra work I would have to do to include it in a public release versus the actual difference it would make to the statistics. Based on my experience, there are actually only a small number of cases where the advanced peak and trough prices are different from the basic peak and trough prices. And with adequate multi-timeframe analysis any high or low prices that are not captured using basic peak and trough price logic on any given time frame, will no doubt be captured on a higher timeframe. See the example below on the 1H FOREXCOM:USDJPY chart (Figure 1), where the basic peak price logic denoted by the indicator plot does not capture what would be the advanced peak price, but on the 2H FOREXCOM:USDJPY chart (Figure 2), the basic peak logic does capture the advanced peak price from the 1H timeframe.
Figure 1.
Figure 2.
█ RAMBLINGS
“Never was there an age that placed economic interests higher than does our own. Never was the need of a scientific foundation for economic affairs felt more generally or more acutely. And never was the ability of practical men to utilize the achievements of science, in all fields of human activity, greater than in our day. If practical men, therefore, rely wholly on their own experience, and disregard our science in its present state of development, it cannot be due to a lack of serious interest or ability on their part. Nor can their disregard be the result of a haughty rejection of the deeper insight a true science would give into the circumstances and relationships determining the outcome of their activity. The cause of such remarkable indifference must not be sought elsewhere than in the present state of our science itself, in the sterility of all past endeavours to find its empirical foundations.” (Menger, 1871, p.45).
█ BIBLIOGRAPHY
Menger, C. (1871) Principles of Economics. Reprint, Auburn, Alabama: Ludwig Von Mises Institute: 2007.
Educational
Global GDPThis is the GlobalGDP of the richest and most populous countries
It is measured in USD
The countries included are the same than are included in my Global M2 indicator, as of to be able to compare them side to side.
Candle Counter [theEccentricTrader]█ OVERVIEW
This indicator counts the number of confirmed candle scenarios on any given candlestick chart and displays the statistics in a table, which can be repositioned and resized at the user's discretion.
█ CONCEPTS
Green and Red Candles
A green candle is one that closes with a high price equal to or above the price it opened.
A red candle is one that closes with a low price that is lower than the price it opened.
Upper Candle Trends
A higher high candle is one that closes with a higher high price than the high price of the preceding candle.
A lower high candle is one that closes with a lower high price than the high price of the preceding candle.
A double-top candle is one that closes with a high price that is equal to the high price of the preceding candle.
Lower Candle Trends
A higher low candle is one that closes with a higher low price than the low price of the preceding candle.
A lower low candle is one that closes with a lower low price than the low price of the preceding candle.
A double-bottom candle is one that closes with a low price that is equal to the low price of the preceding candle.
█ FEATURES
Inputs
Start Date
End Date
Position
Text Size
Show Sample Period
Show Plots
Table
The table is colour coded, consists of three columns and twenty-two rows. Blue cells denote all candle scenarios, green cells denote green candle scenarios and red cells denote red candle scenarios.
The candle scenarios are listed in the first column with their corresponding total counts to the right, in the second column. The last row in column one, row twenty-two, displays the sample period which can be adjusted or hidden via indicator settings.
Rows two and three in the third column of the table display the total green and red candles as percentages of total candles. Rows four to nine in column three, coloured blue, display the corresponding candle scenarios as percentages of total candles. Rows ten to fifteen in column three, coloured green, display the corresponding candle scenarios as percentages of total green candles. And lastly, rows sixteen to twenty-one in column three, coloured red, display the corresponding candle scenarios as percentages of total red candles.
Plots
I have added plots as a visual aid to the various candle scenarios listed in the table. Green up-arrows denote higher high candles when above bar and higher low candles when below bar. Red down-arrows denote lower high candles when above bar and lower low candles when below bar. Similarly, blue diamonds when above bar denote double-top candles and when below bar denote double-bottom candles. These plots can also be hidden via indicator settings.
█ HOW TO USE
This indicator is intended for research purposes and strategy development. I hope it will be useful in helping to gain a better understanding of the underlying dynamics at play on any given market and timeframe. It can, for example, give you an idea of any inherent biases such as a greater proportion of green candles to red. Or a greater proportion of higher low green candles to lower low green candles. Such information can be very useful when conducting top down analysis across multiple timeframes, or considering trailing stop loss methods.
What you do with these statistics and how far you decide to take your research is entirely up to you, the possibilities are endless.
This is just the first and most basic in a series of indicators that can be used to study objective price action scenarios and develop a systematic approach to trading.
█ LIMITATIONS
Some higher timeframe candles on tickers with larger lookbacks such as the DXY, do not actually contain all the open, high, low and close (OHLC) data at the beginning of the chart. Instead, they use the close price for open, high and low prices. So, while we can determine whether the close price is higher or lower than the preceding close price, there is no way of knowing what actually happened intra-bar for these candles. And by default candles that close at the same price as the open price, will be counted as green. You can avoid this problem by utilising the sample period filter.
The green and red candle calculations are based solely on differences between open and close prices, as such I have made no attempt to account for green candles that gap lower and close below the close price of the preceding candle, or red candles that gap higher and close above the close price of the preceding candle. I can only recommend using 24-hour markets, if and where possible, as there are far fewer gaps and, generally, more data to work with. Alternatively, you can replace the scenarios with your own logic to account for the gap anomalies, if you are feeling up to the challenge.
It is also worth noting that the sample size will be limited to your Trading View subscription plan. Premium users get 20,000 candles worth of data, pro+ and pro users get 10,000, and basic users get 5,000. If upgrading is currently not an option, you can always keep a rolling tally of the statistics in an excel spreadsheet or something of the like.
FVGs & CEs + Alerts: simple & efficient methodFair Value Gap indicator: Paints FVGs and their midlines (CEs). Stops painting when CE is hit, or when fully filled; user choice of threshold. This threshold is also used in the Alert conditions.
~~Plotted here on ES1! (CME), on the 15m timeframe~~
-A FVG represents a 'naked' body where the wicks/tails on either side do not meet. This can be seen as a type of 'gap', which price will have a tendency to want to re-fill (in part or in full).
-The midline (CE, or 'Consequent encroachment') of FVGs also tend to show price sensitivity.
-This indicator paints all FVGs until priced into, and should give an idea of which are more meaningful and which are best ignored (based on context: location, Time of day, market structure, etc).
-This is a simpler and more efficient method of painting Fair value gaps which auto-stop painting when price reaches them.
//Aims of Publishing:
-Education of ICT concepts of Fair Value Gaps and their midlines (CEs): To easily see via forward testing or backtesting, the sensitivity that price shows to these areas & levels.
-Demonstration of a much more efficient way of plotting FVGs which terminate at price, thanks to a modification of @Bjorgums's clever looping method referenced below.
//Settings:
-Toggle on/off upward and downward FVGs independently(blue and orange by default).
-Toggle on/off midline (CE).
-Standard color/line formatting options.
-Choose Threshold: CE of FVG or Full Fill of FVG: This will determine both the 'stop-painting' trigger and the 'Alert' trigger.
-Choose number of days lookback to control how many historical FVGs paint on chart.
//On alerts:
-Simple choice of 2 alerts:
~~One for price crossing into/above the nearest untouched 'premium' FVG above ( orange ). Trigger is user choice of CE or full fill.
~~Another for price crossing into/below the nearest untouched 'discount' FVG below (blue). Trigger is user choice of CE or full fill.
-Alerts set via the three dots in indicator status line.
//Cautionary notes:
-Do not use the alerts blindly to find trades. Wait until you have identified a good FVG above/below which you think price may show sensitivity to
-Usage on very low timeframes can cause unexpected results with alerts: due to new FVGs forming in realtime the Alert will always trigger at the most recent FVG above/ below having its threshold hit.
-Big thank you to @Bjorgum for his fantastic extendAndRemove method. Modified here for use with boxes and to integrate Alerts.
-Also Credit to ICT (inner circle trader) for the concepts used here: Fair value gaps and their Consequent Encroachment (CE).
Legend Scanning System - Telegram SenderHello traders, I'm Only Fibonacci.
This is what i posted, not really an indicator or strategy. An alarm mechanism.
What does it do?
First, you select a period during which the vehicle will scan.
Then, with this system, you adjust the settings of the strategies installed on our vehicle. Then you select forty symbols and specify which strategy you want the symbols to be scanned.
We come to the alarm setting screen, select the alarm, and enter your telegram bot's token-hosted message request link from the webhook section. You should contact me for assistance in these matters.
You can see most of the settings in the image below.
You can see most of the settings in the image below.
Important note: The period of the open graph must be less than the scanned period. Otherwise, the results may be erroneous.
Strategies will be constantly updated and become more customizable.
Proper use of this tool gives you:
It serves to scan different strategies on forty symbols different instruments of your choice. And not only that, you will receive these results in telegram.
The strategies loaded in these scans consist of the strategies in the techniques section in tradingview.
RSI Divergence Method█ OVERVIEW
This is a divergence indicator based on Relative Strength Index (RSI).
My attempt to make this indicator updated based on latest pine script features such as type, object and method.
█ FEATURES
1. Color of plot and label is based on contrast color of chart background. Able to customize color from style menu.
2. Big divergence (Regular Divergence) is based on lime / red color.
3. Small divergence (Hidden Divergence) is based on contrast color of chart background.
█ EXAMPLES / USAGES
Day of Week - Volatility Report█ OVERVIEW
The indicator analyses the volatility and reports statistics by the days of the week.
█ CONCEPTS
On business days and weekends, different market participants get involved in the markets. How does this affect the markets during the week?
Here are some ideas to explore:
When are the best days for trading?
Which day of the week is the market the most volatile?
Should you trade on business days? Is it worth trading during the weekend?
How does this relate to your most profitable trades?
Is there a confluence with the days having the highest win rate?
Which days of the week should you stop trading?
Ethereum
USDCAD
NZDUSD
█ FEATURES
Configurable outputs
Output the report statistics as mean or median.
█ HOW TO USE
Plot the indicator and visit the 1D, 24H, or 1440 minutes timeframe.
█ NOTES
Gaps
The indicator includes the volatility from gaps.
Calculation
The statistics are not reported from absolute prices (does not favor trending markets) nor percentage prices (does not depict the different periods of volatility that markets can go through). Instead, the script uses the prices relative to the average range of previous weeks (weekly ATR).
Trading session
The indicator analyses weekdays from the daily chart, defined by the exchange trading session (see Symbol Info).
Extended trading session
The indicator can include the extended hours when activated on the chart, using the 24H or 1440 minutes timeframe.
Overnight session
The indicator supports overnight sessions (open and close on different calendar days). For example, EURUSD will report Monday’s volatility from Sunday open at 17:00 to Monday close at 17:00.
This is a PREMIUM indicator. In complement, you might find useful my free Time of Day - Volatility Report .
Orion:SagittaSagitta
Sagitta is an indicator the works to assist in the validation of potential long entries and to place stop-loss orders. Sagitta is not a "golden indicator" but more of a confirmation indicator of what prices might be suggesting.
The concept is that while stocks can turn in one bar, it usually takes two bars or more to signal a turn. So, using a measurement of two bars help determine the potential turning of prices.
Behind the scenes, Sagitta is nothing more than a 2 period stochastic which has had its values divided into five specific zones.
Dividing the range of the two bars in five sections, the High is equal to 100 and the Low is equal to 0.
The zones are:
20 = bearish (red) – This is when the close is the lower 20% of the two bars
40 = bearish (orange) – This is when the close is between the lower 20% and 40% of the two bars.
60 = neutral (yellow) – This is when the close is between the middle 40% - 60% of the two bars.
80 = bullish (blue) – This is when the close is between the upper 60% - 80% of the two bars.
100 = bullish (green) – This is when the close is above the upper 80% of the bar.
The general confirmation concept works as such:
When the following bar is of a higher value than the previous bar, there is potential for further upward price movement. Conversely when the following bar is lower than the previous bar, there is potential for further downward movement.
Going from a red bar to orange bar Might be an indication of a positive turn in direction of prices.
Going from a green bar to an orange bar would also be considered a negative directional turn of prices.
When the follow on bar decreases (ie, green to blue, blue to yellow, etc) placing a stop-loss would be prudent.
Maroon lines in the middle of a bar is an indication that prices are currently caught in consolidation.
Silver/Gray bars indicate that a high potential exists for a strong upward turn in prices exists.
Consolidation is calculated by determining if the close of one bar is between the high and low of another bar. This then establishes the range high and low. As long as closes continue with this range, the high and low of the range can expand. When the close is outside of the range, the consolidation is reset.
Signals in areas of consolidation (maroon center bar) should be looked upon as if the prices are going to challenge the high of the consolidation range and not necessarily break through.
The entry technique used is:
The greater of the following two calculations:
High of signal bar * 1.002 or High of signal bar + .03
The stop-loss technique used is:
The lesser of the following two calculations:
Low of signal bar * .998 or Low of signal bar - .03
IF an entry signal is generated and the price doesn’t reach the entry calculation. It is considered a failed entry and is not considered a negative or that you missed out on something. This has saved you from losing money since the prices are not ready to commit to the direction.
When placing a stop-loss, it is never suggested that you lower the value of a stop-loss. Always move your stop-losses higher in order to lock in profit in case of a negative turn.
Alpha Cloud Algo Risk Reward CalculatorAlpha Cloud Algo Risk Reward Calculation Usage
This indicator helps users manage their positions by allowing them to set customizable take profit and stop loss levels. It helps investors better understand the risk and reward levels of their positions.
Indicator Settings:
Language: Choose the language of the indicator (currently only Turkish is available).
Position Type: Choose either a long or short position option.
Entry Price: Enter the price at which the position will be opened.
Risk Percentage (%): Specify the percentage you are willing to risk in the trade.
Take Profit Type: Choose an option to determine your take profit level as a ratio or price.
Take Profit Value: Enter your take profit level (depending on whether it is a ratio or price type).
Stop Loss Type: Choose an option to determine your stop loss level as a ratio or price.
Stop Loss Value: Enter your stop loss level (depending on whether it is a ratio or price type).
Leverage: Enter the amount of leverage you will use in the trade.
Investment Amount ($): Enter the amount of investment you have allocated for the trade.
Main Capital ($): Enter the amount of your available main capital.
Usage of the Indicator:
After filling in the indicator settings, the take profit and stop loss levels and labels will appear on the chart. The labels also show the amount of risk and reward, in addition to the levels.
The Stop Loss label contains the following information:
Stop Loss level
Total loss amount (in dollars)
Percentage risked (as a percentage of your main capital)
This indicator is designed to speed up the decision-making process and help investors more effectively evaluate potential risks. It allows investors to apply risk management strategies more effectively while trading.
Turkish Language
Alpha Cloud Algo Risk Reward Hesaplama Kullanımı
Bu gösterge, kullanıcıların pozisyonlarını yönetmelerine yardımcı olmak amacıyla özelleştirilebilir kar al ve stop loss seviyeleri belirlemelerini sağlar. Gösterge, yatırımcıların pozisyonlarındaki risk ve ödül seviyelerini daha iyi anlamalarına yardımcı olur.
Göstergenin Ayarları:
Dil: Göstergenin dilini seçin (şu anda sadece Türkçe mevcuttur).
Pozisyon Türü: Uzun (Long) veya kısa (Short) pozisyon seçeneklerinden birini belirleyin.
Giriş Fiyatı: Pozisyonun açılacağı fiyatı girin.
Risk Oranı (%): İşlemde riske atmak istediğiniz yüzdeyi belirleyin.
Kar Al Tipi: Kar al seviyenizi oran veya fiyat olarak belirlemek için seçeneklerden birini seçin.
Kar Al Değeri: Kar al seviyenizi girin (oran veya fiyat türüne bağlı olarak).
Stop Loss Tipi: Stop loss seviyenizi oran veya fiyat olarak belirlemek için seçeneklerden birini seçin.
Stop Loss Değeri: Stop loss seviyenizi girin (oran veya fiyat türüne bağlı olarak).
Kaldıraç: İşlemde kullanacağınız kaldıraç miktarını girin.
Yatırım Miktarı ($): İşlem için ayırdığınız yatırım miktarını girin.
Ana Para ($): Kullanılabilir ana paranızın miktarını girin.
Göstergenin Kullanımı:
Göstergenin ayarlarını doldurduktan sonra, grafik üzerinde belirtilen kar al ve stop loss seviyeleri ile etiketler görünecektir. Etiketler, seviyelerin yanı sıra risk ve ödül miktarlarını da gösterir.
Stop Loss etiketi aşağıdaki bilgileri içerir:
Stop Loss seviyesi
Toplam kayıp miktarı (dolar cinsinden)
Riske atılan yüzde (ana paranızın yüzdesi olarak)
Bu gösterge, yatırımcıların karar verme sürecini hızlandırmalarına ve potansiyel riskleri daha iyi değerlendirmelerine yardımcı olmak için tasarlanmıştır. Yatırımcıların, işlem yaparken risk yönetimi stratejilerini daha etkin bir şekilde uygulamalarına olanak tanır.
Leverage Liquidation Circles/dots/alertsThis plots liquidation alerts for different levels of leverage. The script calculates the liquidation prices for both long and short positions based on the inputted leverage values. Then, it plots dots on the chart where liquidation can occur for each level of leverage. Additionally, it plots circles on the chart only when a liquidation event occurs, at which point the circle changes color to indicate the level of leverage that triggered the liquidation.
The script allows traders to visualize potential liquidation events for different levels of leverage, which can be helpful in managing risk when trading on margin. The different colors of the circles can quickly communicate which level of leverage triggered the liquidation, allowing traders to quickly assess the situation and adjust their positions if necessary.
Click Signal IndicatorThis is a Signal Indicator that emits signals based on mouse clicks when the indicator is added to the chart, or later on in the "Settings/Inputs" tab by changing/selecting the open time of the desired bar of each one of the signals.
It is designed to be used as an External Input for the "Template Trailing Strategy" to verify the correctness of the features the aforementioned script offers, and to provide an easy way to play around with this framework.
Last but not least this script offers a way to debug and report problems when this is necessary. Moreover, this script is a simple example you can copy-paste and create your own custom signal indicator that can be "plugged into"
the "Template Trailing Strategy" taking advantage of all the fancy stuff the TTS framework can provide!
To connect this signal indicator to the TTS you have to change the "Deal Conditions Mode" to '🔨External' and the 'External Input 🛈➡' to 'CSI:🔌Signal' in the TTS "Settings/Inputs" tab. For more information check the "Template Trailing Strategy - Part 02" video tutorial.
Hikkake Hunter 2.0This script serves as a successor to a previous script I wrote for identifying Hikkakes nearly two years ago.
The old version has been preserved here:
█ OVERVIEW
This script is a rework of an old script that identified the Hikkake candlestick pattern. While this pattern is not usually considered a part of the standard candlestick patterns set, I found a lot of value when finding a solution to identifying it. A Hikkake pattern is a 3-candle pattern where a middle candle is nested in between the range of the prior candle, and a candle that follows has a higher high and a higher low (bearish setup) or a lower high and a lower low (bullish setup). What makes this pattern unique is the "confirmation" status of the pattern; within 3 candles of this pattern's appearance, there must be a candle that closes above the high (bullish setup) or below the low (bearish setup) of the second candle. Additional flexibility has been added which allows the user to specify the number of candles (up to 5) that the pattern may have to confirm after its appearance.
█ CONCEPTS
This script will cover concepts mainly focusing on candlestick analysis, price analysis (with higher timeframes), and statistical analysis. I believe there is also educational value presented with the use of user-defined-types (UDTs) in accomplishing these concepts that I hope others will find useful.
Candlestick Analysis - Identification and confirmation of the patterns in the deprecated script were clunky and inefficient. While the previous script required the use of 6 candles to perform the confirmations of patterns (restricted solely to identifying patterns that confirmed in 3 candles or less), this script only requires 3 candles to identify and process patterns by utilizing a UDT representing a 'pattern object'. An object representing a pattern will be created when it has been identified, and fields within that object will be set for processing by the functions it is passed to. Pattern objects are held by a var array (values within the array persist between bars) and will be removed from this array once they have been confirmed or non-confirmed.
This is a significant deviation from the previous script's methods, as it prevents unnecessary re-evaluations of the confirmation status of patterns (i.e. Hikkakes confirmed on the first candle will no longer need to be checked for confirmations on the second or third; a pitfall of the deprecated version which required multiple booleans tracking prior confirmation statuses). This deviation is also what provides the flexibility in changing the number of candles that can pass before a pattern is deemed non-confirmed.
As multiple patterns can be confirmed simultaneously, this script uses another UDT representing a linked-list reduction of the pattern object used to process it. This liked-list object will then be used for Price Analysis.
Price Analysis - This script employs the use of a UDT which contains all the returns of confirmed patterns. The user specifies how many candles ahead of the confirmed pattern to calculate its return, as well as where this calculation begins. There are two settings: FROM APPEARANCE and FROM CONFIRMATION (default). Price differences are calculated from the open of the candle immediately following the candle which had confirmed the pattern to the close of the candle X candles ahead (default 10). ( SEE FEATURES )
Because of how Pine functions, this calculation necessitates a lookback on prior candles to identify when a pattern had been confirmed. This is accomplished with the following pseudo-code:
if not na(confirmed linked-list )
for all confirmed in list
GET MATRIX PLACEMENT
offset = FROM CONFIRMATION ? 0 : # of candles to confirm
openAtFind = open
percent return = ((close - openAtFind) / openAtFind) * 100
ADD percent return TO UDT IN MATRIX
All return UDTs are held in a matrix which breaks up these patterns into specific groups covered in the next section.
Higher Timeframes - This script makes a request.security call to a higher timeframe in order to identify a price range which breaks up these patterns into groups based on the 'partition' they had appeared in. The default values for this partitioning will break up the chart into three sections: upper, middle, and lower. The upper section represents the highest 20% of the yearly trading range that an asset has experienced. The lower section represents the trading range within a third (33%) of the yearly low. And the middle section represents the yearly high-low range between these two partitions.
The matrix containing all return UDTs will have these returns split up based on the number of candles required to confirm the pattern as well as the partition the pattern had appeared in. The underlying rationale is that patterns may perform better or worse at different parts of an asset's trading range.
Statistical Analysis - Once a pattern has been confirmed, the matrix containing all return UDTs will be queried to check if a 'returnArray' object has been created for that specific pattern. If not, one will be initialized and a confirmed linked-list object will be created that contains information pertinent to the matrix position of this object.
This matrix contains the returns of both the Bullish and Bearish Hikkake patterns, separated by the number of candles needed to confirm them, and by the partitions they had appeared in. For the standard 3 candles to confirm, this means the matrix will contain 18 elements (dependent on the number of candles allowed for confirmations; its size will range from 12 to 30).
When the required number of candles for Price Analysis passes, a percent return is calculated and added to the returnArray contained in the matrix at the location derived from the confirmed linked-list object's values. The return is added, and all values in the returnArray are updated using Pine's built in array.___ functions. This returnArray object contains the array of all returns, its size, its average, the median, the standard deviation of returns, and a separate 3-integer array which holds values that correspond to the types of returns experienced by this pattern (negative, neutral, and positive)*.
After a pattern has been confirmed, this script will place the partition and all of the aforementioned stats values (plus a 95% confidence interval of expected returns) related to that pattern onto the tooltip of the label that identifies it. This allows users to scroll over the label of a confirmed pattern to gauge its prior performance under specific conditions. The percent return of the specific pattern identified will later be placed onto the label tooltip as well. ( SEE LIMITATIONS )
The stats portion of this script also plays a significant role in how patterns are presented when using the Adaptive Coloring mode described in FEATURES .
*These values are incremented based on user-input related to what constitutes a 'negative' or 'positive' return. Default values would place any return by a pattern between -3% and 3% in the 'neutral' category, and values exceeding either end will be placed in the 'negative' or 'positive' categories.
█ FEATURES
This script contains numerous inputs for modifying its behavior and how patterns are presented/processed, separated into 5 groups.
Confirmation Setting - The most important input for this script's functioning. This input is a 'confirm=true' input and must be set by the user before the script is applied to the chart. It sets the number of candles that a pattern has to confirm once it has been identified.
Alert Settings - This group of booleans sets which types of alerts will fire during the scripts execution on the chart. If enabled, the four alerts will trigger when: a pattern has been identified, a pattern has been confirmed, a pattern has been non-confirmed, and show the return for that confirmed pattern in an alert. Because this script uses the 'alert' function and not 'alertcondition', these must be enabled before 'any alert() function call' is set in TradingView's 'alerts' settings.
Partition Settings - This group of inputs are responsible for creating (and viewing) the partitions that breaks the returns of the patterns identified up into their respective groups. The user may set the resolution to grab the range from, the length back of this resolution the partitions get their values from, the thresholds which breaks the partitions up into their groups, and modify the visibility (if they're shown, the colors, opacity) of these partitions.
Stats Settings - These inputs will drastically alter how patterns are presented and the resulting information derived from them after their appearance. Because of this section's importance, some of these inputs will be described in more detail.
P/L Sample Length - Defines the number of candles after the starting point to grab values from in the % return calculation for that pattern.
P/L Starting Point - Defines the starting point where the P/L calculation will take place. 'FROM APPEARANCE' will set the starting point at the candle immediately following the pattern's appearance. 'FROM CONFIRMATION' will place the starting point immediately following the candle which had confirmed the pattern. ( SEE LIMITATIONS )
Min Returns Needed - Sets how many times a specific pattern must appear (both by number of candles needed to confirm and by partition) before the statistics for that pattern are displayed onto the tooltip (and for gradient coloration in Adaptive Coloring mode).
Enable Adaptive Coloring - Changes the coloration of the patterns based on the bullish/bearishness of the specified Gradient Reference value of that pattern compared to the Return Tolerance values OR the minimum and maximum values of that specified Gradient Reference value contained in the matrix of all returns. This creates a color from a gradient using the user-specified colors and alters how many of the patterns may appear if prior performance is taken into account.
Gradient Reference - Defines which stats measure of returns will be used in the gradient color generation. The two settings are 'AVG' and 'MEDIAN'.
Hard Limit - This boolean sets whether the Return Tolerance values will not be replaced by values that exceed them from the matrix of returns in color gradient generation. This changes the scale of the gradient where any Gradient Reference values of patterns that exceed these tolerances will be colored the full bullish or bearish gradient colors, and anything in between them will be given a color from the gradient.
Visibility Settings - This last section includes all settings associated with the overall visibility of patterns found with this script. This includes the position of the labels and their colors (+ pattern colors without Adaptive Coloring being enabled), and showing patterns that were non-confirmed.
Most of these inputs in the script have these kinds of descriptions to what they do provided by their tooltips.
█ HOW TO USE
I attempted to make this script much easier to use in terms of analyzing the patterns and displaying the information to the user. The previous script would have the user go to the 'data window' side bar on TradingView to view the returns of a pattern after they had specified which pattern to analyze through the settings, needlessly convoluted. This aim at simplicity was achieved through the use of UDTs and specific code-design.
To use, simply apply the indicator to a chart, set the number of candles (between 2 and 5) for confirming this specific pattern and adjust the many settings described above at your leisure.
█ LIMITATIONS
Disclaimer - This is a tool created with the hopes of helping identify a specific pattern and provide an informative view about the performance of that pattern. Previous performance is not indicative of future results. None of this constitutes any form of financial advice, *use at your own risk*.
Statistical Analysis - This script assumes that all patterns will yield a NORMAL DISTRIBUTION regarding their returns which may not be reflective of reality. I personally have limited experience within the field of statistics apart from a few high school/college courses and make no guarantees that the calculation of the 95% confidence interval is correct. Please review the source code to verify for yourself that this interval calculation is correct (Function Name: f_DisplayStatsOnLabel).
P/L Starting Point - Because of when the object related to the confirmation status of a pattern is created (specifically the linked-list object) setting the 'P/L Starting Point' to 'FROM APPEARANCE' will yield the results of that P/L calculation at the same time as 'FROM CONFIRMATION'.
█ EXAMPLES
Default Settings:
Partition Background (default):
Partition Background (Resolution D : Length 30):
Adaptive Coloration:
Show Non-Confirmed:
[JL] Control Your Emotions ReminderThe " Control Your Emotions Reminder" script is a valuable tool for traders, helping them to monitor and manage their emotions during trading. By showcasing a list of typical emotions on the chart, this script aims to increase awareness of the emotional traps that can adversely affect trading outcomes. Traders can utilize this reminder to stay focused and maintain discipline while making trading decisions.
Features:
Presents a checklist of 10 prevalent emotions that traders should address, including fear, greed, anxiety, frustration, overconfidence, euphoria, regret, envy, impatience, and boredom.
Enables users to customize the notification, label position, color, and distance from the current bar.
Designed to enhance trading performance by fostering emotional awareness and discipline.
While trading, it is crucial to manage your emotions to make well-informed and rational decisions. The following emotions are important to control during trading:
Fear: Fear may lead to premature trade exits or prevent entry into potentially profitable trades.
Greed: Greed can result in overtrading, holding positions for too long, or taking excessive risks.
Anxiety: Anxiety can cause impulsive decision-making, impacting your ability to analyze and execute trades effectively.
Frustration: Frustration may result in revenge trading or making impulsive decisions to recover losses rapidly.
Overconfidence: Overconfidence can lead to excessive risk-taking or failure to follow your trading plan.
Euphoria: Euphoria may cause you to overlook risks, resulting in potential losses when market conditions shift.
Regret: Regret can prompt emotional decision-making, such as pursuing missed opportunities or clinging to losing positions.
Envy: Envy may encourage you to mimic other traders without conducting your own analysis, leading to potentially unsound decisions.
Impatience: Impatience can result in hasty decision-making, entering trades too early, or exiting prematurely.
Boredom: Boredom can cause overtrading, entering trades without adequate analysis, or disregarding your trading plan.
Feel free to modify the text as needed.
How to use:
Add the script to your chart.
Adjust the label position, color, and distance from the current bar as desired.
Use the displayed checklist as a reminder to manage your emotions during trading.
By utilizing the " Control Your Emotions Reminder" script, traders can enhance their trading performance by becoming more aware of their emotions and maintaining discipline in their decision-making process. This can contribute to improved risk management, adherence to trading plans, and more informed trading decisions overall.
XLY/XLP RatioThe XLY/XLP ratio is a financial indicator that measures the ratio between the two ETFs (Exchange Traded Funds) Consumer Discretionary Select Sector SPDR Fund (XLY) and Consumer Staples Select Sector SPDR Fund (XLP). This ratio is often used by traders and investors as a measure of the relative success of companies in the consumer goods and consumer services sectors.
A higher XLY/XLP ratio indicates that consumer confidence is higher and people are more willing to spend their money on non-essential items, such as entertainment or luxury goods (discretionary spending). A lower XLY/XLP ratio, on the other hand, indicates that consumer confidence is lower and people are more willing to spend their money on essential items like food and household items (staple spending).
The interpretation of the XLY/XLP ratio depends on the current market situation and the analysis of the economic and political factors that may influence consumption. If the XLY/XLP ratio rises, it could be an indication of a growing economy and increasing consumer sentiment. However, if it falls, it could be an indication of a weakening economy or declining consumer confidence.
It is important to note that the XLY/XLP indicator should not be used as the sole indicator to make trading decisions. It is advisable to also consider other indicators, such as technical and fundamental analysis, before making a decision.
9:15 AM middle price #rangeofstinoThis indicator will show the middle price of the first one-minute candle of BankNifty at 9:15 AM for every day.
Vertical Lines 2A vertical line plotting function is missing in Pinescript. This is another method to plot vertical line on a chart, and an improvement on my previous script "vertical lines" .
The script hacks the plotcandle function to display just the wicks without the body. This hack simulates a vertical line. The body of the candle is non-existing since the open and close are the same and its color is set to null. The wicks are abutting resulting in a continuous vertical line.
Drawbacks include inability to set width and transparency of the lines. The plotcandle function does not allow setting the width and transparency of the wicks. This feature would be desirable.
The crossing of the RSI of overbought and undersold zones is used as an example in this published script. Any indicator can be used and this script can be executed on any other indicator by using "add indicator" on the desired indicator, and selecting the indicator as the source. I added crossover lines on the plotted RSI as an example.
//////////////////////////////////////////////////////Breakdown of the script////////////////////////////////////////////////////////
The src input determines which price data is used for the highest value calculation. By default, it is set to the close price.
The length input determines the length of the RSI calculation. By default, it is set to 14.
The mult input determines the multiplier of the highest value that is used to determine the height of the vertical lines. By default, it is set to 100%, meaning the lines will reach the highest value in the dataset.
The top and bot inputs determine the overbought and oversold levels for the RSI. By default, they are set to 70 and 30, respectively.
The current_rsi and previous_rsi variables calculate the RSI values for the current bar and the previous bar, respectively.
The hi_value variable finds the highest value in the dataset, and the hi variable calculates the height of the vertical lines based on the highest value and the user-defined multiplier. The lo variable calculates the distance between the highest value and the current price data.
The uph, dnh, upl, and dnl variables determine the height and low of the vertical lines for when the RSI crosses overbought or oversold levels.
The if statements check if the RSI has crossed overbought or oversold levels and set the uph, dnh, upl, and dnl variables accordingly.
Finally, the plotcandle() function is used to plot the vertical lines on the chart. The open and close values are set to the src input, and the high and low values are set to the uph, dnh, upl, and dnl variables. The bordercolor argument is set to na to hide the borders of the lines, and the wickcolor argument is set to green or red, depending on whether the line is an overbought or oversold crossover.
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
DD/RP Calculatortool for calculate drawdown and run-up from order open and close
用來計算潛在獲利跟虧損的工具
導入指標然後拉取範圍,工具會幫你計算到目前為止曾經最大的獲利或虧損點數
注意點數根據當下券商的最小值(symbol.min_tick)而有所不同
--
Tool is for the convenience of use, users should bear all risks for their investment decisions. The tool information is for reference only and does not provide any guarantees.
工具為方便使用,使用者應為自己任何投資決策行為承擔所有風險,工具資訊僅供參考,不提供任何保證。
RSI is in Normal Distribution?Does RSI Follow a Normal Distribution?
The value of RSI was converted to a value between 0~2, 2~4, ..., 98~100, and the number of samples was graphed.
The Z values are expressed so that the values corresponding to 30 and 70 of the RSI can be compared with the standard normal distribution.
Additionally, when using the RSI period correction function of the 'RSI Candle Advanced V2' indicator that I made before, it shows no change in standard deviation.
RSI는 정규분포를 따를까요
RSI의 값을 0~2, 2~4, ..., 98~100 사이 값으로 변환하고 그 표본 갯수를 그래프로 표현하였습니다.
Z 값은 RSI의 30, 70에 해당하는 값을 표준정규분포와 비교할 수 있도록 표현하였습니다.
추가적으로 제가 예전에 만들었던 'RSI Candle Advanced V2' 지표의 RSI 기간 보정 함수를 사용할 경우 표준편차의 변화가 없음을 보입니다.
Global (World) Monetary Supply M2 (measured in USD)This is the Global Monetary Supply M2 of the richest and most populous countries that have info from at least 2008
It is measured in USD (converting the M2 of each of the countries respective currencies and virtually converting them into USD)
This is less than the global liquidity as it does not include the countries' assets in other currencies (on their balance sheets), it only focuses on the monetary supply of each of the countries own currencies.
basilGrid GridBot Live [basilChart]This strategy is a full implementation of Live Grid Trading.
Prominent features of this live grid trading strategy are:
- Logarithmic Chart Support: This strategy can support Log Scale on graph. Meaning that grid lines won't have irregular gaps in between the lines if you would like to view the chart Log Scaled. Every line will be aligned correctly even if you use Log Scale or not.
- Precise Buy & Sell: Script will execute precise Buy and Sell orders.
- Dynamic Grid Level Count: From 2 grid levels to n amount of grid levels are supported. There is no limitation on grid level count, however there may be irregularities because of limitations when higher grid levels are used. You can pick any number starting from 2.
- Average Price: Traders can monitor average price of positions.
- Alerts: When order is filled trader can receive notification. Create new alert > Select basilGrid Live > Order fills only()
Characteristics of this script:
- Able to fill more than one order in one single candle.
- Levels will keep being updated with every trade.
- There will be always one grid level ignored and it will be the level which made the last order filling possible. This is normal behavior of grid trading system.
- You can both use Log Scale and Normal Scale with this script. No issue will be on grid levels.
Using the script:
- Add this script to the chart from indicators tab
- Set starting date for the live grid bot either by dragging and dropping the vertical line or by the date-time picker from indicator Inputs tab.
- Set highest and lowest limit for the script. These will be the boundary limits. Highest and lowest price for the script to work on. Lines will populate between these two values
- Set grid level count. Number of levels of the grid.
- Set amount to spend on per level. This quantity of order will be placed on each level when needed.
After setting the above settings, there is one last thing to do in order to get precise results. It is setting the Initial Capital.
- We can set this setting from 'Properties' tab. Named 'Initial Capital'. After setting the boundaries all we need to is to navigate to TradingView's own 'Data Window', and get the value there. Then paste it on the strategy's own related setting area.
In this example we used pair BTCUSDT 1D timeframe, our settings are:
Inputs Tab:
- Grid Count: 19
- High Limit: 65 500
- Low Limit: 15 000
- Quantity per level: 0.1
- Toggle Log Scale: Checked (because I always use Log Scale on charts, if Log Scale is turned on for the chart, this needs to be checked)
- Terminate Grid At The Upmost Level: Not checked
- Show Grid Levels: Checked
- Show Average Position Price: Checked
Properties Tab:
- Initial Capital: 22 628
- Slippage: 5
- Commission: 0.1% (this is the broker commission value)
This script's purpose is to make it easier to get the idea of grid trading, experiencing it in live session.
Global Monetary Supply M2 Vs the Global GDP This indicator compares the Global (world) Monetary Supply (measured in USD) compared to the Global GDP.
This can be useful to measure the "money printing speed" of the world compare to the "world gdp growth", the higher the slope (angle of growth) the more money printing.
It includes the exact same countries of the Global M2 indicator (done by me), to make fair the comparison, which has the richest and most populous countries so to have a clear overview.
There tough a few very populated countries excluded, the details can be found on the Global M2 indicator script and reason for exclusion.
Enjoy!
Filter-Out Weak Pivot highs/lows, Swing highs/lows: MethodJust a simple indicator for refining the standard method of finding Pivot highs & Lows; Allowing user to filter-out weak/flat/rounded Pivot highs/lows
-Aim of this is to get pivot highs & pivot lows coded to print more in line with what the eye would naturally be drawn to as an obvious pivot high/low.
-This uses local moving average around the pivot high/low together with user-input ATR multiple, to create a condition for filtering out lacklustre pivot highs/lows.
-Thought i'd publish this separately as a tool that other coders might find useful.
//inputs//
~adjust looback/lookforward for Pivot highs/lows
~adjust 'spikiness' index to filter out less impressive pivot highs/lows (higher number = more selective)
US Treasuries Yield CurveNews about the yield curve became pretty crucial for all the trades in the last year.
So in the team, we decided to implement a nice widget that will allow you to track the current yield curve in your chart directly.
It's possible to compare the current yield curve with past yield curves. You can choose to display the number of curves weeks, months, and years ago. So you can see the dynamics of the yield curve change.
When the Y2 > Y10 curve is considered invested, so you'll see an "Inverted" notification on the chart.
Thanks to @MUQWISHI for helping code it.
Disclaimer
Please remember that past performance may not indicate future results.
Due to various factors, including changing market conditions, the strategy may no longer perform as well as in historical backtesting.
This post and the script don’t provide any financial advice.