Start the Script on Last Nth Bar [Experimental]Hello Pine Scripters,
Sometimes we need to run some processes in the scripts on last N bar but currently we don't know bar_index value of realtime bar or number of remaining bars before we reached it. So most of us use "start date" as input and run some processes after "start date".
This experimental script finds last Nth bar approximately. As you can see in the script we (should) use GMT, otherwise as I see the result might not be accurate (we don't know timezone used on the chart)
The idea is to find/use similar bar in the past (using timenow as reference) and then calculate aproximate the time of last Nth bar. the results may not be accurate all the time, also we can not know local holidays etc.
At the moment the script works on 1minute or higher time frames (it won't work on less 1min timeframes)
In the future if the Pine Team add something like "bar_index_realtime" then we will not need such things. by the way many thanks to Pine Team, they are doing great job.
You can use this script in your scripts as you want, no need to ask permission. If you can improve it let me know ;)
Enjoy!
Поиск скриптов по запросу "THE SCRIPT"
Ichimoku Kinkō hyō Keizen 改MTF善The script is not finnished yet and show's an other interpretation of how it could be scripted
Step -1 is complete... Basic Ichimoku with asjutable length and editable lines colors and visibilities.
Step -2 in progress... Adding ability to une multiple Spans, sens and Kumo on higher and lower timeframe.
Your Step : Like and Share ;) have a good year 2020 !
2020-01-06 /--------/ -R.V.
Jan 06
Release Notes: The script is not finnished yet and show's an other interpretation of how it could be scripted
Step -1 is complete... Basic Ichimoku with asjutable length and editable lines colors and visibilities.
Step -2 in progress... Adding ability to une multiple Spans, sens and Kumo on higher and lower timeframe.
Your Step : Like and Share ;) have a good year 2020 !
2020-01-06 /--------/ -R.V.
Jan 07
Jan 13
Release Notes: MTF Ichimoku is on it's way !!
Jan 17
Release Notes: The script is not finnished yet and show's an interpretation of how it could be scripted
Step -1 is complete... Basic Ichimoku with asjutable length and editable lines colors and visibilities.
Step -2 in complete... Adding ability to use multiple Spans, sens and Kumo on higher timeframe.
Step -3 in progress... Creating a UNIX based function to framgments actual chart periods in subcandles or "Subprices/periods" to plot multiple Spans, sens and Kumo on LOWER timeframe.
Your Step : Like and Share ;) have a good year 2020 !
/--------Coder--------/ -R.V.
Week designationThe script is primarily used for visualizing the beginning and end of the week. It is particularly helpful when working with time intervals shorter than one day. In a very simple and clear manner, you can see when a specific week has started. This makes it easier to assess the market sentiment in a short timeframe.
Here are the operating principles of this script:
Initialization:
The script begins with initialization, where basic parameters and settings such as line colors and line style are defined.
Determining the Session Start:
The startSession(hour, minute) function is used to calculate the starting time of a session on the chart. Sessions can be divided into different time intervals, such as the daily session (D), weekly session (W), and monthly session (M).
Checking for Session Start:
The script checks if a new session is starting. If so, a vertical line is inserted on the chart to mark the beginning of that session.
isSessionStart checks for the start of the daily session.
isSessionStart_2 checks for the start of the weekly session.
isSessionStart_3 checks for the start of the monthly session.
Marking Mondays:
The script checks if the current day is Monday (the day of the week number 2 represents Monday).
If the current session is starting or it is Monday, a vertical line is inserted on the chart with the day designation (color color_day).
Marking Lines on the Chart:
The lines inserted on the chart are vertical and have a specified style and color, which can be customized in the settings.
Earnings X-RayThe script presents earnings and revenues in a tabular format. Particularly, it calculates percentage changes.
Earnings data can be found in TradingView Financials. However, percentage changes are not provided. Can TradingView implement this in the future?
Displaying earnings table on the chart has its benefits. No additional clicks required to access the data. This significantly streamlines the stock scanning process.
It is important to quickly evaluate a company's earnings when scanning for stocks. The script provides this capability.
Similar scripts have been created previously. This script corrects calculations and improves presentation with the concise code.
Data access:
Earnings = request.earnings(syminfo.tickerid, earnings.actual)
FutureEarnings = earnings.future_eps
FutureRevenue = earnings.future_revenue
Can more than one quarter of future earnings estimates become available in Pine Script in the future?
The script was validated against MarketSurge.
Features:
Quarterly or Yearly data
Configurable number of fiscal periods
Configurable location on the chart
Optional Dark mode
JMA + A2RTS + AlertsThe script is a combination of two high quality scripts Everget's JMA and Alex Grover's A2RTS script, all credit too them for the original code.
Additional thanks to Mango2Juice for the continued help as this is my first script published and it would not of been possible without the help.
The goal of this script is to allow for you to enter into trends and too keep you in them while maximizing profit.
Trade Conditions:
Buy Enter: when JMA goes from red to green and use yellow line (A2RTS) as a trail stop
Buy Exit: when A2RTS flips or JMA goes back to red
Sell Enter: when JMA goes from green to red and use yellow line (A2RTS) as a trail stop
Sell Exit: When A2RTS flips or JMA goes back to green
Alerts have also been added for when JMA changes color and when A2RTS flips
Please drop a comment below if this script is helpful or if you have any question
Once again this is my first script and I hope you all enjoy it.
BNF VWAP & MAThe script picks up Bank nifty stocks with their current respective weights and plots a Volume Weighted Average Price ( VWAP ) line along with 2 EMAs of your choice and an alert when the EMAs cross over and also when price crosses VWAP .
You can customize the script for MA type and lengths and to remove alert. Basic utility of the script is to analyse volumes driving the Bank Nifty index.
Credits to @daytraderph and his script (Custom Volume ) who's code I used to build this script. Also thanks to my friend @Varun who helped me code it.
Insertion sort and binary searchThe script shows a workaround for arrays in pine-script via drawings.
There are few restrictions with them:
1. The length of the array cannot be more that amount of allowed drawings (about 40 by now)
2. Because the "array" shares the space of drawings throughout the whole script, using drawings with the "array" must be careful, with handly creating and removing of each drawing, because otherwise pine's garbage collector might break the "array"
3. Getter and Setter must be called on every bar, because of implementation of functions in pine there are inner serieses, which must be updated on every bar. So wherever you have a setter or getter in the code - it must be called on every bar. But if it's just an update, then you should pass 'false' as a param of the funtion.
The script also shows an example of implementation of Insertion sort of the array in pine: when the array have been created, it's filled with pseudo-random numbers and sorted on every bar. There are plotting of the array's numbers before/after soring to show the sorting result.
There's also an example of implementation of binary search: after generation elements of the array, the first element is kept in local variable and after sorting of the array, the scripts is looking for new element's position via binary search and then plot that new index in an array (last plotted value with the green color)
[e2] Fibonacci, Tribonacci, Tetranacci Sequence CalculatorThe script is a simple calculator to obtain numbers of Fibonacci, Tribonacci or Tetranacci Sequence.
The script contain calculations for constants (up to 16 digits) that could be used as one of the sequence's number.
The Calculator has 3 modes. Users can define the numbers to initialize the sequence in the options:
- The Fibonacci Sequence is the series of numbers, every next number is found by adding up the two numbers before it.
xn = xn-1 + xn-2
fiConst variable = Fibonacci Constant(Golden Ratio) - 1.61803...
"Classic" Sequence initialize with numbers {0, 1}. Output: 1,2,3,5,8,13,21...
To Calculate the Fibonacci Extensions the sequence should be initialized with {1, fiConst}. Output: 2.618, 4.236, 6.854...
- The Tribonacci Sequence is the series of numbers, every next number is found by adding up the three numbers before it.
xn = xn-1 + xn-2 + xn-3
trConst variable = Tribonacci Constant - 1.83929...
"Classic" Sequence initialize with numbers {0, 0, 1}. Output: 1,2,4,7,13,24...
To Calculate the Tribonacci Extensions the sequence should be initialized with {0, 1, trConst}. Output: 2.839, 5.679, 10.357...
- The Tetranacci Sequence is the series of numbers, every next number is found by adding up the four numbers before it.
xn = xn-1 + xn-2 + xn-3 + xn-4
teConst variable = Tetranacci Constant - 1.92756...
"Classic" Sequence initialize with numbers {0, 0, 0, 1}. Output: 1,2,4,8,15,29,56...
To Calculate the Tetranacci Extensions the sequence should be initialized with {0, 0, 1, teConst}. Output: 2.928, 5.855, 11.710...
The Calculator can return a single number or a set of numbers based on the selected sequence mode.
The script is made for other scripts integration rather than stand-alone usage.
The Opening Range / First Bar By Market Mindset - Zero To EndlesThe script shows the opening range of the instrument based on different resolutions and timeframes.
Inputs :
1. Resolution
It decides the calculation frequency of the script.
In Auto resolution, Standard values have been used.
2. Timeframe
It decides the timeframe for the OHLC values.
By default, it will use the chart timeframe and so chart OHLC values.
3. Lookback
It decides the no. of ranges shown on the chart.
Middle Line can be hidden from the settings.
The script can be used for any instrument and on any timeframe.
If price is above the opening range or the middle line, a trader should look for long opportunities.
If price is below the opening range or the middle line, a trader should look for short opportunities.
A sideways or choppy move is exoected if Middle line is crossed again and again.
For trading, wait for atleast 1st bar to close. and let the opening range build up first.
Happy Trading
[A618]Improved Wave channel 3D The Script is an Amalgamation of Two prominent Scripts in One
1. Ehlers 2 Pole ButterWorth Filter
2. Wave Channel 3D
Intuitively,
Buy when Candles are above all the filter Lines
Sell when Candles are below the Filter Lines
CREDITS
Favorite Signals w/EMA FilterThe script combines my favorite signals then filters them with three EMAs.
Via the Style tab, you can choose to either have the signals color the bar and/or plot a shape above/below.
All signals can be turned off via the Inputs tab, which will remove the bar color and/or shape (if not already off in the Style tab) as well as remove the pattern from the alerts function.
Remember when using TV alerts, if you change the script settngs, you must create a new alert if you wish to be alerted for the changes you've made.
LONG/SHORT SIGNALS INCLUDED FOR:
- TD8s
- TD9s
- Hammer
- Shooting Star
- Bullish Harami
- Bearish Harami
- RSI Divergences
EMA FILTER LOGIC LONGS:
- Price < Fast EMA & Med EMA > Slow EMA = Possible Long Entry
- Price > Fast EMA & Med EMA > Slow EMA = Possible Reversal, Tighten Stop or Reduce Position
EMA FILTER LOGIC SHORTS:
- Price > Fast EMA & Med EMA < Slow EMA = Possible Short Entry
- Price < Fast EMA & Med EMA < Slow EMA = Possible Reversal, Tighten Stop/Reduce Position
Big up to @spdoinkal, @HPotter, @LonesomeTheBlue, for writing the originals scripts for the signals above.
Enjoy!
Probability TableThe script is inspired by user NickbarComb, I suggested checking out his Price Convergence script.
Basically, this script plots a table containing the probability of the current candle closing either higher or lower based on user-define past period.
Hope that it will be helpful.
Previous OHLCThe scripts places horizontal levels on your charts indicating the previous Daily, Weekly or Monthly OHLC values over the current timeframe.
Slightly modified version of Nanda86's "Previous OHLC" script. I corrected a couple of bugs and added more control over colors and labels in general. I also removed the hourly OHLCs.
Confluence Buy-Sell Indicator with Fibonacci The script is a "Confluence Indicator with Fibonacci" designed to work on the TradingView platform. This indicator combines multiple technical analysis strategies to generate buy and sell signals based on user-defined confluence criteria. Here's a breakdown of its features:
Confluence Criteria: Users can enable or disable various strategies like MACD, RSI, Bollinger Bands, Divergence, Fibonacci, and Moving Average. The number of strategies that need to align for a signal to be generated can be set by the user.
Strategies Included:
MACD Strategy: Uses the Moving Average Convergence Divergence method to identify buy/sell opportunities.
RSI Strategy: Utilizes the Relative Strength Index to detect overbought or oversold conditions.
Bollinger Bands Strategy: Incorporates Bollinger Bands to identify volatility and potential buy/sell signals.
Divergence Strategy: A basic implementation that detects bullish and bearish divergences using the RSI.
Fibonacci Strategy: Uses Fibonacci retracement levels to determine potential support and resistance levels.
Moving Average Strategy: Employs a crossover system between the 50-period and 200-period simple moving averages.
Additional Features:
Support & Resistance: Identifies major support and resistance levels from the last 50 bars.
Pivot Points: Calculates pivot points to determine potential turning points.
Stop Loss Levels: Automatically calculates and plots stop-loss levels for buy and sell signals.
NYC Midnight Level: Option to display the New York City midnight price level.
Visualization: Plots buy and sell signals on the chart with green and red markers respectively.
Adequate Category:
"Technical Analysis Indicators & Overlays" or "Strategy & Scripting Tools".
Ichimoku Kinkō hyō Keizen 改善
The script is not finnished yet and show's an other interpretation of how it could be scripted
Step -1 is complete... Basic Ichimoku with asjutable length and editable lines colors and visibilities.
Step -2 in progress... Adding ability to une multiple Spans, sens and Kumo on higher and lower timeframe.
Your Step : Like and Share ;) have a good year 2020 !
2020-01-06 /--------/ -R.V.
Single Candle Model-DTFXThe script identifies the candles with engulfing body and marks the 50% of the candle for easy entry based on model of #DTFX single candle entry
Interpreting the Signals:
Look for candles labeled as "BE". These represent significant price action where the range is larger than the previous candle's range.
Pay attention to the 50% line of the "BE" candle:
A green line indicates a bullish "BE" candle.
A red line indicates a bearish "BE" candle.
Watch for Buy ("B") and Sell ("S") labels:
"B": Indicates a potential bullish breakout.
"S": Indicates a potential bearish breakdown.
Alerts:
Configure alerts in TradingView to notify you whenever a "B" or "S" signal is detected. This allows you to act on the signals without constantly monitoring the chart.
Use in Trading Strategies:
Combine this indicator with other tools like support/resistance levels, moving averages, or trend analysis to validate the signals.
Use the midpoint (50% line) of the "BE" candle as a potential reference point for stop-loss or target levels.
Customizations:
Adjust the appearance of labels and lines by modifying their style, color, or placement in the script.
Add filters (e.g., timeframes or volume conditions) to refine the detection of "BE" candles.
This indicator helps traders identify pivotal price movements and act on potential breakouts or breakdowns with clear visual markers and alerts.
Pocket Pivot with extrapolated Volume and Moving AveragesThe script shows historical pocket pivots, much as other scripts with a green diamond shape on the volume pane.
When the market is open, the current bar, however, is extrapolated to the end of the day using a sixth-order polynomial.
Thus real-time pocket pivots are shown. To work properly, the user must input a time-zone offset parameter; the default is west coast USA.
Time-zone offset is -12 hours to +12 hours compared to the NYSE exchange time zone (USA west coast: -3.)
The volume extrapolation polynomial is based on a historical NASDAQ intraday volume model developed locally by a team.
Only ten-day lookback pocket pivots are computed as defined initially by Dr. Chris Kacher. (The default lookback can be changed by the user.)
Only pocket pivots are shown where the low of the daily bar is within user-defined proximity to the 50-day moving average or 10-day moving average (for continuation pocket pivots.)
VWAP Bands - MultiTF and anchoredThe script has traditional VWAP for two different timeframes along with an option to anchor them to a particular bar. VWAP bands are also included in the script. The bands and VWAP act as hidden support/resistance for the scrip and are useful for intraday trading.
Edge of MomentumThe script was designed for the purpose of catching the rocket portion of a move (the edge of momentum).
Long
--When RSI closes over 60, take long order 1 tick above that bar. The closed bar above RSI 60 will be colored "green" or whatever color the user chooses. (RSI > 60)
--On a long position, exit will be a closed bar below the ema (low, 10) . The closed bar below the ema will be colored "yellow." (Price < ema)
--Note: On a long position there is no need to exit when a closed bar is colored "purple." RSI is just below 60 but above 40. Pullback or chop
Short
--When RSI closes below 40, take a short order 1 tick below that bar. The closed bar below RSI 40 will be colored "red." RSI<40)
--On a short position, exit will be a closed bar above the ema (low, 10). The closed bar above the ema will be colored "purple." (Price > ema)
--Note: On a short position there is no need to exit when a closed bar is colored "yellow."
Note: You may see a series of purple and yellow bars, that is simply chop. I define chop as RSI moving between 60 and 40.
Trade should only be taken above green colored candle(long) and below red colored candle (short). No position should be taken off yellow or purple candle (chop)
Again this is designed to catch the momentum part of a move, and to help reduce some entries during chop. It is a simple systems that beginning traders can use and profit from.
Note: I don't no shit about coding scripts I just learn from reading others.
Enjoy. If you decide to use please drop me a line...suggestions/comments, etc.
Best of luck in all you do.
Trend Strength Over TimeThe script serves as an indicator designed to assess and visualize trend strength and Volume strength over time. It employs a variety of calculations and conditions to offer insights into both bullish and bearish market trends. Let's explore the key conceptual elements of the code.
Trend Strength Conditions:
The script defines conditions to assess trend strength based on a comparison between each calculated percentile value and the highest high (bullish) or lowest low (bearish). Separate conditions are established for each percentile length, allowing for a nuanced understanding of trend dynamics across different timeframes.
Counting Bull and Bear Trends:
To quantify the strength of bullish and bearish trends, the script maintains counts for the number of conditions that are true for each. This count-based approach provides a quantitative measure of trend strength.
Weak Bull and Bear Counts:
Recognizing that trends are not always clear-cut, the script introduces the concept of weak trends. It counts instances where the percentiles fall between the highest high and lowest low, indicating a potential weakening of the prevailing trend.
Bull and Bear Strength:
Bull and bear strengths are calculated based on the counts, with adjustments made for weak trends. This step provides a more nuanced and comprehensive assessment of trend strength by considering both strong and weak signals.
Current Trend Value:
The culmination of these calculations is the determination of the current trend value. This value represents the balance between bullish and bearish forces, offering a dynamic indicator of the market's prevailing sentiment.
Volume Strength Calculation:
In addition to price-based indicators, the script incorporates volume strength as a crucial element. This is calculated using the simple moving averages (SMAs) of volume over different lengths, normalized relative to the SMA over a length of 144. Volume strength adds a layer of confirmation or divergence to the price-based trend analysis.
Color Change:
To facilitate quick and intuitive interpretation, the script dynamically changes the color of the plotted line on the chart based on the current trend value. Green indicates a bullish trend, red indicates a bearish trend, and blue suggests a neutral or indecisive market.
Plotting:
The script uses the plot function to visually present the calculated trend strength and volume strength on the chart. This visual representation aids traders in making informed decisions based on the identified trends and their strengths.
Volume Strength: A Detailed Explanation
In the context of the provided script, volume strength is a critical component used to assess the strength of a market trend. It provides insights into the level of participation and commitment of market participants, offering a complementary perspective to traditional price-based indicators. Let's delve into the concept and practical applications of volume strength.
Calculation of Volume Strength:
The script calculates volume strength by considering the simple moving averages (SMAs) of volume over different time periods (13, 21, 34, 55, 89). These individual SMAs are then normalized relative to the SMA over a more extended period of 144. The weights assigned to each SMA in the calculation are defined in the variable VCF (Volume Correction Factor).
Calculation of Volume Strength with Weights: The weights assigned to each SMA in this calculation are crucial for emphasizing the significance of shorter-term volume movements relative to a longer-term baseline.
Interpretation of Weights:
The choice of weights reflects the relative importance of shorter-term volume movements compared to longer-term trends. In this script, shorter-term SMAs (13, 21, 34, 55, 89) are assigned decreasing weights, while the longer-term SMA (144) serves as the baseline.
Shorter-term SMAs with higher weights may have a more immediate impact on the volume strength calculation. This implies that recent changes in volume carry more weight in assessing the current market conditions.
The decreasing weights for shorter-term SMAs might indicate that, as the timeframe lengthens, the significance of recent volume movements diminishes in relation to the longer-term trend. This approach allows for a focus on both short-term volatility and longer-term stability in volume patterns.
The purpose of normalization is to emphasize the current volume's significance in comparison to its historical context. This can help identify abnormal volume spikes or sustained increases in trading activity, which may indicate the strength or weakness of a trend.
Interpretation and Practical Use:
Confirmation of Trend:
Rising volume during an uptrend can validate the strength of the upward movement, suggesting that a significant number of market participants are actively buying. Conversely, decreasing volume during an uptrend might indicate weakening interest and a potential reversal.
In a downtrend, increasing volume on downward price movements reinforces the strength of the trend. A decrease in volume during a downtrend may suggest a potential weakening or exhaustion of the downward momentum.
Divergence Analysis:
Divergence occurs when there is a disagreement between the price movement and the corresponding volume. For example, if prices are rising but volume is declining, it could signal a lack of conviction in the upward movement, and a reversal might be imminent.
Conversely, if prices are falling, but volume is decreasing as well, it might suggest that the downward momentum is losing steam, and a potential reversal or consolidation could be on the horizon.
In conclusion, volume strength analysis provides traders with a powerful tool to gauge the conviction behind price movements. By incorporating volume data into the technical analysis, one can make more informed decisions, enhance trend identification, and improve risk management strategies.
Overnight High/LowThe script identifies the Overnight High (the highest price) and Overnight Low (the lowest price) for a trading instrument during a specified overnight session. It then plots these levels on the chart for reference in subsequent trading sessions.
Key Features:
Time Settings:
The script defines the start (startHour) and end (endHour + endMinute) times for the overnight session.
The session spans across two calendar days, such as 5:00 PM (17:00) to 9:30 AM (09:30).
Tracking High and Low:
During the overnight session, the script dynamically tracks:
Overnight High: The highest price reached during the session.
Overnight Low: The lowest price reached during the session.
Reset Mechanism:
After the overnight session ends (at the specified end time), the script resets the overnightHigh and overnightLow variables, preparing for the next session.
Visual Representation:
The script uses horizontal dotted lines to plot:
A green line for the Overnight High.
A red line for the Overnight Low.
These lines extend to the right of the chart, providing visual reference points for traders.
How It Works:
Session Detection:
The script checks whether the current time falls within the overnight session:
If the hour is greater than or equal to the start hour (e.g., 17:00).
Or if the hour is less than or equal to the end hour (e.g., 09:30), considering the next day.
The end minute (e.g., 30 minutes past the hour) is also considered for precision.
High and Low Calculation:
During the overnight session:
If the overnightHigh is not yet defined, it initializes with the current candle's high.
If already defined, it updates by comparing the current candle's high to the existing overnightHigh using the math.max function.
Similarly, overnightLow is initialized or updated using the math.min function.
Post-Session Reset:
After the session ends, the script clears the overnightHigh and overnightLow variables by setting them to na (not available).
Line Drawing:
The script draws horizontal dotted lines for the Overnight High and Low during and after the session.
The lines extend indefinitely to the right of the chart.
Benefits:
Visual Aid: Helps traders quickly identify overnight support and resistance levels, which are critical for intraday trading.
Automation: Removes the need for manually plotting these levels each day.
Customizable: Time settings can be adjusted to match different markets or trading strategies.
This script is ideal for traders who use the overnight range as part of their analysis for breakouts, reversals, or trend continuation strategies.
BTC/USD Inflation priced in! ~Period 2009 - 2023 (by TAS)The script creates a custom indicator titled "BTC Adjusted for Economic Factors.
Adjusted BTC Price is plotted in red, making it more prominent. The adjusted price is Bitcoin's historical closing prices adjusted for cumulative inflation over time, based on the Core Consumer Price Index (CPI) annual inflation rates from 2009 onwards.
The script calculates the adjusted price of Bitcoin by taking into account the effect of inflation on its value. It uses annual CPI rates for each year from 2009 to 2022 to calculate a cumulative inflation factor. The script assumes a placeholder inflation rate of 2.5% for 2023, indicating that this value should be updated when the actual rate is available. The script suggests adding CPI rates for additional years as they become available to maintain the accuracy of the adjustment.
Here's a breakdown of how the script works:
Core CPI Annual Inflation Rates: It starts by defining the annual inflation rates for each year from 2009 to 2022, expressed as a percentage divided by 100 to convert to a decimal.
Cumulative Inflation Calculation: The script calculates cumulative inflation starting from the year 2009 up to the current year. For each year that has passed since 2009, it multiplies the cumulative inflation factor by (1 + cpiRate), where cpiRate is the inflation rate for that year. This effectively compounds the inflation rate over time.
Adjusting Bitcoin's Price: The script then adjusts Bitcoin's closing price (close) for the calculated cumulative inflation to get the adjusted price (adjustedPrice).
Plotting the Prices: Finally, it plots both the original and the adjusted Bitcoin prices on the chart, allowing users to visually compare how inflation has theoretically impacted Bitcoin's value over time.
--------------------------------------------------------------------------------------------------
Important to notice, Fib. Retracements from the 2017 cycle top to the recent top (¬80K) doesn't look invalidated.
--------------------------------------------------------------------------------------------------
Inputs and feedback are welcome!
Whale Supertrend (V1.0)The script "Whale Supertrend (V1.0)" is an advanced trend indicator that uses multiple Supertrends with different factors to determine entry and exit points in the market. The Supertrend is a popular indicator that combines price and volatility to help identify trend direction. The script displays buy and sell signals based on the confluence of Supertrends.
How the script works
Configuring Supertrends
The script configures six Supertrends with different factors (factor, factor1, factor2, factor3, factor4, factor5) while using the same ATR period (atrPeriod = 10).
Supertrend 1: factor = 3
Supertrend 2: factor1 = 4
Supertrend 3: factor2 = 6
Supertrend 4: factor3 = 9
Supertrend 5: factor4 = 13
Supertrend 6: factor5 = 18
For each Supertrend, the bullish (blue) and bearish (purple) trend conditions are plotted on the chart.
Signal Calculation
The script calculates the number of Supertrends in bullish and bearish trend:
bullishCount: Number of Supertrends indicating a bullish trend.
bearishCount: Number of Supertrends indicating a bearish trend.
Signal Detection
The script triggers a buy or sell signal when at least three of the six Supertrends indicate the same trend:
Buy Signal (buySignal): Triggers when bullishCount is greater than or equal to 3.
Sell Signal (sellSignal): Triggers when bearishCount is greater than or equal to 3.
To avoid repetition, signals are only displayed when the state changes:
triggerBuy: Buy signal only when buySignal becomes true for the first time.
triggerSell: Sell signal only when sellSignal becomes true for the first time.