Adjustable MA & Alternating Extremities [LuxAlgo]Returns a moving average allowing the user to control the amount of lag as well as the amplitude of its overshoots thanks to a parametric kernel. The indicator displays alternating extremities and aims to provide potential points where price might reverse.
Due to user requests, we added the option to display the moving average as candles instead of a solid line.
Settings
Length: MA period, refers to the number of most recent data points to use for its calculation.
Mult: Multiplicative factor for each extremity.
As Smoothed Candles: Allows the user to show the MA as a series of candles instead of a solid line.
Show Alternating Extremities : Determines whether to display the alternating extremities or not.
Lag: Controls the amount of lag of the MA, with higher values returning a MA with more lag.
Overshoot: Controls the amplitude of the overshoots returned by the MA, with higher values increasing the amplitude of the overshoots.
Usage
Moving averages using parametric kernels allows users to have more control over characteristics such as lag or smoothness; this can greatly benefit the analyst. A moving average with reduced lag can be used as a leading moving average in a MA crossover system, while lag will benefit moving averages used as slow MA in a crossover system.
Increasing 'Lag' will increase smoothness while increasing 'overshoot' will reduce lag.
The following indicator puts more emphasis on its alternating extremities, an upper extremity will be shown once the high price crosses the upper extremity, while a low extremity will be shown once the low price crosses the lower extremity. These can be interpreted like extremities of a band indicator.
The MA using a length value of 200 with a multiplicative factor of 1.
In general, extremities will effectively return points where price might potentially bounce in ranging markets while closing prices under trending markets will often be found above an upper extremity and under a lower extremity.
Reducing the lag of the moving average allows the user to obtain a more timely estimate of the underlying trend in the price, with a better fit overall. This allows the user to obtain potentially pertinent extremities where price might reverse upon a break, even under trending markets.
In the above chart, the price initially breaks the upper extremity, however, we can observe that the upper extremity eventually reaches back the price, goes above it, provides a resistance, and effectively indicates a reversal.
Users can plot candles from the moving average, these are fairly similar to heikin-ashi candles in the sense that CandleOpen(t) ≠ CandleClose(t-1) , each point of the candle is calculated as follows for our indicator:
Open = Average between MA(t-1) and MA(t-2)
High = MA using the high price as input
Low = MA using the low price as input
Close = MA using the closing price as input
Details
Lag is defined as the effect of moving averages to reflect past price variations instead of new ones, lag can be observed by the user and is the main cause of false signals. Lag is proportional to the degree of filtering returned by the moving average.
Overshooting is a common effect encountered in non-lagging moving averages, and is defined as the tendency of a moving average to exceed a maximum level (or minimum level, which can be defined as undershooting )
MA and rolling maximum/minimum, both using a length of 50 bars. While we can think of lag as a cost of smoothness, we can think of overshooting as a cost for reduced lag on some occasions.
Explaining the kernel design behind our moving average requires understanding of the logic behind lag reduction in moving averages. This can prove to be complex for non informed users, but let's just focus on the simpler part; moving averages can be defined as a weighted sum between past prices and a set of coefficients (kernel).
MA(t) = b(0)C(t) + b(1)C(t-1) + b(2)C(t-2) + ... + b(n-1)C(t-n-1)
Where n is the period of the moving average. Lag is (non optimally) reduced by "underweighting" past prices - that is multiplying them by negative numbers.
The kernel used in our moving average is based on a modified sinewave. A weighted sum making use of a sinewave as a kernel would return an oscillator centered at 0. We can divide this sinewave by an increasing linear function in order to obtain a kernel allowing us to obtain a low lag moving average instead of a centered oscillator. This is the main idea in the design of the kernel used by our moving average.
The kernel equation of our moving average is:
sin(2πx^α)(1 - x^β)
With 1>x>0 , and where α controls the lag, while β controls the overshoot amplitude.
Using this equation we can obtain the following kernels:
Here only α is changed, while β is equal to 1. Values to the left would represent the coefficients for the most recent prices. Notice how the most significant coefficients are given to the oldest prices in the case where α increases.
Higher overshoot would require more negative values, this is controlled by β
Here only β is changed, while α is equal to 1. Notice how higher values return lower negative coefficients. This effectively increases the overshoots amplitude in our moving average. We can decrease α in order for these negative coefficients to underweight more recent values.
Using α = 0 allows us to simplify the kernel equation to:
1 - x^β
Using this kernel we can obtain more classical moving averages, this can be seen from the following results:
Using β = 1 allows us to obtain a linearly decreasing kernel (the one of a WMA), while increasing allows the kernel to converge toward a rectangular kernel (the one of SMA).
อินดิเคเตอร์และกลยุทธ์
Unicode Font Function V2 - JDThis script is a continuation from Duyck's Unicode font function
A different approach made on this function to able change font type on a single string
Now you can call it as a function to change the font type on every string that you need,
either it is for a Label or regular Text
Shoutout to @Duyck for his amazing works on this function.
Thank you to PineScript Community as well
Let me know if you guys have any suggestion or idea.
Greets,
dddfault
Auto PitchFan, Fib Extension/Retracement and ZigZag by DGT Aᴜᴛᴏ PɪᴛᴄʜFᴀɴ, Fɪʙ Exᴛᴇɴꜱɪᴏɴ/Rᴇᴛʀᴀᴄᴇᴍᴇɴᴛ ᴀɴᴅ ZɪɢZᴀɢ
This study aim to automate PitchFan drawing tool and combines it with Fibonacci Extentions/Retracements and ZigZag.
Common setting options, applied to all components of the study
Deviation , is a multiplier that affects how much the price should deviate from the previous pivot in order for the bar to become a new pivot. Increasing its value is one way to get higher timeframe Levels
Depth , affects the minimum number of bars that will be taken into account when building
Historical PitchFan / Fibonacci Levels option will allow plotting of PitchFan / Fibonacci Levels on previous Pivot Highs/Lows
█ PɪᴛᴄʜFᴀɴ — is a set of rays spreading out of the point of a trend's beginning. These rays inclined with the coefficients formed by a Fibonacci number sequence. It is recommended to adjust the Pitchfan plottings to fit after the first wave of the trend has passed and the correction has clearly begun.
PitchFan rays corresponding to Fibonacci levels appear on a chart and represent inclined lines of support and resistance. Price areas near these rays are estimated areas from which the price can turn around or make a significant rebound. The whole logic of working with a pitchfan is based on one simple idea - if the price has bounced off the level, then the correction is likely to end, and the trend will continue. If the price has broken the first resistance, you should wait for the next level test
- Automatically plots PitchFan Rays, based on Pivot Lows/Highs.
- Ability to set ALERTs for each PitchFan Ray Level
- PitchFan Labels displays the price of the line at the last bar, the price value will be recalculated in each new bar
Please check the link provided below with the educational post of how to apply pitchfork, application of pitchfan is same keeping in mind the recommendation stated above
█ Fɪʙ Rᴇᴛʀᴀᴄᴇᴍᴇɴᴛs / Exᴛᴇɴꜱɪᴏɴꜱ
Fibonacci retracements is a popular instrument used by technical analysts to determine support and resistance areas. In technical analysis, this tool is created by taking two extreme points (usually a peak and a trough) on the chart and dividing the vertical distance by the key Fibonacci coefficients equal to 23.6%, 38.2%, 50%, 61.8%, and 100%.
Fibonacci extensions are a tool that traders can use to establish profit targets or estimate how far a price may travel AFTER a retracement/pullback is finished. Extension levels are also possible areas where the price may reverse.
IMPORTANT NOTE: Fibonacci extensions option may require to do further adjustment of the study parameters for proper usage. Extensions are aimed to be used when a trend is present and they aim to measure how far a price may travel AFTER a retracement/pullback. I will strongly suggest users of this study to check the education post for further details where to use extensions and where to use retracements
- Automatically plots possible Support and Resistance levels, based on Pivot Lows/Highs.
- Ability to set ALERTs for each Fibonacci Extension/Retracement Level
- Labels displays the level and the level price
█ Zɪɢ Zᴀɢ — The Zig Zag indicator is used to help identify price trends and changes in price trends. The Zig Zag indicator plots points on a chart whenever prices reverse by a percentage greater than a Deviation variable. Straight lines are then drawn, connecting these points. The Zig Zag indicator serves base for PitchFan and Fibonacci Retracements / Extensions
█ OTHER
PitchFan is often used in combination with the other indicators and/or drawing tools such as Fibonacci Retracement, Fibonacci Channels, Fibonacci Time Zone and others. It allows identify the most powerful areas from which price can turn and to get more accurate trading signal
Andrews’ Pitchfork, how to apply pitchfork and automated pitchfork study
Fibonacci Fans, how to apply fibonacci fans and automated fibonacci speed and resistance fans study
Fibonacci Extension / Retracement, where to use extensions and where to use retracements and automated fibonacci extension / retracement / pivot points study
Others
Fibonacci Channels, how to apply fibonacci channels and automated fibonacci channels study
Linear Regression Channels, , what linear regression channels are? and linear regression channel/curve/slope study
Disclaimer :
Trading success is all about following your trading strategy and the indicators should fit within your trading strategy, and not to be traded upon solely
The script is for informational and educational purposes only. Use of the script does not constitute professional and/or financial advice. You alone have the sole responsibility of evaluating the script output and risks associated with the use of the script. In exchange for using the script, you agree not to hold dgtrd TradingView user liable for any possible claim for damages arising from any decision you make based on use of the script
Trend Type Indicator by BobRivera990Usage:
The purpose of this indicator is to programmatically determine the type of price trend using technical analysis tools.
You can do a quick check on the asset’s higher and lower time frames. For example, if you are trading on an H1 chart, you can check the m5 chart to ensure that the trend is in the same direction and similarly check the H4 chart to ensure that the higher time frame price is also moving in the same direction.
If multiple time frame charts confirm a similar trend, then it is considered a very strong trend and ideal for Trend trading.
Remarks:
By default, the last status is related to 8 periods before the latest closing price.
Related definitions:
The three basic types of trends are up, down, and sideways.
1. Uptrend
An uptrend describes the price movement of a financial asset when the overall direction is upward. The uptrend is composed of higher swing lows and higher swing highs.
Some market participants ("long" trend traders) only choose to trade during uptrends.
2. Downtrend
A downtrend refers to the price action of a security that moves lower in price as it fluctuates over time.
The downtrend is composed of lower swing lows and lower swing highs.
3. Sideways
A sideways trend is the horizontal price movement that occurs when the forces of supply and demand are nearly equal. This typically occurs during a period of consolidation before the price continues a prior trend or reverses into a new trend.
How it works:
Step 1: Sideways Trend Detection
In this step we want to distinguish the sideways trend from uptrend and downtrend. For this purpose, we use two common technical analysis tools: ATR and ADX
1. Average True Range (ATR)
The average true range (ATR) is a technical analysis indicator that measures market volatility.
We also use a 20-period moving average of the ATR.
When the ATR is below the average of its last 20-periods, it means that the rate of price volatility has decreased and we conclude that the current trend is sideways
2. Average Directional Index (ADX)
The average directional index (ADX) is a technical analysis indicator used by some traders to determine the strength of a trend.
The trend has strength when ADX is above 25.
So when the ADX is less than or equal to 25, there is no strong trend, and we conclude that the current type of trend is sideways.
Step 2: Detect uptrend from downtrend
If it turns out that the current price trend is not sideways, then it is either uptrend or downtrend.
For this purpose, we use plus and minus directional Indicators (+ DI & -DI).
A general interpretation would be that during a strong trend, when +DI is higher than -DI, it is an uptrend. When -DI is higher than +DI, it is a downtrend.
Parameters:
"Use ATR …" ________________________// Use Average True Range (ATR) to detect Sideways Movements
"ATR Length"_______________________ // length of the Average True Range (ATR) used to detect Sideways Movements
"ATR Moving Average Type" ___________// Type of the moving average of the ATR used to detect Sideways Movements
"ATR MA Length" ____________________// length of the moving average of the ATR used to detect Sideways Movements
"Use ADX ..."_______________________ // Use Average Directional Index (ADX) to detect Sideways Movements
"ADX Smoothing”____________________// length of the Average Directional Index (ADX) used to detect Sideways Movements
"DI Length"_________________________// length of the Plus and Minus Directional Indicators (+DI & -DI) used to determine the direction of the trend
"ADX Limit" ________________________// A level of ADX used as the boundary between Trend Market and Sideways Market
"Smoothing Factor"__________________// Factor used for smoothing the oscillator
"Lag"______________________________// lag used to match indicator and chart
Resources:
www.investopedia.com
security free MTF example - JDThis script is not intended for trading purposes but gives some examples how you can get values
from previous candles in other timeframes, without using security calls.
NOTE: the "open", "high" and "low" values are calculated "on the fly", as the bar progresses,
the "close" is determined at the end of the timeframe, so it's only know at the first bar of the next time period
JD.
#NotTradingAdvice #DYOR
Disclaimer.
I AM NOT A FINANCIAL ADVISOR.
THESE IDEAS ARE NOT ADVICE AND ARE FOR EDUCATION PURPOSES ONLY.
ALWAYS DO YOUR OWN RESEARCH!
Reverse Stochastic Momentum Index On ChartIntroducing the Reverse Stochastic Momentum Index "On Chart" version
According to Investopedia :
“The Stochastic Momentum Index (SMI) is a more refined version of the stochastic oscillator, employing a wider range of values and having a higher sensitivity to closing prices.”
The SMI is considered a refinement of the stochastic oscillator developed by William Blau and introduced in 1993 in an attempt to provide a more reliable indicator, less subject to false swings.
It calculates the distance of the current closing price as it relates to the median of the high/low range of price.
The SMI has a normal range of values between +100 and -100.
When the present closing price is higher than the median, or midpoint value of the high/low range, the resulting value is positive.
When the current closing price is lower than that of the midpoint of the high/low range, the SMI has a negative value.
Here I have reverse engineered the SMI formula to derive 2 functions.
One function calculates the chart price at which the SMI will reach a particular SMI scale value.
The second function calculates the chart price at which the SMI will crossover its signal line.
I have employed those functions here to give the "crossover" price levels for :
Upper alert level ( default 40, color : aqua blue )
Mid-Line ( default value 0, color : white )
Lower alert level ( default -40, color : purple )
Signal line ( default 13, colors : bright red & lime green )
And also to give the SMI eq price ( colors : red & green )
The midline, upper and lower alert levels return the closing price which would make SMI equal to their respective values
The user can infer from this that.....
Closing above these prices will cause the Stochastic Momentum Index to cross above the associated levels
Closing below these prices will cause the Stochastic Momentum Index to cross below the associated levels
Signal line returns the closing price where Stochastic Momentum Index is equal to its signal line
The user can infer from this that.....
Closing above this price will cause the Stochastic Momentum Index to cross above the signal line
Closing below this price will cause the Stochastic Momentum Index to cross below the signal line
SMI eq price returns the closing price which would make the SMI equal to its previous value
The user can infer from this that.....
Closing above this price will cause the Stochastic Momentum Index to increase
Closing below this price will cause the Stochastic Momentum Index to decrease
Note : all returned prices have a returned value filter to replace any values below zero with zero to help prevent auto focus issues.
These levels are displayed as plotted lines on the chart and also as an optional infobox with choice of displayed info.
This allows the user to see directly on the chart the interplay between the various crossover levels and price action and to precisely plan entries, exits and stops for their SMI based trades.
Traditionally traders and analysts will consider:
Positives values above 40 indicate a bullish trend
Negative values below -40 indicate a bearish trend .
Common traditional ways to derive signals from the SMI :
When the SMI crosses below -40 and then moves back above it, a buy signal is generated.
When the SMI crosses above +40 and then moves back below it, a sell signal is generated.
When the SMI line crosses above the signal line. A signal to buy is generated
When the SMI line crosses below the signal line signal to sell is generated.
When the SMI crosses above the zeroline, signal line and the SMI eq level many interpret that as a full bullish bias signal and take trades only in that direction, vice versa for bearish bias.
Traders also look for divergences between the SMI and price action.
The SMI is often used in conjunction with the Chande Momentum Oscillator or R squared indicator to determine overall market trendiness where the SMI is used to determine the direction of the trend, and also with volume indicators to show if the momentum carries significant selling or buying pressure.
Tick Data DetailedHello All,
After Tick Chart and Tick Chart RSI scripts, this is Tick Data Detailed script. Like other tick scrips this one only works on real-time bars too. it creates two tables: the table at the right shows the detailed data for Current Bar and the table at the left shows the detailed data for all calculated bars (cumulative). the script checks the volume on each tick and add the tick and volume to the specified level (you can set/change levels)
The volume is multiplied by close price to calculate real volume .There are 7 levels/zones and the default levels are:
0 - 10.000
10.000 - 20.000
20.000 - 50.000
50.000 - 100.000
100.000 - 200.000
200.000 - 400.000
> 400.000
With this info, you will get number of ticks and total volumes on each levels. The idea to separate this levels is in order to know which type of traders trade at that moment. for example volume of whale moves are probably greater than 400.000 or at least 100.000. Or volume of small traders is less than 10.000 or between 20.000-50.000.
You will get info if there is anomaly on each candle as well. what is anomaly definition? Current candle is green but Sell volume is greater than Buy volume or current candle is red but Buy volume is greater than Sell volume . it is shown as (!). you should think/search why/how this anomaly occurs. You can see screenshot about it below.
also "TOTAL" text color changes automatically. if Buy volume is greater than Sell volume then its color becomes Green, if Sell volume is greater than Buy volume then its color becomes Red (or any color you set)
Optionally you can change background and text colors as shown in the example below.
Explanation:
How anomaly is shown:
You can enable coloring background and set the colors as you wish:
And Thanks to @Duyck for letting me use the special characters from his great script.
Enjoy!
Exploring UnicodeThis script demonstrates how to display Unicode characters and symbols, including emoji, in Pine:
• Part 1 displays multi-line labels on hi/lo pivots.
• Part 2 displays price/volume bumps using small up/down arrows plotted with plotchar() .
• Part 3 detects bounces and uses plotshape() to mark them.
You can use our `f_bounceFrom()` function from this part as confirmation for signals in your strategies.
Note that the labels displayed on pivots with the code in Part 1 are plotted in the past. In realtime, they would only appear where they are after 50 bars have elapsed from that point. The other plots are plotted on the bar where their conditions are detected.
You can display thousands of Unicode characters and symbols using Pine. As you can see with our script, it is very easy to do so. The challenge will often be to find the exact symbols you are looking for. Many websites exist to help you explore Unicode characters or symbols. The PineCoders Resources page contains a section presenting a few of them.
Duyck has a Unicode font function script containing functions to convert strings to monospaced Unicode representations. TradingView uses the Trebuchet font for most of its text, including text displayed with Pine scripts. While its numerals are monospace and will align vertically in labels text, Duyck's functions will be handy when you need to convert characters to a monospaced form, so they also align vertically in multi-line labels.
What is Unicode?
Unicode is to character encoding what Wikipedia is to knowledge; it holds codes to a good proportion of the characters or symbols used by humans, past or present. In the early days of computing, environments from different manufacturers often used different character encoding schemes, making transport between them difficult. Unicode solves that challenge. It is a comprehensive encoding scheme that visionaries from Xerox and Apple came up with in the late 80's. The addition of members from the Research Libraries Group, Sun Microsystems, Microsoft, Next and Metaphor created the "Unicode working group" and later, the Unicode Consortium , which continues to improve and manage the Unicode standard.
Theoretically, Unicode encodes values representing characters or glyphs —not their pictorial representations. The letters "A" or "a", or the blue heart emoji "💙" are each represented by a Unicode value. In practice, however, there are many different versions of the Latin alphabet in Unicode. That is how our low pivot label can display different representations of the letters "ITV". The exact rendition of Unicode symbols on a specific device is left to equipment manufacturers and typeface designers.
The current Unicode space is comprised of 17 planes of 65,536 characters each, which allows for more than one million code points . Planes are further divided into character blocks , which typically hold a character set corresponding to one script—or language. Emoticons are in the character block starting at U+1F600.
Look first. Then leap.
Unicode font function - JDPinescript only allows the use of one type of font in texts and label, which causes some inconveniences:
- It's hard to make a label or text "look nice" and clear because it's not possible to use a different font for titles, etc.
- Because the default Pinescript font is not a monospaced font, (in Pinescript different characters have different widths)
this makes it really difficult to align things in a label on different rows
and causes everything to be "all over the place" and look messy
With the workaround in this script, you can "translate" the text string that you want to put in a label into a text with either upper case, bold and/or italic characters,
allowing for more control over the layout of the label text, by adding differently styled titles, control over spacing for columns, etc...
The characters provided in this script are an example of a monospaced font, but can easily be replaced by copy-pasting in other characters in the appropriate section
and the script will then use the new characters as replacements.
This script is to show the possibilities and principles of the functions.
The principles of this framework can be used to build your own go-to "text style conversion" functions, for styles that you use a lot, for example for titles.
A big shoutout to @DonovanWall, for the awesome character replacement idea that I built upon!!!
A shoutout also to the PineCoders community, who provide an infinite source of knowlegde and inspiration!!
Enjoy!
Gr, JD.
Grid Bot SimulatorThis script is a grid bot simulator for ranging/choppy markets. Prices are divided into grids, or trade zones, that will trigger signals each time a new zone is entered. During ranging markets, each transaction is followed by a “take profit.” As the market starts to trend, transactions are stacked (compare to DCA), until the market consolidates. No signals are triggered above the Upper Limit or Below the Lower Limit.
Settings overview:
Upper Limit/Lower Limit : Highest and Lowest values for entire grid.
Number of Grids : Number of trade zones.
Show Grids : Show or hide all gridlines.
Show Only Current Grids : Only display the grids just above and just below the current trade zone.
High/Low for signals : If enabled, signals are triggered as soon as the price touches the next zone. If disabled, signals are triggered after bar closes. Enable this for “Once Per Bar alerts. Disable for “Once Per Bar Close” alerts.
Highlight Trade Zones
The grid bot should work well during ranging/choppy markets. Each zone will have only one trade, and then will immediately take profit in the next zone.
Ranging/Choppy Market
However, trending markets can produce multiple signals in rapid succession:
Trending Market
If the gridlines are compressing the chart space, enable the “Show Only Current Grids” in settings.
Show Only Current Grids disabled
Show Only Current Grids enabled
When changing symbols, adjust the Upper and Lower Limits to accommodate the new symbol. Otherwise, the chart will look compressed.
XBTUSD chart with ETHUSDT settings
The bot is a proof-of-concept and is considered experimental . Possible future updates will include Fibonacci grids and “smart entry/exits,” depending on the current trend. Comments and suggestions are encouraged.
Auto Fib Speed Resistance Fans by DGTFibonacci Speed and Resistance Fan is an analytical drawing tool used to indicate the support and resistance levels of an existing trend and the price level at which possible changes in the trend may occur.
A Fibonacci Speed Resistance Fan consists of a trend line drawn between two extreme points - a trough and opposing peak or a peak and opposing trough - on which a set of sequential speed resistance lines are drawn above (which represents time) and below (which represents price). These lines are drawn based on time/price percentages of the distance between the beginning and the end of the trend line.
Speed resistance lines not only help to measure trend corrections but also measure the speed of a trend (the rate at which a trendline ascends or descends)
Traders can use the lines of the Fibonacci Speed and Resistance Fan to predict key points of resistance or support, at which they might expect price trends to reverse. Once a trader identifies patterns within a chart, they can use those patterns to predict future price movements and future levels of support and resistance. Traders use the predictions to time their trades. Key support and resistance levels tend to occur frequently at the 61.8-percent level on both uptrends and downtrends.
Please check for further details in the education post that I will share shortly after this publication :
Nobody appears to know whether Fibonacci tools work because markets exhibit some form of natural pattern or because many investors use Fibonacci ratios to predict price movements, making them a self-fulfilling prophecy.
█ Study OPTIONS
Auto Fibonacci Speed and Resistance Fan , the main aim of the study
- Pivot threshold can be adjusted via “Deviation” and “Depth” input options
- Historical Fans option will allow plotting of Speed and Resistance Fans on previous pivot high/lows
- Ability to set ALERTs for the Speed and Resistance Levels
- Price Grid Lines if extended it will result with Fib Retracement levels
- All lines, line levels are customizable, default values are set exactly to the same with the available Fib Speed and Resistance Fan drawing tool
Zig Zag – Derived from build-in Auto Fib Retracement with some customization options.
Example Usages :
Disclaimer :
Trading success is all about following your trading strategy and the indicators should fit within your trading strategy, and not to be traded upon solely
The script is for informational and educational purposes only. Use of the script does not constitute professional and/or financial advice. You alone have the sole responsibility of evaluating the script output and risks associated with the use of the script. In exchange for using the script, you agree not to hold dgtrd TradingView user liable for any possible claim for damages arising from any decision you make based on use of the script
Correlation [array's]This script isn't about creating a correlation script with labels, there is a perfect working example of @Mango2Juice
(Correlation Matrix, which was inspired by @Daveatt's Correlation Matrix)
The intention was making it with the use of as less code as possible, looping through array's
The Pine correlation function doesn't work consistently in a local scope (loop), so I had to work around it
Inspired by @ZenAndTheArtOfTrading's Correlation Meter (using array.covariance and array.stdev) and
especially with the help of @RicardoSantos and @LonesomeTheBlue I've managed to do this
Symbols, timeframe, look-back period, colors and limits can be changed
There is always room for improvement, but I think it shows what is possible.
Many thanks to the people who I've mentioned, and of course to Tradingview!
(Without the Earth nothing can grow)
Cheers!
RedK_Portfolio Tracker v2: few enhancements and display optionsThis is an update for the PTracker v1 that I published couple of days ago. wanted to publish this as a separate script to get a chance to show how the new Portfolio Summary Infobox can be displayed on the price chart as an option. In my opinion, that info box is the most important element in this tool and that's the piece i was most looking for.
quick note here: you can track your portfolio (if not so many positions) by entering something like (without the brackets) in TradingView's chart symbol area - TradingView will resolve these symbols and chart the total -- there's a nice post by our friend @boji1 about this in a lot more details - however, that wouldn't show the stats that i need to look at to track my portfolio on daily basis.
i also made couple of other enhancements, like adding the ability to include "free cash" in the portfolio - While this free cash value will impact the Total P/L and P/L %, as part of the overall portfolio (and the denominator), it will not impact the "cost of positions" or the (current) "value of positions" -- also "Cash" will not count towards the total 10 positions that we can track with this tool.
Using Portfolio Tracker as a floating panel on the price chart
====================================================
By default, when the Portfolio Tracker is added to the chart, it will occupy its own lower panel like the picture above.
if your charts are already busy (like mine :)) - you most probably already have a couple of lower studies and it's crowded there.
in this case, you can use the Object Tree tool after adding the PTracker, to drag it onto the price panel, or you can also do that by right-clicking on the infobox and choose to move up to the price panel.
when you do that, remember to also use the Style settings of PTracker to hide both Portfolio and PnL plots, and choose Scale = no scale - this way you get the infobox to work like a floating panel on the price chart
here's a screenshot that shows this scenario - also shows how the infobox color can be easily changed from the PTracker settings to suit your chart background and for best visibility
i hope this is useful in your trading - i look forward to @TradingView team surprising us with a real portfolio tracking capability soon :)
good luck.
Higher Order PivotsFirst order pivot points are defined as 3 or 5 bar "V" shaped patterns. For example a high with a lower high either side of the peak and in the case of the 5 bar variant with lower highs adjacent to a high below the peak.
Second order pivot points are defined by three first order pivots in the same manner. For example a peak pivot high with a lower pivot high to either side.
Third order pivots follow the same pattern, a peak second order pivot high with two adjacent second order pivot highs.
As it can take a significant and variable amount of time before higher order pivots are confirmed, it is generally inadvisable to use higher order pivots for live trading!
However they can be used for historical analysis. For example to delineate market structure of major market inflections.
For example :
Delineating market structure using 2nd order pivots derived from 3 bar, 1st order pivots
Major market inflections from 3rd order pivots derived from 5 bar, 1st order pivots
RSI Bar ChartA different way to plot several RSI at once,
5 RSI with different options:
- source, length, timeframe
- size of indicator (width)
- color change
- limit change (30, 70), labels will be changed accordingly
- type of RSI line (line, arrow), linewidth
- offset label (at the right)
There are 4 colors (RSI line)
- when RSI > sell limit
- when RSI > 50 but below sell limit
- when RSI < 50 but above buy limit
- when RSI < buy limit
Arrows:
Different size:
Cheers!
[SK] Fibonacci Auto Trend ScouterThe FATS - Fibonacci Auto Trend Scouter automatically draws active trends from 2 different timeframes along with Fibonacci Support and Resistance levels. It also has a Sights feature for each timeframe which points from it's middle towards the current price. The tool is also highly customizable for you to take this indicator over 9000. If you like the tool and it adds value to you - share the love on the like button and visit my profile to check out my other indicators and subscribe, so you're notified of my next scripts and ideas!
Automatic Trend Lines
The indicator takes in 2 timeframes to detect High and Low values from which to draw the trend lines of each timeframe.
As the values change with price movement, the lines are updated. They are color coded for uptrend and downtrend based on the direction of each individual line. Trend lines can be set up to color with only the default value on the configurations panel.
- Toggle on/off Color Coded
- Change Default, Uptrend, Downtrend color
- Change Line Width
- Change Line Style
- Toggle on/off Line Extensions
- Change Extended Line Width
- Change Extended Line Style
- Toggle On/Off labels for 7 data points of each timeframe
Automatic Trend Sights
This is a neat feature that may help you get a better feel for the direction the current movement is heading towards in correlation with the short or medium length timeframe trends. The sight draws a line from the middle vertical point of the trend coordinates towards the current price. They are toggled off by default but can be enabled in the configurations panel.
- Toggle on/off sight on each timeframe
- Change Width
- Change Line Style
Automatic Fibonacci Levels
The tool has a very useful feature to automatically detect the highest and lowest value from the short timeframe to calculate Fibonacci support and resistant levels. To keep the chart area clean, the lines are drawn short by default towards the right side of the price but provide inputs to increase the size of the level lines towards the left and right direction. A triangle label appears to the side of each line which holds the Fibonacci level and price data inside the tooltip, hover over them to activate.
- Toggle on/off color coded
- Change Default, Resistance, Support colors
- Change line size towards the left and right side
- Change line width
- Change Resistance line style
- Change Support line style
- Toggle on/off High and Low source line
- Toggle on/off High and Low source labels
Faith IndicatorThis indicator compares buyers demand with sellers supply volumes and calculates which prevails. Therefore it only works if volume is published. Buyers demand is assumed for a period in which a higher high is reached with more volume. Sellers supply is recognized by a lower low combined with more volume.
The average of sellers supplies is subtracted from buyers demand, the result is graded because a statement like “The faith in this period was ## percent” has no meaning. We can conclude to more faith and less faith but not represent it in some exact number.
This indicator assigns the following grades:
Very high faith graduated as 8
High faith as 6
Good faith as 4
Some Faith as 2
Little Faith as 1
Neither Faith nor Distrust as zero
Self Protection Distrust graduated as -8
Fear Distrust as -6
Anxiety Distrust as -4
Suspicion Distrust as -2
Doubt Distrust as -1
It is presented as a histogram with blue staves pointing up (meaning faith) and red staves pointing down (meaning distrust)
The background is colored using the Hull Agreement Indicator (Hullag), which I published before. Hullag graduates price movements in five grades to which it assigns a background color. These are as follows:
grade 2: blue, clear upward movement
grade 1: green, some upward movement
grade 0: silver, neither upward nor downward movement
grade -1: maroon, some downward movement
grad -2: red, clear downward movement.
Use of the Faith Indicator:
The indicator shows price action/momentum as a background color and volume action analyzed as a grade of faith in the form of a histogram. Usually faith comes together with rising prices (blue/green background) and distrust with lowering prices (red/maroon background), however contrarian situations occur, e.g. lowering prices while the market has good faith. These can be explained by minority sellers who act contrary to the feelings in the market. You can then decide that this might be an unsustainable move of the quotes.
If the faith indicator confirms the price movement, you might assume that the move is meaningful and will go further. Also if you see faith diminishing you might assume that the move is coming to an end and the tide is going to turn.
Hurst ExponentMy first try to implement Full Hurst Exponent.
The Hurst exponent is used as a measure of long-term memory of time series. It relates to the autocorrelations of the time series and the rate at which these decrease as the lag between pairs of values increases
The Hurst exponent is referred to as the "index of dependence" or "index of long-range dependence". It quantifies the relative tendency of a time series either to regress strongly to the mean or to cluster in a direction.
In short, depending on the value you can spot the trending / reversing market.
Values 0.5 to 1 - market trending
Values 0 to 0.5 - market tend to mean revert
Hurst Exponent is computed using Rescaled range (R/S) analysis.
I split the lookback period (N) in the number of shorter samples (for ex. N/2, N/4, N/8, etc.). Then I calculate rescaled range for each sample size.
The Hurst exponent is estimated by fitting the power law. Basically finding the slope of log(samples_size) to log(RS).
You can choose lookback and sample sizes yourself. Max 8 possible at the moment, if you want to use less use 0 in inputs.
It's pretty computational intensive, so I added an input so you can limit from what date you want it to be calculated. If you hit the time limit in PineScript - limit the history you're using for calculations.
####################
Disclaimer
Please remember that past performance may not be indicative of future results.
Due to various factors, including changing market conditions, the strategy may no longer perform as good as in historical backtesting.
This post and the script don’t provide any financial advice.
P-Square - Estimation of the Nth percentile of a seriesEstimation of the Nth percentile of a series
When working with built-in functions in TradingView we have to limit our length parameters to max 4999. In case we want to use a function on the whole available series (bar 0 all the way to the current bar), we can usually not do this without manually creating these calculations in our code. For things like mean or standard deviation, this is quite trivial, but for things like percentiles, this is usually very costly. In more complex scripts, this becomes impossible because of resource restrictions from the Pine Script execution servers.
One solution to this is to use an estimation algorithm to get close to the true percentile value. Therefore, I have ported this implementation of the P-Square algorithm to Pine Script. P-Square is a fast algorithm that does a good job at estimating percentiles in data streams. Here's the algorithms original paper .
The chart
On the chart we see:
The returns of the series (blue scatter plot)
The mean of the returns of the series (orange line)
The standard deviation of the returns of the series (yellow line)
The actual 84.1th percentile of the returns (white line)
The estimatedl 84.1th percentile of the returns using the P-Square algorithm (green line)
Note: We can see that the returns are not normally distributed as we can see that one standard deviation is higher than the 84.1th percentile. One standard deviation should equal the 84.1th percentile if the data is normally distributed.
Tick Delta VolumeExperimental:
this script only works on live updating bars(market open and live), the longer it runs the more accurate it will be.
displays:
- total intrabar volume processed(may not be equal to volume).
- last delta tick change in volume.
- this bar delta avg and stdev per tick.
- a overall of all live candles processed avg and stdev of the deltas processed.
Auto Pitchfork, Fib Retracement and Zig Zag by DGTPitchfork is a technical indicator for a quick and easy way for traders to identify possible levels of support and resistance of an asset's price. It is presents and based on the idea that the market is geometric and cyclical in nature
Developed by Alan Andrews, so sometimes called Andrews’ Pitchfork
It is created by placing three points at the end of previous trends
Schiff and Modified Pitchfork is a technical analysis tool derived from Andrews' Pitchfork
In general, traders will purchase the asset when the price falls near the support of either the center trendline or the lowest trendline. Conversely, they'll sell the asset when it approaches the resistance of either the center line or the highest trendline.
█ Study OPTIONS
Auto Pitchfork , the main aim of the study
Pivots threshold can be customized by “Deviation” and “Depth” input options
Pitchfork Type selection, available options Andrews' Pitchfork (Original), Schiff and Modified Pitchfork
Ability to set ALERTs for the Pitchfork Levels
Ability to add customized levels (all level lines customizable)
Auto Fib Retracement – This is the build-in study of TradingView, slight changes applied to fit with Auto Pitchfork
Zig Zag – Derived from build-in Auto Fib Retracement with some customization options.
█ Usage Tips :
Andrews' Pitchfork (Original) best fit in a Strong Trending Market
Schiff and Modified Pitchfork better with Correcting or Sideways Market. Modified Pitchfork is almost identical to a Parallel Chanel
Disclaimer :
Trading success is all about following your trading strategy and the indicators should fit within your trading strategy, and not to be traded upon solely
The script is for informational and educational purposes only. Use of the script does not constitute professional and/or financial advice. You alone have the sole responsibility of evaluating the script output and risks associated with the use of the script. In exchange for using the script, you agree not to hold dgtrd TradingView user liable for any possible claim for damages arising from any decision you make based on use of the script