Neapolitan BandsThe Neapolitan Bands were derived from Jean Marc Guillot's 2001 IFTA trading strategy. In his study published by the International Federation of Technical Analysis titled, "Using Indicators from the Derivatives Markets to Forecast FX Moves" Guillot utilizes multiple bollinger bands of various deviations to determine trends and reversals, entries and exits. I isolated this particular part of his overall trading strategy because it has been a useful trend following indicator for me.
Some basics:
Neapolitan Bands can help identify points that a trend starts and ends, as well as reversals when price is ranging.
These bands are typically paired with another indicator like Guillot did to help separate/time trend or reversal signals. (He used MACD, Slow Stochastic, and RSI)
Parts of this indicator:
The period is by default 55 to identify "intermediate" trends. Not short or long term ones.
The blue area shows the 1st standard deviation. This is the "normal range" where price "likes" to be.
The green area shows the 2nd standard deviation and identifies/defines trends. Closes in this area are used for entering trends long or short.
The red area shows the 3rd standard deviation that shows either a spot to take profit/enter a reversal trade, or a point where the market is free falling.
Trend trading rules:
Entry and exit signals for trends are based on price closing above and below the 1st standard deviation, or blue area. If you expect a bullish trend, you buy once price enters the upper green area.
Guillot recommends setting a stop loss to the MA period of the Neapolitan Bands. So if it's 55 periods, you set the stop loss at the 55 SMA.
Reversal trading rules:
For reversals Guillot says, "In a trading range, bands act as supports and resistances. In extreme conditions reversals can occur within or past the 2nd standard deviation." For us, this means that technically anywhere in the green or red areas, a reversal can occur when the price is ranging. Typically this happens at the edges of the bands.
The "edge to edge" trade:
This is a strategy I took from Ichimoku Clouds and applied to the Neapolitan Bands. An "edge to edge" trade is when price closes back into the blue area from one edge, and price travels all the way to the other edge of the blue area. This can apply going from the edge of one green area to the other edge.
Note that this is one piece of Guillot's trading system, and not the whole thing. On top of that I have modified the original parameters to suit the function of trend following, and added an extra bollinger band. Using a shorter period like 20 is more optimal for shorter expected trends or reversals, and it's what Guillot used himself.
Thanks to Sean Nance for reminding me the indicator looks like ice cream! ( coming up with the name :P )
Trend
MrBS:Directional Movement Index [Trend Friend]I started this project with the goal of making a DMI/ADX that was easy to read at a glance. Its since become a little more then just colouring the slopes. The majority of the time, the best returns come from trending markets (THE TREND IS YOUR FRIEND... until the end) and I hope this helps people become good friends with the trends.
----- Features
- A function to change the values used for calculation from real OHLC and Heikin Ashi. This allows us to look at different chart types but see the specific ADX we choose. Originally HA values were used for calculation since it is easier to see trend on HA charts. However when testing it was not as effective as the ADX calculated from the real values on normal charts. So the default function was flipped and real OHLC values are used as default.
- Two ADX plots so we can see two different smoothness's. With a smoothing of 2, a slight slow down in PA can cause a negative slope but the smoother ADX will stay trending unless its a major change. 2nd ADX is slightly transparent.
- There is an EMA of the main ADX that can be used as a exit signal filter. If the ADX starts going down but has not crossed the EMA we would stay in a trade.
- Plots (excluding EMA) are coloured based on positive or negative slopes.
- Fibonacci numbers have been used to create different trend levels, instead of the standard 25, 50, 100.
- Alerts for every useful situation to help save time and not have to manually enter levels or crosses each time.
- In the code there are 8 EMAs and 3 ADXs but it was too much so they have been slashed out, but are fully functional if you choose to activate and use them. To reactivate the 3rd ADX delete slashes on lines 50, 65, 78, 92-95, 165. The slashed out EMAs are much more obvious and easy to reactivate.
Colours:
ADX going up = Green
ADX going down = Red
DMI+ going up = Bright Aqua
DMI+ going down = Turquoise / Dark Aqua
DMI- going up = Bright Purple
DMI- going down = Dark Purple
EMA = White (50% transparent)
If there is anything that would be useful, let me know and I will add it in. I've already got some improvements/changes planned and some of my notes can be found in the code.
There is also a strategy to go with this indicator that will be uploaded very soon.
Pyramiding Entries On Early Trends (by Coinrule)Pyramiding the entries in a trading strategy may be risky but at the same time very profitable with a proper risk management approach. This strategy seeks to spot early signs of uptrends and increase the position's size while the right conditions persist.
Each trade comes with its stop-loss and take-profit to enforce a proportional risk/reward profile.
The strategy uses a mix of Moving Average based setups to define the buy-signal.
The Moving Average (200) is above the Moving Average (100), which prevents from buying when the uptrend is already in its late stages
The Moving Average (9) is above the Moving Average (100), indicating that the coin is not in a downtrend.
The price crossing above the Moving Average (9) confirms the potential upside used to fire the buy order.
Each entry comes with a stop-loss and a take-profit in a ratio of 1-to-1. After over 400 backtests, we opted for a 3% TP and 3% SL, which provides the best results.
The strategy is optimized on a 1-hour time frame.
The Advantages of this strategy are:
It offers the possibility of adjusting the size of the position proportionally to the confidence in the possibilities that an uptrend will eventually form.
Low drawdowns. On average, the percentage of trades in profit is above 60%, and the stop-loss equal to the take-profit reduces the overall risk.
This strategy returned good returns both with trading pairs with Fiat/stable coins and with BTC. Considering the mixed trends that cryptocurrencies experienced during 2020 vs BTC, this strengthens the strategy's reliability.
The strategy assumes each order to trade 20% of the available capital and pyramids the entries up to 7 times.
A trading fee of 0.1% is taken into account. The fee is aligned to the base fee applied on Binance, which is the largest cryptocurrency exchange.
OCC Trend Combo 1 day BTC MoonflagRuns on BTC 1 DAY (NOTE USE THIS NOT THE PREVIOUS VERSION - DEFAULTS TUNED TO 1 day BTC HERE)
USE DEFAULT SETTINGS
The strategy is to maximise the profit for OCC longs (ALMA algo)
Longs start when the price action settles around the ALMA OCC, then typically breaks up
Then follow the trend indcator (blue/orange)
Shorts normally happen when the price action crosses below the ALMA OCC, although these initiate faster than the 1 day time setting - so watchout for shorts - are harder to predict than longs
So this catches most of the big move longs at their initiation
trend Screener List1This is type of custom screener I searched and made to screen bulk stocks any one can modify it, other may get help out of it.
in my code i have made defined
1. uptrend= ema(close,55)> ema(close,144) and ema(close,144)> ema(close,388) and ema(close,388)> ema(close,576) and close>ema(close,388)
2. downtrend = ema(close,55)< ema(close,144) and ema(close,144)< ema(close,388) and ema(close,388)<ema(close,576) and close<ema(close,388)
if the indicator is printing DOWNTREND=TRUE or UPTREND=TRUE then the corresponding stock is in currently in that trend out of the stocks listed in the code
in one code only 40 (max) stocks can be called.
to add more stocks I copied same code and changed the stocks in the code, now you can screen 80 stocks at a time.
This code runs on each bar and checks if the stocks is in uptrend or down trend.
you can customize this screener according to your requirement.
//thanks @QuantNomad from where i solved my problem of screening my top stock for custom trend screener
//idea and motivation taken from
after adding another code you can screen 80 stocks at a time and so on , below following link is how it will look like
MAST TrendHello Traders !!
This is a simple super trend based MAST trend.
By default the supertrend is 10 period with 3 ATR multiplier.
A moving average is used to benefit from the pullback entries.
Bullish Pullback : Price above Supertrend & below MA
Bullish: Price above Supertrend and above MA
Bearish pullback : Price below Supertrend & above MA
Bearish : Price below Supertrend & below MA
Refer to investopedia or any relevant articles for in detail about Supertrend.
G-Oscillator Strength v.1Hello this is my new indicator. Purpose of this indicator is to find the strength of the trend.
This indicator was developed by RSI(14) and Stochastic(50)
How to used
Red = RSI(14) & Sto(50) < 40
Lightblue = RSI(14) >= 50 and Sto(40) < 50
Darkblue = RSI(14) & Sto(40) >= 50
Green = Sto(40) >= 80
Yellow = RSI(14) < 50 and Sto(40) >= 50
Buy&Sell
Buy signal for this indicator is Lightblue to Darkblue
Sell signal is Green to Darkblue or Darkblue to Yellow
Excellent ADXThe Average Directional movement indeX (ADX) is an indicator that helps you determine the trend direction, pivot points, and much more else! But it looks not so easy as other famous indicators. It seems strange or even terrible, but don't be afraid. Let's understand how it works and get its power into your analysis tactics.
In the beginning, imagine a drunk man goes through a ladder: step by step. Up, up, down, up, down, down, up...
How can we understand which direction he goes? Exactly! We can count the number of steps in each direction. In the above example, in the upward – 4, in the downward – 3. So, it looks like he goes in an upward direction.
The ADX indicator counts the same steps, but for price. The size of each step equals 1 ATR for "DI Length" candles. On the indicator chart, we have the green and red lines. The green line represents a number of steps upward. The red line shows one downward. When the red line upper green, then the price goes below, then the trend is directed down. Later the green line comes above the red one, and then the trend changes the direction to upward. Wow? After that, you can easy detect the trend direction on the market!
But it is still not the end. On the chart, we also have the fat blue line. This is the ADX line, and it represents the power of the trend. It is calculated from a distance between the green and red curves. The ADX line value grows if the distance is increased. If the movement is really powerful, then a number of steps into a direction much more prominent than one in an opposed direction. Then the blue line grows faster. But if the growth has stopped and the blue line turns back or already had changed self-direction, then it is a signal that the trend has ended too. It's an excellent sign to close the position (but not always). Easy? Not quite. Thresholds help you there. The indicator has two additional parameters: upper and lower thresholds to evaluate the trend-over signal strength. An u-turn of the ADX line above the upper threshold sends a strong signal. If one occurs between both thresholds, it is a bit weak signal. But if the blue line goes below the lower threshold, it looks like there is no trend, and the price goes side. We can also say that the price goes side when the ADX value gradually falls down.
The Excellent ADX indicator helps you catch pivot/pullback signals based on green, red, and blue lines. Each such signal is highlighted as a green (buy) or red (sell) dot on the plot. The size of the dot represents the strength of the signal. You can also check the position of green and red lines from each other to determine the trend direction and the place where it has been changed. The Excellent ADX indicator helps you there too. It highlights the trend direction by the background-color, so you'll never miss it! The Excellent ADX good compliance with the Price Channel indicator built for the same length. You can use them together to be on a trend wave always!
Trend Thrust Indicator - RafkaThis indicator defines the impact of volume on the volume-weighted moving average, emphasizing trends with greater volume.
What determines a security’s value? Price is the agreement to exchange despite the possible disagreement in value. Price is the conviction, emotion, and volition of investors. It is not a constant but is influenced by information, opinions, and emotions over time. Volume represents this degree of conviction and is the embodiment of information and opinions flowing through investor channels. It is the asymmetry between the volume being forced through supply (offers) and demand (bids) that facilitates price change. Quantifying the extent of asymmetry between price trends and the corresponding volume flows is a primary objective of volume analysis. Volume analysis research reveals that volume often leads price but may also be used to confirm the present price trend.
Trend thrust indicator
The trend thrust indicator (TTI), an enhanced version of the volume-weighted moving average convergence/divergence (VW-Macd) indicator, was introduced in Buff Pelz Dormeier's book 'Investing With Volume Analysis'. The TTI uses a volume multiplier in unique ways to exaggerate the impact of volume on volume-weighted moving averages. Like the VW-Macd, the TTI uses volume-weighted moving averages as opposed to exponential moving averages. Volume-weighted averages weigh closing prices proportionally to the volume traded during each time period, so the TTI gives greater emphasis to those price trends with greater volume and less emphasis to time periods with lighter volume. In the February 2001 issue of Stocks & Commodities, I showed that volume-weighted moving averages (Buff averages, or Vwmas) improve responsiveness while increasing reliability of simple moving averages.
Like the Macd and VW-Macd, the TTI calculates a spread by subtracting the short (fast) average from the long (slow) average. This spread combined with a volume multiplier creates the Buff spread
TREND SNIPER (Final Version)/ This script calculates the daily resistance and support levels. The entry is when the close breaks these levels.
// Then it sets 4 exit lines, if the backtraces these lines you've got your normal exit.
// If the close crosses the TP you've got your TP exit. And if the close crosses the SL you've got your SL exit.
// This is the good part --> If the close crosses the first line the SL get's raised to the entry level.
// This way you cut down on the SL losses and turn a lot of SL trades into (almost) break even trades.
// You can adjust the resistance and support levels to remove the 'little wick entries', this raises the profitability.
// You can also choose the security resolution. I recommend using a higher timeframe than the chart resolution.
// The exit source is also changeable. The HLC3 works best for me, but you can try others if you want.
I could really use some feedback. I want the resistance and support levels to remain on the same position when in trade. But it sometimes changes mid trade.
If you know how to fix this I will be forever grateful. If you have any feedback don't hesitate to give it to me straight. Thanks in advance and have a wonderful day :)
G TREND GUNBOTG TREND indicator follows trends based on higher open or close based on trend direction
Simple Bollinger Band and stochastic oscillator strategy for SPXThis is a very simple Bollinger Band strategy with stochastic oscillator added. Main trend is determined by Band breakout while (5,3,3) stochastic crosses is used for additional entries. Alert function is configured as "one alert for any events", so that free users can set up and get alert for every events in the script. The following code segment can be manipulated as your needs, by removing or keeping "//" comment slashes etc. Entries should be above/below the signal bars and 7-8 points should be regarded as first target, trail the left. Good luck !
signal = bbupcross or bbdowncross //or add_long or add_short
Linear Regression Slope HistogramThis is the slope of linear regression plotted as a histogram. It has a threshold for the slope in case there is a minimum slope amount that the user wants for it to show green or red. The color shows a dim and bright effect depending on the direction of the slope to better show its rise and fall. You can set the length of the slope in the input setting screen.
Some interesting things about linear regression slope that I found out: It kind of looks like the histogram of ADX or the directional movement lines depending on the length used for the slope. According to Tushar Chande, linear regression can be used as an alternative of finding trend direction, although it is hard to say what length to use for it, I haven't been able to figure out a good way to apply it yet. According to Bulkowski, linear regression of the volume can be used with certain chart patterns that he listed to increase their chance of success by taking trades where the linear regression line points towards, so if you use volume as a source on this indicator you can take trades in whatever said direction. Got any other ideas on how to use linear regression? Feel free to let me knows, would gladly appreciate it.
Dominance Monitoralways a trader must check the bitcoins Dominance and if its ok can make a deal on AltCoins
this indicator Monitor the BTC.D and check the trend with ATR and give you results
please just check it in 1D timeframe
when the color was white you can easily trade and if the color was red you should be aware the risk and rest or maybe close the deals
BINANCE:EOSUSDT
be our guest
Step RiderRelease Note:
Idea of this script is to ride on the trend. Multiple dynamic support and resistance are identified and those levels are used
Step Lines:
There are 3 different periods by default are used to define 3 different step lines. On any trend, either of these 3 steps shall play major role
Color Strength:
Change in Red & Green color and its thickness changed based on how strong the up or down trend is.
Disclaimer:
//Disclaimer: Idea of publishing this script is to identify the strength of the instrument using multiple confirmation.
//Disclaimer: Using this indicator, changing inputs, and trading decisions are up to the users/traders.
//Courtesy: Thanks to Richard Donchian, Alan Hull as this indicator/script inspired by Donchian Channels, Hull Moving Average
Close Counter HistogramAn interesting experiment to make an indicator act as a counter. I call it CCH - Close Counter Histogram.
It adds 1 when current close is higher than previous close and reduces -1 when current close is lower than previous close.
In the CCH settings you set how many bars to look back and use EMA to smooth the results or disable EMA smoothing.
Disable the EMA smoothing and you'll see the real deal (pure counter).
The higher the GREEN columns the more higher closes and the lower the RED columns the more lower closes.
In case columns are declining above 0 a more darker green will appear.
In case columns are declining below 0 a more darker red will appear.
Supports bar coloring (disabled by default).
Feel free to comment and Like if you like.
Enjoy :)
SuperTrend MTF [Anan]Hello friends,
As per many experts, supertrend indicator is best to use in combination with other indicators like MACD and RSI.
The best thing about supertrend it sends out accurate signals on precise time. The indicator offers quickest technical analysis to enable the intraday traders to make faster decisions. It is extremely simple to use and understand.
However, the indicator is not appropriate for all the situations. It works when the market is trending. Hence it is best to use for short-term technical analysis. Supertrend uses only the two parameters of ATR and multiplier which are not sufficient under certain conditions to predict the accurate direction of the market.
Understanding and identifying Bull and Bear signals in supertrend is the main crux for the intraday traders. Both the downtrends as well uptrends are represented by the indicator. The flipping of the indicator over the closing price indicates signal. A Bull signal is indicated in green color whereas Bear signal is given as the indicator turns red.
Options:
- Change calculation source ( default SuperTrend uses: hl2)
- Change calculation method (default SuperTrend uses: RMA)
- Additional six multi-time frames SuperTrends
Catch the Big FishVolume based script to catch a big move. Works best on 5 min timeframe.
The default sma duration for volume is set to 150 = number of candles in 5 mins timeframe for 2 days.
Heavy volume is defined as = more than 9 times of sma.
Both parameters are configurable.
Trading strategy: Long buy at high / Short sell at low of the candle where the script gives the signal.
Important note regarding SL - for Long / Short positions respectively, the SL should be placed at low / high of previous candle, and NOT of the same candle.
SuperTREX strategyThis is the strategy of Super Trex that i put as open source before
i just add option for non security MTF and take profit steps as i shown before
for different coins or assets you need to set different parameters
Advancing Declining OscillatorYet another Array indicator, simple, but efficient which i call ADO. The indicator acts as a COUNTER of when CLOSE closes above OPEN and vice versa based on specified look back period in settings.
If we have more Closes above Opens, obviously the indicator will be above ZERO and GREEN, otherwise RED.
Optional to smooth it by EMA (true by default).
Like if you Like and Enjoy!
GAURs Polynomial Regression ChannelsThanks to The Sweet Lord , here is the Gaur's Polynomial Regression Channel.
Its a Polynomial Regression Channel but applied a little differently. Wont go into technical details much. Overview of options is as follows-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Channel Options
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1. Degree of Polynomial: 1/2/3
Default = 3
Defines the degree of polynomials - 1,2,3. Note here, degree 1 will not be a straight line since its applied differently.
Try different degrees for different fits and market conditions.
2. Channel Length:
Default 30 (candles)
You can go beyond 100 or 200 candle lengths but smaller is the usual preference of Poly-Reg-channel traders. It all depends on market conditions and your style of trading. Do your research. I am usually comfortable with a range of 20-50 (in crypto markets).
3. Basis of Channel height/boundries: ATR/Manual
Default: ATR
ATR provides a dynamically adjusted entry/exit bounds of the channels. As ATR changes, the channel bounds also changes its height. It can also be fixed manually. Manual heights wont change automatically.
4. Basis of Y-Value: open/close/ sma / ema / wma /hilow
Default: close
Y- value is the y value of the (x,y) coordinates used while calculating the regression coefficients. Dont worry about it, its nothing serious.
5. Apply channel smoothning using sma?: Yes/No
Default: Yes
Without smoothning, the channel does not "look" good.
6. Shaded Area Height Percentage:
Its the extra margin for the channel. Its in percentage of the total height (defined 3 above) of channels. The shaded area provides an extra allowance for your entries or exits beyond the ATR or manual heights.
7. Plot RSI?: Yes/No
Default: Yes
Plots RSI (orange line in between the channel - its different from the dotted center line) considering the downbound of channels as 0 (oversold) and upbound of channels as 100 (overbought)
8. Plot 200 sma?: Yes/No
Default: Yes
It plots a 200 period fast (green) and 225 period slow (red) sma . I usually use two MAs. Its visually very easy to understand.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Sample Strategy
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
You can develop your own strategy with the channels. But following is just one of the ways you can trade.
Best Application: Ranging markets. But can be happily used in volatile conditions, with a little experience.
1. SMA: -- (this condition is optional really)
If green (200) is above red (225) go only long. If red is above green go only short. Defines long term trend of the market.
2. Channel slope: -- (this stuff needs practice/experience)
Depending on the channel slope, like if its tending to go up or down, you can choose to take only short or long trades. It defines short term momentum of the market.
3. ATR based heights:
Since its ATR based, the channel height are our natural entry and exit points.
Long:
When price touches lower shaded area, consider possible long entry. Exit on price entering the upper shaded area.
Short:
Enter on upper bound shaded area, exit on lower.
4. RSI:
For additional conformations. Again note, the RSI considers the lower bound of channel as 0 and upper as 100. But since, the channel moves up and down, the RSI will also move not only as RSI but also with the channel. Meaning, say if the RSI is valued at 50, then it will be near the center of the channel but since the center changes as time and price changes, the RSI valued at 50 at different times will not be at the same horizontal level respect to the graph, although it will be at the same level (center) respect to the channel.
5. PRC Channel Percentage label:
This label is at the lower side a bit ahead of the current candle. Provides you info on what is the channel percentage. This is especially helpful in crypto markets to gauge your possible percentage profit where profits can be much higher than forex or other instruments. It can also helps you select a suitable market/instrument if the channels are based on ATR.
6. Extra indicators:
I usually use stochastic along with this setup for extra conformations.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Donate
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Use freely and donate generously if you find value. Your help will really help.
I had earlier provided BTC addresses for donations but it seems to violate TV House rules.
Hope they make TV coins redeemable in future.
- Pranav Joshi
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Extra Info
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// © cpranavjoshi
// special thanks to the "Trading View" people for providing this great platform for free
// ------------------------
// MATH
// ------------------------
// special thanks to an article on the web that provided layman friendly explanation of the maths
// unfortunately i wont be able to provide the link to that article owing to TV restrictions, though i sincerely would have liked to credit the author.
// Google search this phrase, and you should be able to get it in one of the first results - "polynomialregression Mathematics of Polynomial Regression"
// my regression math calculation is a further resolution upon the generalized matrix formula given in the that article.
// the generalized matrix looks scary but in fact its much simpler than one may assume
// the summation sign things are just float numbers that can be easily found out
// so we get a matrix with number of equations equal to the number of unknowns.
// e.g. if its a 3rd degree poly, it has 4 unknowns (c0,c1,c2,c3) with 4 equations as in the generalized matrix
// it can be resolved by simple algebra
// Note: the results have been verified with excel using same input data points.
// pine was difficult for me so i coded it in python first to verify
// ------------------------
// WHY
// ------------------------
// this script was coded because Pranav badly needed Polynomial channels (had used them in mt4 earlier)
// and at the time of this coding, i could not find any readily available script in the trading view public library ( tnx public)
// the complex math was probably the hurdle
// i m not good in maths, but by the Will of the Lord, i could resolve the issue with simple algebra and logic
// ------------------------
// PINE
// ------------------------
// i am just an average (even poor probably) programmer and pine script is not my language
// this is a humble attempt to write my first pine with whatever i could do quickly
// experts - feel free to develop if needed. have used some workarounds in drawings/plottings. rectify them if possible
//
//
// - Pranav Joshi
Wilder's Volatility Trailing Stop Strategy with various MA'sFor Educational Purposes. Results can differ on different markets and can fail at any time. Profit is not guaranteed.
This only works in a few markets and in certain situations. Changing the settings can give better or worse results for other markets. This strategy is based on Wilder's Volatility System. It is an ATR trailing stop that is used for long term trends. This strategy focuses on the trailing stop alone and goes long and short only when it goes above or below the trailing line. It is similar to Donchian channels except it does not include the certain period channel breakout, only the trailing signal. This is only the trailing stop and an attempt to show how well it works standalone as Wilder described.
In his book, Wilder recommends a multiplier of 2.8-3.1 and an ATR lookback of 7 periods along with a running moving average or otherwise known as Wilder's moving average. The calculation and programming part for the trailing stop varies everywhere. I opted to keep it as simple and accurate as I could think of and interpret from the book. The variations to these types of indicators are numerous unfortunately, but Wilder seems to be the original author of ATR and this ATR-based trailing stop. In his book he says to use the significant closing price or highest/lowest closing price for the calculation part but I also included the option of choosing the highest high and lowest low, and the option to choose various moving averages in case anyone wants to experiment.
Comparing this and Donchian channels, it seems that a 2.5 multiplier is somewhat similar to the middle band of DCs and a 3.0 multiplier is somewhat similar to a double length middle band of DCs. It's hard to say which is the better trailing stop for a long term strategy. It's hard to beat the simplicity of DCs but maybe some might find a need for more inputs in a trailing stop or maybe an ATR based one like Wilder's can work better depending on what setting or strategy it's used in.