Adaptive EnvelopeI bring to your attention a dynamic indicator Adaptive Envelope .
The main qualitative characteristic of the technical indicator is adaptability. This means that it does not need to be adjusted for each tool. The adaptive envelope itself dynamically adjusts to the volatility of each individual instrument, or even timeframe.
And thanks to a wide range of settings, the indicator can be adjusted to your needs. Let's consider an example of the use of the indicator in trading.
Option #1. The envelope shows the "stretch" of the market - that is, the price of the asset beyond normal volatility. And it is at such moments that the probability of returning to the average is highest. That is, for such a signal, we wait for the exit to the moving average, and when returning with a stop order, we enter the averaging direction.
Option #2. Another option for trading is to buy at the lower level, as well as additional purchases along the lines of the envelope. Exit - on the middle line of the envelope (for shorts on the contrary) - so we have a full adaptability of the strategy. I repeat that due to adaptability, there will be no need to reconfigure when changing market characteristics.
Thank you for attention. Sincerely, Oleksandr Yanchak. Capitalizator.UA
Dynamic
Adaptive_LengthLibrary "Adaptive_Length"
This library contains functions to calculate Adaptive dynamic length which can be used in Moving Averages and other indicators.
Two Exponential Moving Averages (EMA) are plotted. Coloring in plot is derived from Chikou filter and Dynamic length of MA1 is adapted using Signal output from Chikou library.
dynamic(para, adapt_Pct, minLength, maxLength) Adaptive dynamic length based on boolean parameter
Parameters:
para : Boolean parameter; if true then length would decrease and would increase if its false
adapt_Pct : Percentage adaption based on parameter
minLength : Minimum allowable length
maxLength : Maximum allowable length
Returns: Adaptive Dynamic Length based on Boolean Parameter
auto_alpha(src, a) Adaptive length based on automatic alpha calculations from source input
Parameters:
src : Price source for alpha calculations
a : Input Alpha value
Returns: Adaptive Length calculated from input price Source and Alpha
TPTR_Dynamic_Ratio_CorrelatorThe script provides a way to compute ratio between two indexes (or stocks) of your choice, and paints a "up-arrow" below the first candle where and when the value of the ratio exceeds your threshold of choice.
It also creates a table summarizing the value of your securities, and the value of the ratio below.
The script will also alert you with a message (automatically) when the ratio of your security_1 and security_2 exceeds the ratio.
Moving Average with Dynamic Color Gradient (WaveTrend Momentum)Similar scripts exist but I haven't seen one using WaveTrend and I haven't seen one that hand picks evenly divided colors between GREEN-YELLOW-RED.
The green is exact green, the yellow is exact yellow, and the red is exact red.
Not complicated, just useful.
Green to Red Gradient for Dynamic / Color Changing IndicatorsI have evenly divided every color between green and red.
This gradient is useful for pine coders who are creating color changing, dynamic, or gradient indicators.
Bollinger bands dynamic alertsThis triple Bollinger script is very useful for options traders to determine the trend condition. When the trend stays within 1 sigma limits it is termed as "congestion", breakout of congestion starts the "trending" phase and the big breakout termed "Blowout" happens when the underlying crosses the 2sigma and reaches 3 sigma limits in very short time at steep trend angles. The script provides dynamic alerts as soon as the underlying breaks out of these zones and enables options traders to stay in the trade longer. www.tradingview.com
Dynamic Moving AveragesThis indicator uses what I call Dynamic Moving Averages to identify trends. The reason these moving averages are dynamic is that they track different sources based on the trend. Allow me to explain...
Low = identifies the least sellers were willing to sell for in a given period.
High = Identifies the most buyers were willing to buy for in a given period.
Avg Low = Shows the least sellers were willing to sell for over several periods.
Avg High = Shows the least buyers were willing to buy for over several periods.
If, in an uptrend, the closing price closes below the Avg Low, a trend change could be coming to the downside. If, in a downtrend, the closing price closes above the Avg high, a trend change could be coming to the upside.
This indicator uses a single moving average to identify the trend. If price is above this MA, we are in an uptrend. Below it, we are in a downtrend. I recommend using that 50 length as your trend. Any moving averages that are Dynamic, will track the low when above the Trend MA and track the High when below the trend MA.
When Price crosses a Dynamic Moving Average, the trend is likely changing. I recommend using 3 MAs at a time (trend + 2 shorter MAs), but I have provided 7 in total.
Papercuts Dynamic EMA - Relative Parameter FunctionThe goal of this is to link two parameters of different known low and high values so one affects the other.
In this case, I want to link Relative Volume to the length of an EMA, so it responds faster in times of high volume.
As an animator I am used to linking values in this way with Maya using a set driven key, took some work to figure it out in pine.
Looking up this concept, it has a few names, Relative values, linear interpolation, or rescale values.
Thanks to pinecoders for writing the EMA funciton that can accept length variables!
Here's a quick look at the root function to link the two values.
f_relativeVal(_source, in_bot, in_top, out_bot, out_top) =>
// float _source: input signal
// float in_bot : minimum range of input signal.
// float in_top : maximum range of input signal.
// float out_bot : minimum range of output signal.
// float out_top : maximum range of output signal.
clampSrc = _source > in_top ? in_top : _source < in_bot ? in_bot : _source //claps source to create a controlled range
//relInput = (clampSrc - in_bot) / (in_top - in_bot) * 100
inDiffIncrement = (in_top - in_bot)
outDiffIncrement = (out_top - out_bot)
out_bot + (clampSrc - in_bot) * outDiffIncrement / inDiffIncrement // rescale input range to output range
Directional Strength Panel█ OVERVIEW
The panel display trend momentum of selected coins/symbol (up to 6) based on the Arnaud Legoux Moving Average (ALMA). I'm using ALMA to measure the trend because it resolves 2 main issue of the more common moving averages, smoothing and responsiveness. By removing the minor fluctuations in price without sacrificing the responsiveness, the trend become much more clearer and easier to be measured.
In essence, as the meter approaches 100, it means the ALMA is pointing up (0 means pointing down)
█ Features
- Adjustable ALMA settings with options to turn on/off display the ALMA on current chart
- Select 6 symbols of your choice to be monitored in the settings (You have to manually update the label to display)
- Working on all timeframes
- Switch the panel color to suit background chart theme (Light/Dark)
█ Developer Notes
I'm working with table a lot lately and decided to publish this as a sample if anyone wishes to edit the script to display whatever they want. main calculation in get_data() function should be clamped to value between 0-100. As for the panel size, you can edit the row_max (currently set to 20 and 40) if you need it to be smaller or bigger (**i feel anything smaller than 16 is ugly)
█ Disclaimer
Past performance is not an indicator of future results.
My opinions and research are my own and do not constitute financial advice in any way whatsoever.
Nothing published by me constitutes an investment recommendation, nor should any data or Content published by me be relied upon for any investment/trading activities.
I strongly recommends that you perform your own independent research and/or speak with a qualified investment professional before making any financial decisions.
Any ideas to further improve this indicator are welcome :)
Alert(), alertcondition() or strategy alerts?Variety of possibilities offered by PineScript, especially thanks to recent additions, created some confusion. Especially one question repeats quite often - which method to use to trigger alerts?
I'm posting this to clarify and give some syntax examples. I'll discuss these 3 methods in chronological order, meaning - in the order they were introduced to PineScript.
ALERTCONDITION() - it is a function call, which can be used only in study-type script. Since years ago, you could create 2 types of a script: strategy and study. First one enables creating a backtest of a strategy. Second was to develop scripts which didn't require backtesting and could trigger alerts. alertcondition() calls in strategy-type scripts were rejected by Pine compiler. On the other hand compiling study-type scripts rejected all strategy...() calls. That created difficulties, because once you had a nice and backtested strategy, you had to rip it off from all strategy...() function calls to convert your script to study-type so you could produce alerts. Maintenance of two versions of each script was necessary and it was painful.
"STRATEGY ALERTS" were introduced because of alertcondition() pains. To create strategy alert, you need to click "Add alert" button inside Strategy Tester (backtester) and only there. Alerts set-up this way are bound with the backtester - whenever backtester triggers an order, which is visible on the chart, alert is also fired. And you can customize alert message using some placeholders like {{strategy.order.contracts}} or {{ticker}}.
ALERT() was added last. This is an alerts-triggering function call, which can be run from strategy-type script. Finally it is doable! You can connect it to any event coded in PineScript and generate any alert message you want, thanks to concatenation of strings and wrapping variables into tostring() function.
Out of these three alertcondition() is obviously archaic and probably will be discontinued. There is a chance this makes strategy/study distinction not making sense anymore, so I wouldn't be surprised if "studies" are deprecated at some point.
But what are the differences between "Strategy alerts" and alert()? "Strategy alerts" seem easier to set-up with just a few clicks and probably easier to understand and verify, because they go in sync with the backtester and on-chart trade markers. It is especially important to understand how they work if you're building strategy based on pending orders (stop and limit) - events in your code might trigger placing pending order, but alert will be triggered only (and when) such order is executed.
But "Strategy Alerts" have some limitations - not every variable you'd like to include in alert message is available from PineScript. And maybe you don't need the alert fired when the trade hit a stop-loss or take-profit, because you have already forwarded info about closing conditions in entry alert to your broker/exchange.
Alert() was added to PineScript to fill all these gaps. Is allows concatenating any alert message you want, with any variable you want inside it and you can attach alert() function at any event in your PineScript code. For example - when placing orders, crossing variables, exiting trades, but not explicitly at pending orders execution.
The Verdict
"Strategy Alerts" might seem a better fit - easier to set-up and verify, flexible and they fire only when a trade really happens, not producing unnecessary mess when each pending order is placed. But these advantages are illusionary, because they don't give you the full-control which is needed when trading with real money. Especially when using pending orders. If an alert is fired when price actually hit a stop-order or limit-order level, and even if you are executing such alert within 1 second thanks to a tool like TradingConnector, you might already be late and you are making entry at a market price. Slippage will play a great role here. You need to send ordering alert when logical conditions are met - then it will be executed at the price you want. Even if you need to cancel all the pending orders which were not executed. Because of that I strongly recommend sticking to ALERT() when building your alerts system.
Below is an example strategy, showing syntax to manage placing the orders and cancelling them. Yes, this is another spin-off from my TradingView Alerts to MT4 MT5 . As usual, please don't pay attention to backtest results, as this is educational script only.
P.S. For the last time - farewell alertcondition(). You served us well.
Dynamic SMAThis script uses dynamic length to create a different sma type.
The length of the "Dynamic SMA" - "dSMA" can be:
'RSI', 'Stoch', 'ATR', 'MFI' or '%R'
For example 'RSI' -> the length of the sSMA will be the RSI itself
The biggest challenge was:
'Pine cannot determine the referencing length of a series. Try using max_bars_back' error
The writer of 'referencing length of a series' issue gave following solution:
bar_index == 0 ? 4999 : len
or in case of values which don't go above 100:
bar_index == 0 ? 100 : len
This assigns the necessary buffer to the function.
I'm most grateful for the given solution!
These dSMA's can give Support/Resistance levels, also crossovers of different dSMA's can give extra information
Examples:
RSI
ATR (close / atr(len)
Stoch
MFI
%R
"show regular SMA" will show the "SMA" with the same length (with default lighter color)
SuperTrend - Custom Screener and Dynamic AlertsTrading View today published a desktop Bad Internet connection indicator ?! which set me thinking…
Despite recently introduced Dynamic Alerts many scripts do not leverage the information available for active traders and traders on the GO!
So decided to share this script totally ALERT focused on one of the most popular DAY trading indicators.
Of course no more BAD internet problem as long your TV APP is configured , you will have enough data for a mental picture of the chart..
The Alerts give you the BAR Close , %percent gain or loss over previous day CLOSE ++ Previous Day High and Low to effectively plan your trade without a chart!(just in case)
2 additions in the way Alerts are delivered over the last script :
1. You get SUMMARY alerts or concatenated alerts by default , however if you uncomment or activate code lines 48 and 55 you will get individual Stock alerts Too!
2. Summary Alerts will come only if there is some Buy or Sell signal NO more empty Alerts!
Few useful EXTRAS in the code :
1. Flexible code can convert any indicator to screener or Alert function.
2. You will NOT get Mutable Variable error while converting any indicator to screener as long as the function is in "GLOBAL" scope..
3. Many Custom Screeners are available but few give OHLC data in output so easily…and very difficult for traders to MODIFY hundreds of lines of code..
4. For UP or DOWN on SCREEN Stock monitoring copy /paste functions in line 41 and 42 in lieu of CROSS functions in 44 and 51 respectively..
5. You can also uncomment/activate lines 66 and 67 for labels in monitoring.
6. The default mode of the scripts is set to Alerts!
Max Stocks only 20!
Finally idea is to help traders to use the great features that TV works so hard to create and constantly improvise.
Enjoy Profitable Trading on the Fly !!
Dynamic Momentum Oscillator (DYNAMO) by M.YALCINIn July 1996 Futures magazine, E. Marshall Wall introduces the Dynamic Momentum Oscillator (Dynamo). Please refer to this article for interpretation.
The Dynamo oscillator is a normalizing function that adjusts the values of a standard oscillator for trendiness by taking the difference between the value of the oscillator and a moving average of the oscillator and then subtracting that value from the oscillator midpoint.
Dynamo Oscillator is calculated according to:
Dynamo = Mc - ( MAo - O )
where:
Mc = the midpoint of the oscillator
MAo = a moving average of the oscillator
O = the oscillator
Usage:
This concept can be applied to most oscillators to improve their results.
This example applies it to an RSI oscillator in MetaStock:
50-(Mov(RSI(14),21,S)-RSI(14))
where:
Mc = RSI's midpoint = 50
MAo = Moving average of the RSI = Mov(RSI(14),21,S
O= RSI Oscillator = RSI(14)
Also with this indicator, you can adjust the moving average type and RSI calculation types dynamically.
Dynamic EnvelopeA dynamic envelope is designed to build an actual envelope that consider the volatility of a trading instrument.
A dynamic envelope is an ideal counter-trend indicator, it takes into account the nature of the movement of the instrument. At the same time, it does not require adjustment of parameters over time, it adjusts itself to volatility.
The indicator can be effectively used on any markets and instruments.
Динамический конверт предназначен для построения актуального конверта, который учитывает волатильность торгового инструмента.
Динамический конверт - это идеальный контртрендовый индикатор, он учитывает характер движения инструмента. При этом он не требует подгонки параметров со временем, он сам подстраивается под волатильность.
Индикатор можно эффективно использовать на любых рынках и инструментах.
WMA DynamicDemonstration of a new feature that allows to change lookback period dynamically, used with WMAs. Rather than WMA any one can be used here (SMA, Alma,...) as long as its second argument supports dynamic change. If not, you have to use your own implementation of MA.
Adaptive MomentumAdaptive momentum indicator that uses the NEW Dynamic Length Arguments! Shows how to use volatility to shorten or lengthen the momentum period.
Based on pinescript blog example but with my own modifications.
Bright Green: Sharp movement above zero line
Bright Red: Sharp movement below zero line
Light Green: Slower movement above zero line
Light Red: Slower movement below zero line.
Yellow: Reversal might occur (near the zero line either side).
Thumb rule: Below zero line - SELL. Above zero line - BUY
McGinley Dynamic (Improved) - John R. McGinley, Jr.For all the McGinley enthusiasts out there, this is my improved version of the "McGinley Dynamic", originally formulated and publicized in 1990 by John R. McGinley, Jr. Prior to this release, I recently had an encounter with a member request regarding the reliability and stability of the general algorithm. Years ago, I attempted to discover the root of it's inconsistency, but success was not possible until now. Being no stranger to a good old fashioned computational crisis, I revisited it with considerable contemplation.
I discovered a lack of constraints in the formulation that either caused the algorithm to implode to near zero and zero OR it could explosively enlarge to near infinite values during unusual price action volatility conditions, occurring on different time frames. A numeric E-notation in a moving average doesn't mean a stock just shot up in excess of a few quintillion in value from just "10ish" moments ago. Anyone experienced with the usual McGinley Dynamic, has probably encountered this with dynamically dramatic surprises in their chart, destroying it's usability.
Well, I believe I have found an answer to this dilemma of 'susceptibility to miscalculation', to provide what is most likely McGinley's whole hearted intention. It required upgrading the formulation with two constraints applied to it using min/max() functions. Let me explain why below.
When using base numbers with an exponent to the power of four, some miniature numbers smaller than one can numerically collapse to near 0 values, or even 0.0 itself. A denominator of zero will always give any computational device a horribly bad day, not to mention the developer. Let this be an EASY lesson in computational division, I often entertainingly express to others. You have heard the terminology "$#|T happens!🙂" right? In the programming realm, "AnyNumber/0.0 CAN happen!🤪" too, and it happens "A LOT" unexpectedly, even when it's highly improbable. On the other hand, numbers a bit larger than 2 with the power of four can tremendously expand rapidly to the numeric limits of 64-bit processing, generating ginormous spikes on a chart.
The ephemeral presence of one OR both of those potentials now has a combined satisfactory remedy, AND you as TV members now have it, endowed with the ever evolving "Power of Pine". Oh yeah, this one plots from bar_index==0 too. It also has experimental settings tweaks to play with, that may reveal untapped potential of this formulation. This function now has gain of function capabilities, NOT to be confused with viral gain of function enhancements from reckless BSL-4 leaking laboratories that need to be eternally abolished from this planet. Although, I do have hopes this imd() function has the potential to go viral. I believe this improved function may have utility in the future by developers of the TradingView community. You have the source, and use it wisely...
I included an generic ema() plot for a basic comparison, ultimately unveiling some of this algorithm's unique characteristics differing on a variety of time frames. Also another unconstrained function is included to display some the disparities of having no limitations on a divisor in the calculation. I strongly advise against the use of umd() in any published script. There is simply just no reason to even ponder using it. I also included notes in the script to warn against this. It's funny now, but some folks don't always read/understand my advisories... You have been warned!
NOTICE: You have absolute freedom to use this source code any way you see fit within your new Pine projects, and that includes TV themselves. You don't have to ask for my permission to reuse this improved function in your published scripts, simply because I have better things to do than answer requests for the reuse of this simplistic imd() function. Sufficient accreditation regarding this script and compliance with "TV's House Rules" regarding code reuse, is as easy as copying the entire function as is. Fair enough? Good! I have a backlog of "computational crises" to contend with, including another one during the writing of this elaborate description.
When available time provides itself, I will consider your inquiries, thoughts, and concepts presented below in the comments section, should you have any questions or comments regarding this indicator. When my indicators achieve more prevalent use by TV members, I may implement more ideas when they present themselves as worthy additions. Have a profitable future everyone!
Dynamic Range here comes open source version of notorious JFT Indicator ( the indicator access you can get in some bucks ) on various telegram channels however they will not give code.
Now how it works
1. 2 ranges derived from indicator are supposed to be a consolidation zone and any close above or below is supposed to give a good move.
2. I personally consider it as may be addition to price analysis. ( i don't believe much in indicators,even simple MA gives fruitful results when there is good move in market )
3. Range can be drawn on chart with various resolution ( Daily/Monthly/Weekly )
PS: I coded myself based on data analysis shown by access only indicator. In case you use it for your publication don't forget to give credits.
Thanks,
daytraderph
Dynamic Money Flow with color switch [aamonkey]"Dynamic Money Flow is a volume indicator based on Marc Chaikin's Money Flow with a few improvements.
It can be used to confirm break-outs and trends." (RezzaHmt)
This is the script from RezzaHmt called "Dynamic Money Flow".
All I did is the color change of the line because I find it easier to read that way.
Here you can find the original script explaining the theory behind this indicator:
Automatic Fibonacci Pivot Point S/R LevelsThis is a great tool to find confluences between Fibonacci Pivot point on various time frames.
Fib Pivots used
23.6%
38.2%
50%
61.8%
76.4%
100%
127.2%
141.4%
161.8%
200%
If price is between two levels on the update the lines shift
Yearly Pivots shown on 1m - Daily timeframes
PIvots recalculate on every day
Monthly pivots show on 1m - 60m timeframes
Pivots recalculate every hour
Weekly pivots show on 1m - 15m timeframes
Pivots recalculate every 30m
There is a lot of code but it got the job done.
It would easy to interchange if you prefer different types of pivots
It would be easy to add an on/off if you dont want so many levels on your smaller time frames
If anyone can streamline it please do
Combo Backtest 123 Reversal & Dynamic Pivot Point This is combo strategies for get a cumulative signal.
First strategy
This System was created from the Book "How I Tripled My Money In The
Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies.
The strategy buys at market, if close price is higher than the previous close
during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50.
The strategy sells at market, if close price is lower than the previous close price
during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
Second strategy
This Pivot points is calculated on the current day.
Pivot points simply took the high, low, and closing price from the previous period and
divided by 3 to find the pivot. From this pivot, traders would then base their
calculations for three support, and three resistance levels. The calculation for the most
basic flavor of pivot points, known as ‘floor-trader pivots’, along with their support and
resistance levels.
WARNING:
- For purpose educate only
- This script to change bars colors.
Combo Strategy 123 Reversal & Dynamic Pivot Point This is combo strategies for get a cumulative signal.
First strategy
This System was created from the Book "How I Tripled My Money In The
Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies.
The strategy buys at market, if close price is higher than the previous close
during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50.
The strategy sells at market, if close price is lower than the previous close price
during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
Second strategy
This Pivot points is calculated on the current day.
Pivot points simply took the high, low, and closing price from the previous period and
divided by 3 to find the pivot. From this pivot, traders would then base their
calculations for three support, and three resistance levels. The calculation for the most
basic flavor of pivot points, known as ‘floor-trader pivots’, along with their support and
resistance levels.
WARNING:
- For purpose educate only
- This script to change bars colors.
Combo Backtest 123 Reversal & Dynamic Momentum Index This is combo strategies for get a cumulative signal.
First strategy
This System was created from the Book "How I Tripled My Money In The
Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies.
The strategy buys at market, if close price is higher than the previous close
during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50.
The strategy sells at market, if close price is lower than the previous close price
during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
Second strategy
This indicator plots Dynamic Momentum Index indicator. The Dynamic Momentum
Index (DMI) was developed by Tushar Chande and Stanley Kroll. The indicator
is covered in detail in their book The New Technical Trader.
The DMI is identical to Welles Wilder`s Relative Strength Index except the
number of periods is variable rather than fixed. The variability of the time
periods used in the DMI is controlled by the recent volatility of prices.
The more volatile the prices, the more sensitive the DMI is to price changes.
In other words, the DMI will use more time periods during quiet markets, and
less during active markets. The maximum time periods the DMI can reach is 30
and the minimum is 3. This calculation method is similar to the Variable
Moving Average, also developed by Tushar Chande.
The advantage of using a variable length time period when calculating the RSI
is that it overcomes the negative effects of smoothing, which often obscure short-term moves.
The volatility index used in controlling the time periods in the DMI is based
on a calculation using a five period standard deviation and a ten period average
of the standard deviation.
WARNING:
- For purpose educate only
- This script to change bars colors.