Pivot Points High Low & Missed Reversal Levels [LuxAlgo]Pivot Points High/Low, sometimes referred to as "Bar Count Reversals" allows highlighting market prices local tops and bottoms. This method compares the price value at a certain index within a user-specified window length and tests whether it is the highest (pivot high) or lowest (pivot low).
This method can return successive pivots of the same type, thus missing certain reversals, as such, we aimed to highlight those missed reversals and provide a level at their location to determine if they had any significant role to play. A zig-zag is additionally built, connecting regular pivots with missed reversals.
Settings
Pivot Length: Determine the "Bar Count Reversals" window size. higher values will highlight more significant reversals.
Other settings control the look of the displayed graphical elements within the indicator.
Usage
Missed reversals are highlighted by labels with a ghost emoji, a Zig-Zag line connecting a missed reversal is dashed. Note that labels are offset by -Pivot Length bars (with the exception of the most recent one), and as such are detected further ahead of their location.
When a missed reversal is detected, a level is displayed, starting at the location of the missed reversal and ending when a new missed reversal is detected.
These levels can be used as support and resistance.
The most recent label estimates the possible location of a confirmed reversal, and will continuously readjust whether price makes a new higher high/lower low depending on the type of previously detected pivot. A level is also made out of this estimated reversal.
Luxalgo
McDonald's Pattern [LuxAlgo]Tradingview asked, we delivered. This script fits a cubic Bezier curve using tops/bottoms in order to approximate a McDonalds pattern, a popular meme pattern in the crypto trading community.
Traditionally the McDonalds pattern is described by an M pattern with deep retracement (> 50%), forming a McDonalds logo.
Please note that this indicator is a meme & should not be taken seriously. Some aspects of this indicator are not real-time and meant for descriptive analysis alongside other components of this script, in this case, for entertainment purposes. We suggest looking through our other open-source scripts if you’re looking for more serious tools.
🔶 USAGE
The script fits Bezier curves using specific tops/bottoms as control points. When the distance between tops and bottoms values is relatively small, the user can more easily identify the pattern.
A score is shown on the top right of the chart, aiming to return how close the returned pattern is to the original logo.
A regular Mcdonalds pattern would return a red background, while an inverted pattern would return a green one.
🔶 SETTINGS
Length: Sensitivity of tops/bottoms detection. The method does not make use of pivot points, using rolling maximums/minimums instead.
Use First Bar As Vertex: Use the price and bar index of the last bar as vertex.
Volume Footprint [LuxAlgo]This indicator estimates a volume footprint using tick data. The script automatically separates a candle into equidistant intervals with a width obtained from the average true range or a user-given width.
Settings
Method: Interval width calculation method. This ultimately determines the number of intervals separating one candle.
Width (At the right of Method): Atr period or user given width depending on the selected method. A lower user-given width would divide a candle into a higher number of intervals.
As Percent: Returns the accumulated volume within each interval as a percentage of the total candle volume.
Style
Display Type: Determines the appearance of the returned volume footprint.
Trend Color: Color to use based on whether a candle is bullish or bearish.
Usage
When applied to a chart, the user will be asked to select the settings to use for the volume footprint. Note that changing the settings afterward will reset the volume footprint, removing previously generated footprints.
A new footprint will appear on the confirmation of a new bar, as such this version might only be useful in lower timeframes.
A volume footprint allows users to see the number of contracts exchanged within a candle interval. It can as such be seen as some kind of intrabar volume profile.
This can be useful to see areas of interest within a candle.
Different Appearance
By default, the volume footprint makes use of colored boxes with a color based on whether the candle was bullish or bearish.
Another appearance that gives additional information is the gradient type, which uses intervals color based on the number of contracts exchanged within an interval relative to the total volume of the candle. A higher number of contracts within an interval would return a darker color by default.
The regular display type makes use of boxes with a single color, with lines on the side indicating whether the candle was bullish or bearish.
Trendlines with Breaks [LuxAlgo]The trendlines with breaks indicator return pivot point based trendlines with highlighted breakouts. Users can control the steepness of the trendlines as well as their slope calculation method.
Trendline breakouts occur in real-time and are not subject to backpainting. Trendlines can however be subject to repainting unless turned off from the user settings.
The indicator includes integrated alerts for trendline breakouts.
🔶 USAGE
Any valid trendlines methodology can be used with the indicator, users can identify breakouts in order to infer future price movements.
The calculation method of the slope greatly affects the trendline's behaviors. By default, an average true range is used, returning a more constant slope amongst trendlines. Other methods might return trendlines with significantly different slopes.
Stdev makes use of the standard deviation for the slope calculation, while Linreg makes use of the slope of a linear regression.
The above chart shows the indicator using "Stdev" as a slope calculation method. The chart below makes use of the "Linreg" method.
By default trendlines are subject to backpainting, and as such are offset by length bars in the past. Disabling backpainting will not offset the trendlines.
🔶 SETTINGS
Length: Pivot points period
Slope: Slope steepness, values greater than 1 return a steeper slope. Using a slope of 0 would be equivalent to obtaining levels.
Slope Calculation Method: Determines how the slope is calculated.
Backpaint: Determine whether trendlines are backpainted, that is offset to past.
RSI Multi Length [LuxAlgo]The following indicator aims to return information over RSIs using multiple periods, including the percentage of RSIs of different periods being overbought/oversold, as well as the average between these multiple RSIs.
The percentage of RSIs of different periods being overbought/oversold is additionally used to return adaptive overbought/oversold levels.
Settings
Maximum Length: Maximum period of the RSI used for the indicator calculation
Minimum Length: Minimum period value of the RSI used for the indicator calculation
Overbought: Value of the overbought level
Oversold: Value of the oversold level
Src: Input source of the indicator
Usage
The main element of the indicator is given by the multi-length RSI average, returning an oscillator similar to a fixed-length RSI. Because of its multiple length nature, the indicator can reflect shorter to longer-term price variations depending on the Maximum/Minimum length range defined by the user.
The green area indicates the percentage of RSIs over the user-defined overbought level. The red area indicates the percentage of RSIs under the user-defined oversold level, this percentage is inverted for ease of visualization. Additionally, a dashboard at the top right of the indicator pane indicates these percentages for the most recent bar.
A lower percentage of overbought/oversold RSIs can indicate a potential shorter-term retracement.
These percentages are used to construct adaptive overbought/oversold levels for the average multi-length RSI. The overbought level will be easier to reach if the percentage of overbought RSI's is high, the same logic applies to the adaptive oversold level.
VWAP Bands - Event Based [LuxAlgo]This indicator returns VWAP bands with a degree of smoothness resetting based on various user-selected events. The bands are constructed using a VWAP based naive standard deviation.
The indicator can be anchored or start from the first bar and can be used as trailing support/resistance, in a moving average crossover system, or as source for external indicators.
Settings
Start: VWAP anchor point
Start At First Bar: Display the VWAP from the first bar instead of a specified anchor point
VWAP
Length: Controls certain characteristics of the user-selected event
Mult: Multiplicative factor for the VWAP standard deviation
Source: Price source of the indicator
Event
Event: Determines the event resetting the degree of smoothness of the VWAP
External Cross/Event: Input source used for external crosses/events
Further details about the available events are given below.
Details
Various event conditions are available to the users. When the selected event occurs, the VWAP equals the current closing price.
By default, the event is periodic, that is the VWAP resets periodically, with a period determined by the Length setting.
The Higher High event resets the VWAP when a new higher high occurs.
The Lower Low event resets the VWAP when a new lower low occurs.
The Trend Change event is similar however resets the VWAP only once a higher high or lower low occurs. Higher highs and lower lows are given by Donchian channels with a period determined by the Length setting.
The Start event reset the VWAP at the selected anchor point (or first bar if the "Start At First Bar" setting is selected). This can be useful if one only needs a regular anchored VWAP band indicator.
The External Cross event resets the VWAP when the Source price crosses the series selected in the External Cross/Event setting. In the image above the VWAP resets when the price crosses the volatility stop indicator.
The External Event resets the indicator when a series selected in the External Cross/Event setting is not equal to 0. This allows using a custom event in order to reset the VWAP. In the above example the VWAP is reset during a new session due to the External Session indicator.
Harmonic Pattern Detection [LuxAlgo]Harmonic patterns make up a major part of the many patterns traders use to make investment decisions. The following tool aims to automatically categorize which XABCD harmonic pattern is highlighted by the user and to alert when the price reaches the PRZ or D point.
The tool can categorize Bat, Gartley, Butterfly, and Crab patterns.
Settings
XA Precision: The Gartley and Butterfly patterns require precise ratios for the XA segment, this setting allows giving some headroom for the detection of these patterns. For example, the Gartley pattern requires a ratio for the XA segment of 0.618, using an XA precision of 0.01 will allow the segment to be considered correct if above 0.608 and under 0.628.
Bullish: Color of a bullish pattern
Bearish: Color of a bearish pattern
The X, A, B, C, D settings determine the location of the harmonic pattern vertices. The user does not need to change them from the settings, instead only requiring adjusting their location on the chart like with a regular drawing tool. Setting these vertices is required when adding the indicator to your chart.
Usage
Upon setting the harmonic pattern vertices, the segments, as well as each ratio and PRZ, will be displayed. A dashboard in the top right displays which harmonic pattern has been detected.
Detected bearish crab pattern on BTCUSD15.
Bullish butterfly pattern on MATICUSD15. It is important not to use an XA precision value that would return overlapping ranges between the Gartley/Harmonic and other patterns. Using the default value is recommended.
The upper limit of the PRZ is determined as vertex D plus 38.2% of segment DX, while the lower limit is the vertex D minus 38.2% of segment DX. Various methods exist for the determination of the PRZ, this one is general but the user can use one proper to the detected harmonic pattern.
Finally hovering on the label highlighting the segment ratios return the proper ratio used by each harmonic pattern for that precise segment.
Fibonacci Toolkit [LuxAlgo]This toolkit aims to display multiple Fibonacci drawing tools including retracements, arcs, circles, fans, timezones and spirals.
Usage
Upon adding the indicator to the chart, users will be prompted to choose a starting point and an ending point for the calculation of the drawing tools.
Users can then navigate to the settings of the toolkit and choose which drawing tool to display using the Fibonacci drop-down menu. Users are also free to change the default Fibonacci ratios used by the indicator from within the settings. Each tool is described below.
Retracements
Fibonacci retracements display multiple levels constructed using the starting price point, ending price point, and multiple Fibonacci ratios. These levels can be used as support and resistance.
Arcs
Fibonacci arcs display multiple semi-circles. Each semi-circle crosses the line connecting the starting & end price point at a certain percentage determined by Fibonacci ratios. These arcs can be used as support and resistance.
Circles
The Fibonacci circles are similar to the Fibonacci arcs but display a full circle instead. Users can expect the price to bounce off of the circles.
This tool is less commonly used by traders.
Fan
A Fibonacci fan is a tool displaying trendlines all connected to a starting point and extending to a point determined by Fibonacci ratios. These can also be used as support and resistance.
Timezone
Fibonacci timezones return a series of horizontal lines. The distance of the lines increases by a factor given by the numbers in the Fibonacci sequence.
This tool can be useful to highlight points where a trend might reverse assuming that their duration increases over time.
Spiral
The Fibonnaci spiral displays a spiral that grows by a factor given by the golden ratio. This indicator returns a spiral using 7 turns (5 internal) and sets the origin of the spiral to the ending point which is selected by the user. The height of the spiral is based on the price range between the starting point and ending point.
Note that potential display artifacts can be seen when fitting the spiral on stocks and forex pairs.
Circular Barplot - Oscillators Sentiment [LuxAlgo]This indicator is an implementation of a circular barplot aiming to return the market sentiment given by multiple normalized oscillators. These include the relative strength index (RSI), Stochastic %K (%K), Linear Correlation Oscillator (ROSC), William Percent Range (WPR), Percent Rank (%R), and money flow index (MFI).
The length period of each of these oscillators can be adjusted in the indicator settings.
The label in the center of the circular plot returns the average market sentiment constructed from all the previously mentioned oscillators.
Settings
Width: Circle width.
Spacing: Determines how close each circle is to the other.
Thickness: Width of the colored lines.
Offset: Controls how far the circular barplot left extremity is from the most recent candles.
Src: Input source of the indicators.
Usage
Unlike regular bar charts, circular bar plots display the bars as circle arcs and have the advantage of preserving horizontal and vertical space. A higher arc length would indicate a value closer to the maximal value of the oscillator. Other variations of the circular barplots exist but this variation using the circle arc is particularly appropriate for normalized data.
The indicator can be used as a simple widget giving a quick method to obtain the overall market sentiment of a certain ticker. A dashboard is displayed on the top left of the chart in the event the user wants to see the actual value of the oscillators.
Note that low width or high spacing settings might return unwanted results.
Moon Phases Strategy [LuxAlgo]Trading moon phases has become quite popular among traders, believing that there exists a relationship between moon phases and market movements. This strategy is based on an estimate of moon phases with the possibility to use different methods to determine long/short positions based on moon phases.
Note that we assume moon phases are perfectly periodic with a cycle of 29.530588853 days (which is not realistically the case), as such there exists a difference between the detected moon phases by the strategy and the ones you would see. This difference becomes less important when using higher timeframes.
Settings
New Moon Reference Date: Date of a new moon to be used as starting point for the cycle calculation. Buy: Determine the condition to be used to open a long position Sell: Determine the condition to be used to open a short position
Description
The strategy can use different buy/sell conditions, these are determined in the Buy/Sell settings drop-down menu.
By default, the strategy goes long on a new moon and short on a full moon. This setup is common since full moons are said to be related to depressed mood. However, it is possible to use inverse conditions.
Users can also go long on higher moons (new moons or full moons occurring at a price that is higher than the previous one when a new/full moon occurred) and short on lower moons, this would return a trend following strategy, using the inverse conditions (buy lower moons/sell higher moons) would return a contrarian strategy.
The above chart displays the strategy using default conditions.
The above chart displays the strategy of going long on a higher moon and selling on a lower moon.
Quick Summary
We provide a quick summary of the strategy using default conditions (buy on a new moon, sell on a full moon) on various tickers using the 4h timeframe (note that using a lower timeframe would return a backtest executing a lower number of trades).
Constant position sizing is used and no frictional costs are considered.
BTCUSD
The moon phases strategy has been regularly tested with BTCUSD, with traders highlighting how moon phases tend to occur during tops/bottoms. We test the strategy from 2019-01-06 00:00.
Net Profit: $68544.86 Closed Trades : 67 % Profitability : 50.75 Max Drawdown : $18541.24 Max
TSLA
The strategy is tested from 2011-01-04 14:30
Net profit: $349.17 Closed Trades : 265 % Profitability : 54.34 Max Drawdown : $262.72
EURUSD
The strategy is tested from 2018-01-16 14:00.
Net profit: $-0.18 Closed Trades : 91 % Profitability : 50.55 Max Drawdown : 0.36
Orion Algo Strategy v2.0Hi everyone.
I decided to make the latest Orion Algo open to people. I don't have enough time to work on it lately, so I figured it would be best that everyone can have it to work on it. I took out some stuff from the original but it should give an idea on how things work. I made two strategies with this so far so you can use that to come up with your own. I recommend the DCA strategy because it gives you the most bang for Orion Algo's buck. It's pretty good at finding long entries.
Overall I hope you guys like this one. Also, Banano is the best crypto currency :)
-INFO-
Orion Algo is a trading algorithm designed to help traders find the highs and lows of the market before, during, and after they happen. We wanted to give an indicator to people that was simple to use. In fact we created the algorithm in such a way that it currently only needs a single input from the user. Since no indicator can predict the market perfectly, Orion should be used as just another tool (although quite a sharp one) for you to trade with. Fundamental knowledge of price action and TA should be used with Orion Algo.
Being an oscillator, Orion currently has a bias towards market volatility . So you will want to be trading markets over 30% volatility . We have plans to develop future versions that take this into account and adjust automatically for dead conditions. Also, while there are some similarities across all oscillators, what sets ours apart is the prediction curve. The prediction curve looks at the current signal values and gives it a relative score to approximate tops and bottoms 1-2 bars ahead of the signal curve. We also designed a velocity curve that attempts to predict the signal curve 2+ bars ahead. You can find the relative change in velocity in the Info panel. The bottom momentum wave is based on the signal curve and helps find overall market direction of higher time-frames while in a lower one.
Settings and How to Use them:
User Agreement – Orion Algo is a tool for you to use while trading. We aren’t responsible for losses OR the gains you make with it. By clicking the checkbox on the left you are agreeing to the terms.
Super Smooth – Smooths the main signal line based on the value inside the box. Lower values shift the pivot points to the left but also make things more noisy. Higher values move things to the right making it lag a bit more while creating a smoother signal. 8 is a good value to start with.
Theme – Changes the color scheme of Orion.
Dashboard – Turns on a dashboard with useful stats, such as Delta v, Volatility , Rsi , etc. Changing the value box will move the dashboard left and right.
Prediction – A secondary prediction model that attempts to predict a reversal before it happens (0-2bars). This can be noisy some times so make your best judgement. Curve will toggle a curve view of the prediction. Pivots will toggle bull/bear dots.
∆v – Delta v (change in velocity). This shows momentum of the signal. Crossing 0 signals a reversal. If you see the delta v changing direction, it may signify a reversal in the several bars depending on the overall momentum of the market.
Momentum Wave – Uses the signal as a macro trend indicator. Changes in direction of the wave can signify macro changes in the market. Average will toggle an averaging algorithm of the momentum waves and makes it easy to understand.
-STRATEGIES-
Simple - Just buy and sell on the dots
DCA - Uses the settings in the script for entries. If a buy dot appears then it will buy, if the price goes below the percentage it will wait for another dot before entering. This drastically improves DCA potential.
Linear Regression Histogram [LuxAlgo]This indicator is inspired by traditional statistical histograms. It will return the number of occurrences of price falling within each interval (bins) of the linear regression channel. This can be useful to highlight zones of interest within a trend.
Settings
Length: Number of recent closing prices used for the computation of the linear regression.
Bins Number: Number of intervals constructed from the linear regression channel.
Mult: Multiplicative factor for the RMSE. Controls the width of the linear regression channel.
Src: Input source of the indicator.
Usage
The indicator is constructed by dividing the linear regression channel range into a series of intervals (bins) of equal width. We then count the number of price values falling within each interval.
If a significant number of price values fall within a specific interval then that interval can highlight a potential zone of interest within a trend.
The zone of interest is highlighted in blue.
Nadaraya-Watson Envelope [LuxAlgo]This indicator builds upon the previously posted Nadaraya-Watson smoothers. Here we have created an envelope indicator based on Kernel Smoothing with integrated alerts from crosses between the price and envelope extremities. Unlike the Nadaraya-Watson estimator, this indicator follows a contrarian methodology.
Please note that by default this indicator can be subject to repainting. Users can use a non-repainting smoothing method available from the settings. The triangle labels are designed so that the indicator remains useful in real-time applications.
🔶 USAGE
🔹 Non Repainting
This tool can outline extremes made by the prices. This is achieved by estimating the underlying trend in the price, then calculating the mean absolute deviations from it, the obtained result is added/subtracted to the estimated underlying trend.
The non-repainting method estimates the underlying trend in price using an "endpoint Nadaraya-Watson estimator", and would return similar results to more classical band indicators.
🔹 Repainting
The repainting method makes use of the Nadaraya-Watson estimator to estimate the underlying trend in the price. The construction of the band extremities is the same as in the non-repainting method.
We can expect the price to reverse when crossing one of the envelope extremities. Crosses between the price and the envelopes extremities are indicated with triangles on the chart.
For real-time applications, triangles are always displayed when a cross occurs and remain displayed at the location it first appeared even if the cross is no longer visible after a recalculation of the envelope.
By popular demand, we have integrated alerts for this indicator from the crosses between the price and the envelope extremities. However, we do not recommend this precise method to be used alone or for solely real-time applications. We do not have data supporting the performance of this tool over more classical bands/envelope/channels indicators.
🔶 SETTINGS
Bandwidth: Controls the degree of smoothness of the envelopes, with higher values returning smoother results.
Mult: Controls the envelope width.
Source: Input source of the indicator.
Repainting Smoothing: Determine if a repainting or non-repainting method should be used for the calculation of the indicator.
🔶 RELATED SCRIPTS
For more information on the Nadaraya-Watson estimator see:
Linear Regression Fan [LuxAlgo]This indicator displays a fan using a linear regression fit to the price as a base. All lines are equidistant and are drawn from the first point of the linear regression to the most recent point of the linear regression plus the root-mean-square deviation (RMSD) multiplied by a certain factor.
Settings
Length: Lookback period for the linear regression.
Mult: Multiplier for the RMSD, allows returning wider fans.
Lines Per Side: Number of lines on each side of the fan.
Src: Input source of the indicator.
Usage
Traders often use the lines of fans to determine significant points of support or resistance at which they might expect price variations to reverse.
The length can be adjusted so that the starting point of the linear regression is located at a pivot high/low.
Some technical analysts use the measure rule of broadening wedges with fans when price breaks one of the extremities. This allows setting precise take-profits/stop-losses.
To learn more about the measure rule see:
The Echo Forecast [LuxAlgo]This indicator uses a simple time series forecasting method derived from the similarity between recent prices and similar/dissimilar historical prices. We named this method "ECHO".
This method originally assumes that future prices can be estimated from a historical series of observations that are most similar to the most recent price variations. This similarity is quantified using the correlation coefficient. Such an assumption can prove to be relatively effective with the forecasting of a periodic time series. We later introduced the ability to select dissimilar series of observations for further experimentation.
This forecasting technique is closely inspired by the analogue method introduced by Lorenz for the prediction of atmospheric data.
1. Settings
Evaluation Window: Window size used for finding historical observations similar/dissimilar to recent observations. The total evaluation window is equal to "Forecast Window" + "Evaluation Window"
Forecast Window: Determines the forecasting horizon.
Forecast Mode: Determines whether to choose historical series similar or dissimilar to the recent price observations.
Forecast Construction: Determines how the forecast is constructed. See "Usage" below.
Src: Source input of the forecast
Other style settings are self-explanatory.
2. Usage
This tool can be used to forecast future trends but also to indicate which historical variations have the highest degree of similarity/dissimilarity between the observations in the orange zone.
The forecasting window determines the prices segment (in orange) to be used as a reference for the search of the most similar/dissimilar historical price segment (in green) within the gray area.
Most forecasting techniques highly benefit from a detrended series. Due to the nature of this method, we highly recommend applying it to a detrended and periodic series.
You can see above the method is applied on a smooth periodic oscillator and a momentum oscillator.
The construction of the forecast is made from the price changes obtained in the green area, denoted as w(t) . Using the "Cumulative" options we construct the forecast from the cumulative sum of w(t) . Finally, we add the most recent price value to this cumulated series.
Using the "Mean" options will add the series w(t) with the mean of the prices within the orange segment.
Finally the "Linreg" will add the series w(t) to an extrapolated linear regression fit to the prices within the orange segment.
Liquidity Levels [LuxAlgo]The Peak Activity Levels indicator displays support and resistance levels from prices accompanied by significant volume. The indicator includes a histogram returning the frequency of closing prices falling between two parallel levels, each bin shows the number of bullish candles within the levels.
1. Settings
Length: Lookback for the detection of volume peaks.
Number Of Levels: Determines the number of levels to display.
Levels Color Mode: Determines how the levels should be colored. "Relative" will color the levels based on their location relative to the current price. "Random" will apply a random color to each level. "Fixed" will use a single color for each level.
Levels Style: Style of the displayed levels. Styles include solid, dashed, and dotted.
1.1 Histogram
Show Histogram: Determines whether to display the histogram or not.
Histogram Window: Lookback period of the histogram calculation.
Bins Colors: Control the color of the histogram bins.
2. Usage
The indicator can be used to display ready-to-use support and resistance. These are constructed from peaks in volume. When a peak occurs, we take the price where this peak occurred and use it as the value for our level.
If one of the levels was previously tested, we can hypothesize that the level might be used as support/resistance in the future. Additional analysis using volume can be done in order to confirm a potential bounce.
The histogram can return various information to the user. It can show if the price stayed within two levels for a long time and if the price within two levels was mostly made of bullish or bearish candles.
In the chart above, we can see that over the most recent 200 bars (determined by Histogram Window) 68 closing prices fall between levels A and B, with 27 bars being bullish.
Additionally, the width of a bin and its length can sometimes give information about the volatility of a specific price variation. If a bin is very wide but short (a low number of closing prices fallen within the levels) then we can conclude a most of the movement was done on a short amount of time.
Multi-Length Stochastic Average [LuxAlgo]This indicator returns the average of stochastic oscillators with periods ranging from 4 to length . This allows for a slightly more reactive oscillator as well as having information regarding the position of the price relative to rolling maximums/minimums of different periods.
We introduce settings that allow for pre and post-smoothing, with selectable smoothing methods and periods for both steps.
Settings
Length: Period of the indicator, determine the maximum period of the stochastic oscillator used in the average
Source: Source input of the indicator
Pre-Smoothing (1st Input): Degree of smoothing applied to the source input
Pre-Smoothing (2nd Input): Pre-Smoothing Method
Post-Smoothing (1st Input): Degree of smoothing applied to the final oscillator output
Post-Smoothing (2nd Input): Post-Smoothing Method
Smoothing methods include a simple moving average, a triangular moving average, and a least-squares moving average (this method can induce overshoots during the post-smoothing step). The user can also select "None".
Usages
The "multi-length" aspect of technical indicators is something that hasn't been deeply explored yet such indicators can give us information regarding both short-term and long-term information which was the motivation for the creation of the indicator.
The Multi-length Stochastic Average allows us to quantify the price position relative to a multitude of highest/lowest levels.
In the example above the oscillator returns the average of stochastic oscillators with periods ranging from 4 to 20, as well as multiple rolling minimums with periods ranging from 4 to 20. We can see that when the price is equal to all rolling minimums the oscillator is equal to 0, the oscillator would return 100 if the price were equal to all rolling maximums with periods in that same range.
The oscillator can be interpreted like any scaled oscillator and can be used to estimate trend direction as well as trend strength.
Here we only make of use pre-smoothing by using a period 20 simple moving average. The indicator graphical elements such as colors/circles can help us determine potential directions trends might take.
Circles are displayed when the oscillator crosses over/under the 20/80 level. Such conditions offer better timing than waiting for the oscillator to be greater/lower than 50 and are less subjective to noise than simply looking at the direction taken by the oscillator. However, it can suffer from potential retracements in a trend more easily, this is illustrated in the chart above.
Risk Management Tool [LuxAlgo]Good money management is one of the fundamental pillars of successful trading. With this indicator, we propose a simple way to manage trading positions. This tool shows Profit & Loss (P&L), suggests position size given a certain risk, sets stop losses and take profit levels using fixed price value/percentage/ATR/Range, and can also determine entries from crosses with technical indicators which is particularly handy if you don't want to set an entry manually.
1. Settings
Position Type: Determines if the position should be a "Long" or "Short".
Account Size: Determines the total capital of the trading account.
Risk: The maximum risk amount for a trade. Can be set as a percentage of the account size or as a fixed amount.
Entry Price: Determines the entry price of the position.
Entry From Cross: When enabled, allows to set the entry price where a cross with an external source was produced.
1.1 Stop Loss/Take Profit
Take Profit: Determines the take profit level, which can be determined by a value or percentage.
Stop Loss: Determines the stop loss level, which can be determined by a value or percentage.
2. Usage
One of the main usages of position management tools is to determine the position size to allocate given a specific risk amount and stop-loss. 2% of your capital is often recommended as a risk amount.
Our tool allows setting stop losses and take profits with different methods.
The ATR method sets the stop loss/take profit one ATR away from the entry price, with the ATR period being determined in the drop-down menu next to the selected methods. The range method works similarly but instead of using the ATR, we use a rolling range with a period determined in the drop-down menu next to the selected methods as well.
Unlike the available position management tool on TradingView, the entry can be determined from a cross between the price an an external source. The image above shows entries from the Volatility Stop indicator. This is particularly useful if you set positions based on trailing stops.
Nadaraya-Watson Smoothers [LuxAlgo]The following tool smoothes the price data using various methods derived from the Nadaraya-Watson estimator, a simple Kernel regression method. This method makes use of the Gaussian kernel as a weighting function.
Users have the option to use a non-repainting as well as a repainting method, see the USAGE section for more information.
🔶 USAGE
🔹 Non Repainting
When Repainting Smoothing is disabled the returned indicator acts similarly to a regular causal moving average. This result could be described as an "endpoint Nadaraya-Watson estimator".
Unlike a regular moving average whose degree of smoothness is commonly determined by the length of its calculation window, the degree of smoothness of the proposed indicator is determined by the bandwidth setting, with a higher value returning smoother results.
In the above chart, a bandwidth value of 50 is used. An increasing value of the smoother is indicative of an uptrend, while a decreasing value is indicative of a downtrend.
🔹 Repainting
Non-causal smoothing methods have found low support from technical analysts because they tend to repaint. Yet, they can provide powerful insights such as estimating underlying trends in the price as well as seeing how far prices deviate from them. They can also make drawing certain patterns easier and can help see underlying structures in the price more clearly.
Using higher bandwidth values allows for estimating longer-term trends in the price.
Triangular labels highlight points where the direction of the estimator change. This allows for the identification of tops and bottoms in the underlying trend which can be compared to the actual price tops and bottoms.
Note that multiple labels can appear in real time, highlighting real-time changes in the estimator's direction. The most recent label on a series of labels is the first to appear. This can eventually be useful for the real-time predictive application of the estimator. However, it is not a usage we particularly recommend.
🔶 DETAILS
The Nadaraya-Watson estimator can be described as a series of weighted averages using a specific normalized kernel as a weighting function. For each point of the estimator at time t , the peak of the kernel is located at time t , as such the highest weights are attributed to values neighboring the price located at time t .
A lower bandwidth value would contribute toward a more important weighting of the price at a precise point and would as such less smooth results. In the case where our bandwidth is so small that the resulting kernel is just an impulse, we would get the raw price back.
However, when the bandwidth is sufficiently large, prices would be weighted similarly, thus resulting in a result closer to the price mean.
It can be interesting to note that due to the nature of the estimator and its weighting procedure, real-time results would not deviate drastically for points in the estimator near the center of the calculation window.
🔶 SETTINGS
Bandwidth : controls the bandwidth of the Gaussian kernel, with higher values returning smoother results.
Src : Input source of the kernel regression.
Repainting Smoothing : Determine if the smoothing method should repaint or not. If disabled the "endpoint Nadaraya-Watson estimator" is returned.
Pivot High/Low Analysis & Forecast [LuxAlgo]Returns pivot points high/low alongside the percentage change between one pivot and the previous one (Δ%) and the distance between the same type of pivots in bars (Δt). The trailing mean for each of these metrics is returned on a dashboard on the chart. The indicator also returns an estimate of the future time position of the pivot points.
This indicator by its very nature is not real-time and is meant for descriptive analysis alongside other components of the script. This is normal behavior for scripts detecting pivots as a part of a system and it is important you are aware the pivot labels are not designed to be traded in real-time themselves
🔶 USAGE
The indicator can provide information helping the user to infer the position of future pivot points. This information is directly used in the indicator to provide such forecasting. Note that each metric is calculated relative to the same type of pivot points.
It is also common for analysts to use pivot points for the construction of various figures, getting the percentage change and distance for each pivot point can allow them to eventually filter out points of non-interest.
🔹 Forecast
We use the trailing mean of the distance between respective pivots to estimate the time position of future pivot points, this can be useful to estimate the location of future tops/bottoms. The time position of the forecasted pivot is given by a vertical dashed line on the chart.
We can see a successful application of this method below:
Above we see the forecasted pivots for BTCUSD15. The forecast of interest being the pivot high. We highlight the forecast position with a blue dotted line for reference.
After some time we obtain a new pivot high with a new forecast. However, we can see that the time location of this new pivot high matches perfectly with the prior forecast.
The position in time for the forecast is given by:
x1_ph + E
x1_pl + E
where x1_ph denotes the position in time of the most recent pivot high. x1_pl denotes the position in time of the most recent pivot low and E the average distance between respective pivot points.
🔶 SETTINGS
Length: Window size for the detection of pivot points.
Show Forecasted Pivots: Display forecast of future pivot points.
🔹 Dashboard
Dashboard Location: Location of the dashboard on the chart
Dashboard Size: Size of the dashboard on the chart
Text/Frame Color: Determines the color of the frame grid as well as the text color
Zig Zag Channels [LuxAlgo]The Zig Zag indicator is a useful indicator when it comes to visualizing past underlying trends in the price and can make the process of using drawing tools easier. The indicator consists of a series of lines connecting points where the price deviates more than a specific percentage from a maximum/minimum point ultimately connecting local peaks and troughs.
This indicator by its very nature backpaints by default, meaning that the displayed components are offset in the past.
🔶 USAGE
The Zig Zag indicator is commonly used to returns points of references for the usage of specific drawing tools, such as Fibonacci retracements, fans, squares...etc.
The proposed indicator estimates peaks and troughs by using rolling maximums/minimums with a window size determining their significance. This window size approach allows us to have an indicator that works with a certain regularity no matter the scale of the price, something the percentage-based approach struggles with. Additionally, one upper and lower extremity are displayed, highlighting the price point that deviates the most from the Zig Zag lines.
A common usage also includes the easy determination of Elliot wave patterns in the price.
The Zig Zag indicator above highlights a downtrending motive wave.
🔹 Extremities
The novel approach taken by this Zig Zag indicator is the addition of two extremities derived from the distance between the price and the Zig Zag line, thus returning channels. It is uncommon seeing extremities in Zig Zag indicators since the line connecting peaks and troughs has rarely any other utility than seeing trend variations with more clarity and is not meant to provide an accurate estimate of underlying local trends in the price.
This channel can be useful to study the potential relationship between underlying trends and the Zig Zag line. A low width between the Zig Zag and the upper extremity indicates price variations mostly located below the Zig Zag while equal width indicates more linear trends.
When the indicator is extended to the last line, the extremities provide potential support and resistances, thus making this indicator able to forecast price variations.
🔶 SETTINGS
Length: Determines the significance of the detected peaks and troughs.
Extend To Last Bar: Extend the most recent line to the most recent closing price value.
Show Extremities: Displays the extremities.
Show Labels: Display labels highlighting the high/low prices located at peaks and troughs.
🔹 Style
Upper Extremity Color: Color of the upper extremity displayed by the indicator.
Zig Zag Color: Color of the ZigZag lines.
Lower Extremity Color: Color of the lower extremity displayed by the indicator.
Normalized Oscillators Spider Chart [LuxAlgo]This indicator displays a spider chart overlaid on the user’s current chart allowing the visualization of information given by various normalized oscillators. It is possible to customize the spider chart by hiding certain oscillators from within the settings which removes their corresponding spokes from the chart.
Users can control the length settings of each oscillator individually or use a global length setting that applies to every oscillator. An additional meter element is displayed and aims to give the overall sentiment returned by the oscillators. This can also be used to gauge whether the market is trending or ranging.
This is a relatively simple application of a spider chart but can prove to be useful to some users.
1. Settings
RSI: Displays the Relative Strength Index spoke on the spider chart, includes the length setting on the right of the toggle.
%K: Displays the Stochastic Oscillator "%K" spoke on the spider chart, includes the length setting on the right of the toggle.
COR: Displays the Correlation Oscillator spoke on the spider chart, includes the length setting on the right of the toggle.
MFI: Displays the Money Flow Index oscillator spoke on the spider chart, includes the length setting on the right of the toggle.
WPR: Displays the Williams Percent Rank oscillator spoke on the spider chart, includes the length setting on the right of the toggle.
%UP: Displays the percentage of upward variations spoke on the spider chart, includes the length setting on the right of the toggle.
CMO: Displays the Chande Momentum Oscillator spoke on the spider chart, includes the length setting on the right of the toggle.
AOS: Displays the Aroon oscillator spoke on the spider chart, includes the length setting on the right of the toggle.
Global Oscillators Length: Determines whether all oscillators should use the same length settings, determined by the setting on the right of the toggle.
1.1 Style Settings
Spider Chart Length: Determines the horizontal width of the spider chart.
Spider Chart Offset: Offset between the most recent bar and the left extremity of the spider chart.
2. Usage
A spider chart can be a very useful visualization tool when it comes to seeing the individual characteristics of various variables at the same time.
Here, the tool can give a general sentiment on the direction of the trend without adding each indicator to your chart. It is also possible to determine when an oscillator is considered overbought or oversold with this indicator.
The dashed line represents the central value for each oscillator.
Disabling any of the oscillators from the settings will return a spider chart using fewer spokes.
The script also displays a meter that can be used to determine the overall sentiment given by all oscillators. This metric is based on the average value between each oscillator. An overall sentiment closer to 50 would indicate a ranging market.
PineGIF - Display Gifs & Images In Tradingview [LuxAlgo]Pinescript is not designed to create or display images, let alone gifs, but it's very fun to try, and that's what this script does. This script allows the user to display three different gifs. In this post, we explain how we managed to display images/gif's using pinescript tables.
1. Image Pre-Processing
Due to pinescript limitations, we can't possibly display images with an excessively high resolution. As such we targeted pixel art as a primary image source. We used a pixel art gif of the magnificent Octocat (the mascot for the source-code hosting service GitHub) for our first try.
We first extract each frame from the gif and resize them to a 50x50 resolution which returns frames made of 2500 pixels. This process was done using python.
Getting Individual Pixels RGBA Values
Python can easily return a matrix containing each pixel's rgba value. For convenience, we converted the rgba values to hex.
We then create a simple code allowing us to return a pinescript array containing the 2500 pixel hex colors. We do this process for each frame.
2. Defining Table Cell Color
In the code, each frame is its own array. We create a new table with dimensions equal to len(frame1)^2 (we assume height = width).
The color of a cell is defined by the color of the image pixel at the same exact location. When a new bar is created, we do this exact process using a different frame which ultimately allows a new frame to be displayed.
3. Playing The GIFs
By default, the script will play the gif of the Tradingview cloud logo raining. In order to play the gif, simply use the replay mode. The replay speed allows the user to determine the frame rate (0.1 for the raining cloud and Nyan cat works best, 0.5 for Octocat).
We included the frames of the Octocat and Nyan cat gifs in the script.
4. Some Other Cool Images
Displaying static images is possible and involves the same process described above.
An original idea of the lizard, implemented by the wizard.