Schaff Trend Cycle + Double MAThis strategy uses two different moving averages to determine a trend. It opens a position on a pullback from a trend.
Conditions for buy signal are:
►Crossover out of Shaff Trend Cycle's extreme levels
►The price is above its short period exponential moving average.
►A short period exponential moving average is above a long period exponential moving average.
*Conditions for sell are the opposite.
All in all, I don't think it needs to be on your chart but it can be optimized and even successful on some timeframes.
Shaff Trend Cycle solution was provided by @everget, I converted his script to Pine v.4, added exponential averages and created an algorithm for backtesting.
In den Scripts nach "algo" suchen
Correlation Cycle, CorrelationAngle, Market State - John EhlersHot off the press, I present this "Correlation Cycle, CorrelationAngle, and Market State" multicator employing PSv4.0, originally formulated by Dr. John Ehlers for TASC - June 2020 Traders Tips. Basically it's an all-in-one combination of three Ehlers' indicators. This power packed triplet indicator, being less than a 100 line implementation at initial release, is a heavily modified version of the original indicator using novel techniques that surpass John Ehlers' original intended design.
This is also a profound script in numerous ways. First of all, these three indicators are directly from the illustrious mastermind himself Dr. John Ehlers. Secondarily, this is my "50th" script published on TV, which makes it even more significant. I'm especially proud of this script to "degrees" of imagination I once didn't know was theoretically possible in code. My intellect has once again been mathemagically unlocked pondering new innovations with this code revelation. Thirdly, this PSv4.0 script shows the empowering beauty and elegance of hacking the stock markets with TV's ultra utilitarian Pine Editor(PE) in a common browser! Some of you may be wondering if I worked on this for days... nope! This only took a few hours, followed by writing this description for another hour plus.
I have created many of Ehlers' indicators in PE, a few of which I have published in my profile, but I wanted to show how programming with Pine Script can be an artistic form of craftsmanship and poetry. None of this would be possible without the ingeniously minded Tradingview staff revolutionizing algorithmic trading at it's finest. If you should ever encounter them by chance, ponder humbly thanking these computing wizards for their diligence and dedication. They are providing, and shall award to us members, some of the most fascinating conceptualized tech imaginable in the coming future. I can assure you, much, much more is yet to be unveiled for us TV members/enthusiasts. Thank you TV and all you offer to this community.
As always, I have included advanced Pine programming techniques that conform to proper "Pine Etiquette" by example. There are so many Pine mastery techniques included, I don't have an abundance of time to elaborate on all of them. For those of you are code savvy, you may have notice I only used one "for" loop for increased server efficiency, instead of the two "for" loops in the original formulation. For those of you who are newcomers to Pine Script, this code release may also help you comprehend the immense "Power of Pine" by employing advanced programming techniques while exhibiting code utilization in a most effective manner. This is commonly what my dense intricate code looks like behind the veil. If you are wondering why there is hardly any notes, that's because the notation is primarily in the variable naming.
Features List Includes:
Dark Background - Easily disabled in indicator Settings->Style for "Light" charts or with Pine commenting
AND a few more... Why list them, when you have the source code!
The comments section below is solely just for commenting and other remarks, ideas, compliments, etc... regarding only this indicator, not others. 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. As always, "Like" it if you simply just like it with a proper thumbs up, and also return to my scripts list occasionally for additional postings. Have a profitable future everyone!
RedK_Supply/Demand Volume Viewer v1Background
============
VolumeViewer is a volume indicator, that offers a simple way to estimate the movement and balance (or lack of) of supply & demand volume based on the shape of the price bar. i put this together few years ago and i have a version of this published for another platform under different names (Directional Volume, BetterVolume) in case you come across them
what is V.Viewer
=====================
The idea here is to find a "simple proxy" for estimating the demand or supply portions of a volume bar - these 2 forces have the potential to affect the current price trend so we want an easy way to track them - or to understand if a stock is in accumulation or distribution - we want to do this without having access to Level II or bid/ask data, and without having to get into the complexity of exploring the lower timeframe price & volume data
- to achieve that, we depend on a simple assumption, that the volume associated with an up move is "demand" and the volume associated with a down move is "Supply". so we basically extrapolate these supply and demand values based on how the bar looks like - a full "green" price bar / candle will be considered 100% demand, and a full "red" price bar will be considered 100% supply - a bar that opens and closes at the same level will be 50/50 split between supply & demand.
- you may say this is a "too simple" of an assumption to make, but believe me, it works :) at least at the basic scenario we need here: i'm just exploring the volume movement and finding key levels - and it provides a good improvement compared to the classic way we see volume on a chart - which is still available here in VolumeViewer.
in all cases, i consider this to be work in progress, so i'd welcome any ideas to improve (without getting too complicated) - there's already a host of great volume-based indicators that will do the multi timeframe drill down, but that's not my scope here.
Technical Jargon & calculation
===========================
1. first we calculate a score % for the volume portion that is considered demand based on the bar shape
skip this part if it sounds too technical => if you're into coding indicators, you would probably know there are couple of different concepts for that algorithm - for example, the one used in Balance Of Power formula - which i'm a big fan of - but the one i use here is different. (how?) this is my own, ant it simply applies double weight for the "wick" parts of a price bar compared to the "body of the bar" -- i did some side-by-side comparison in past and decided this one works better. you can change it in the code if you like
2. after calculating the Bull vs Bears portion of volume, we take a moving average of both for the length you set, to come up with what we consider to be the Demand vs Supply - as usual, i use a weighted moving average (WMA) here.
3. the balance or net volume between these 2 lines is calculated, then we apply a final smoothing and that's the main plot we will get
4. being a very visual person, i did my best to build up the visuals in the correct order - then also to ensure the "study title" bar is properly organized and is simple and useful (Full Volume, Supply, Demand, Net Volume).
- i wish there was a way in Pine to hide a value that i still need to visually plot but don't want it showing its value on the study title bar, but couldn't find it. so the last plot value is repeated twice.
How to use
===========
- V.Viewer is set up to show the simplified view by default for simplicity. so when you first add it to a chart, you will get only the supply vs demand view you can see in the middle pane in the above chart
- Optional / detailed mode: go into the settings, and expose all other plots, you will be able to add the classic volume histogram, and the Supply / Demand lines - note these 2 lines will be overlay-ed on top of each other - this provides an easy way to see who is in control - especially if you change the display of these 2 lines into "area" style. This is what is showing in the lower pane in the above chart.
** Exploring Key Price Levels
- the premise is, at spots where there's big lack of balance, that's where to expect to find key price levels (support / resistance) and these price levels will come into play in future so can be used to set entry / exit targets for our trades - see the example in the AAPL chart where you can easily locate these "balance or reversal levels" using the tops/bottoms/zero-crossings from the Net Volume line
** Use for longer-term Price Analysis
- we can also use this simple indicator to gain more insights (at a high level) of the price in terms of accumulation vs distribution and if the sellers or buyers are in control - for example, in the above AAPL chart, V.Viewer tells us that buyers have been in control since October 19 - even during the recent drop, demand continued to be in play - compare that to DIS chart below for the same period, where it shows that the market was dumping DIS thru the weakness. DIS was bleeding red most of the time
Final thoughts
=============
- V.Viewer is an attempt to enhance the way we see and use Volume by leveraging the shape of the price bar to estimate volume supply & demand - and the Net between the 2
- it will work for stocks and other instruments as long as there's volume data
- note that V.Viewer does not track trend. each bar is taken in isolation of prior bars - the price may be going down and V.Viewer is showing supply going up (absorption scenario?) - so i suggest you do not use it to make decisions without consulting other trend / momentum indicators - of course this is a possible improvement idea, or can be implemented in another indicator, add in trend somehow, or maybe think of making this a +100 / -100 Oscillator .. feel free to play with these thoughts
- all thoughts welcome - if this is useful to you in your trading, please share with other trades here to learn from each other
- the code is commented - please feel free to use it as you like, or build things on top of it - but please continue to credit the author of this code :)
good luck!
-
Realized Volatility IIR Filters with BandsDISCLAIMER:
The Following indicator/code IS NOT intended to be a formal investment advice or recommendation by the author, nor should be construed as such. Users will be fully responsible by their use regarding their own trading vehicles/assets.
The following indicator was made for NON LUCRATIVE ACTIVITIES and must remain as is following TradingView's regulations. Use of indicator and their code are published by Invitation Only for work and knowledge sharing. All access granted over it, their use, copy or re-use should mention authorship(s) and origin(s).
WARNING NOTICE!
THE INCLUDED FUNCTION MUST BE CONSIDERED AS TESTING. The models included in the indicator have been taken from open sources on the web and some of them has been modified by the author, problems could occur at diverse data sceneries.
WHAT'S THIS...?
Work derived by previous own research for study:
This is mainly an INFINITE IMPULSE RESPONSE FILTERING INDICATOR , it's purpose is to catch trend given by the nature of lag given by a VOLATILITY ESTIMATION ALGORITHM as it's coefficient. It provides as well an INFINITE IMPULSE RESPONSE DEVIATION FILTER that uses the same coefficients of the main filter to plot deviation bands as an auxiliary tool.
The given Filter based indicator provides my own Multi Volatility-Estimators Function with only 3 models:
ELASTIC VOLUME WEIGHTED VOLATILITY : This is a Modified Daigler & Padungsaksawasdi "Volume Weighted Volatility" as on DOI: 10.1504/IJBAAF.2018.089423 but with Elastic Volume Weighted Moving Average instead of VWAP (intraday) for faster (but inaccurate) calculation. A future version is planned on the way using intra-bar inspection for intraday timeframe as described in original paper.
GARMAN & KLASS / YANG-ZANG EXTENSION : As one of the best range based (OHLC) with open gaps inclusion in a single bar.
PETER MARTIN'S ULCER INDEX : This is a better approach to measure realized volatility than standard deviation of log returns given it's proven convex risk metric for DrawDowns as shown in Chekhlov et al. (2005) . Regarding this particular model, I take a different approach to use it as coefficient feed: Given that the UI only takes in consideration DrawDawns, I code myself the inverse of this to compute Draw-Ups as well and use both of them to filter minimums volatility levels in order to create a SLOW version of the IIR filter, and maximums of both to calculate as FAST variation. This approach can be used as a better proxy instead of any other common moving average given that with NO COMPOUND IN TIME AT ALL (N=1) or only using as long as N=3 bars of compund, the filter can catch a trend easily, making the indicator nearly a NON PARAMETRIC FILTER.
NOTES:
This version DO NOT INCLUDE ALERTS.
This version DO NOT INCLUDE STRATEGY: ALL Feedback welcome.
DERIVED WORK:
Incremental calculation of weighted mean and variance by Tony Finch (fanf2@cam. ac .uk) (dot@dotat.at), 2009.
Volume weighted volatility: empirical evidence for a new realised volatility measure by Chaiyuth Padungsaksawasdi & Robert T. Daigler, 2018.
Basic DSP Tips & Trics by TradingView user @alexgrover
CHEERS!
@XeL_Arjona 2020.
Pivot Point SupertrendHello All,
There are many types of SuperTrend around. Recently I thought about a Supertrend based on Pivot Points then I wrote "Pivot Point SuperTrend" script. It looks it has better performance on keeping you in the trend more.
The idea is behind this script is finding pivot point, calculating average of them and like in supertrend creating higher/lower bands by ATR. As you can see in the algorithm the script gives weigth to past pivot points, this is done for smoothing it a bit.
As I wrote above it may keep you in the trend more, lets see an example:
As an option the script can show main center line and I realized that when you are in a position, this line can be used as early exit points. (maybe half of the position size)
While using Pivot Points, I added support resistance lines by using Pivot Point, as an option the script can show S/R lines:
And also it can show Pivot Points:
When you changed Pivot Point Period you can see its reaction, in following example PP period is 4 (default value is 2). Smaller PP periods more sensitive trendlines.
Alerts added for Buy/Sell entries and Trend Reversals. (when you set alerts use the option " Once Per Bar Close ")
ENJOY!
Super Squeeze// SUPER SQUEEZE
//
// The idea is to make it possible to identify the ongoing Trend.
// The algoritm works as:
//
// 1. Apply SMMA on the Price.
// 2. Apply Bollinger Band and keltner Channel on the SMMA
//. 3. If BB is inside KC then there is NoTrend.
// 4. Else, if SMMA > KC-Upper then it is a strong UpTrend and
// if SMMA < KC-Lower then it is a strong DownTrend
// else it is NoTrend
//
// I've written the 'super_sqeeze' as one single function to make it easy to make
// use of it in other projects of mine. The function takes the follwing input arguments:
//
//. super_squeeze(Price, // example: close
// Length, // number of lookback periods, example: 66
// BBmult, // Bollinger Band multipier of the Standard Deviation, example: 1.5
// KCmult) // Keltner Channel multiplier, example: 1
//
// The return values from the function are:
//
//. 1 = Strong Up Trend
// 0.5. = Weak Up Trend
//. 0. = No Trend
//. -0.5. = Weak Down Trend
// -1. =. Strong Down Trend
Correlation Trend Indicator - Dr. John EhlersHot off the press, I present this "Correlation Trend Indicator" employing PSv4.0, originally formulated by Dr . John Ehlers for TASC - May 2020 Traders Tips. John Ehlers might describe it's characteristics as being a mean reverting trend identification oscillator range bound to +/-1.0 irregardless of any timeframe or asset. I could have finessed this indicator with all kinds of bells and whistles, but I wanted to keep it simple and handy enough for novice Pine programmers or Tradingview newcomers to use. This algorithm, in a slightly modified form, is actually a small portion of the base code for John Ehlers' highly complex Autocorrelation Periodogram and his Convolution SwamiChart.
Some members may have notice that I published a very similar script last month. That is correct. It's sole intention was completely different, having more diverse versatility and complexity, but with slightly reduced computational performance. While they seem eerily similar, they are genetically different. This function only has only one required "series" parameter and the correlation is calculated using the period, not bar_index. Correlating with bar_index or period yields identical results either way. Bottom line, this indicator is elegantly simplistic, yet highly utilitarian and easy to use.
Features List Includes:
Dark Background - Easily disabled in indicator Settings->Style for "Light" charts or with Pine commenting
AND a few more... You have the source!
The comments section below is solely just for commenting and other remarks, ideas, compliments, etc... regarding only this indicator, not others. 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. As always, "Like" it if you simply just like it with a proper thumbs up, and also return to my scripts list occasionally for additional postings. Have a profitable future everyone!
Filter Information Box - PineCoders FAQWhen designing filters it can be interesting to have information about their characteristics, which can be obtained from the set of filter coefficients (weights). The following script analyzes the impulse response of a filter in order to return the following information:
Lag
Smoothness via the Herfindahl index
Percentage Overshoot
Percentage Of Positive Weights
The script also attempts to determine the type of the analyzed filter, and will issue warnings when the filter shows signs of unwanted behavior.
DISPLAYED INFORMATION AND METHODS
The script displays one box on the chart containing two sections. The filter metrics section displays the following information:
- Lag : Measured in bars and calculated from the convolution between the filter's impulse response and a linearly increasing sequence of value 0,1,2,3... . This sequence resets when the impulse response crosses under/over 0.
- Herfindahl index : A measure of the filter's smoothness described by Valeriy Zakamulin. The Herfindahl index measures the concentration of the filter weights by summing the squared filter weights, with lower values suggesting a smoother filter. With normalized weights the minimum value of the Herfindahl index for low-pass filters is 1/N where N is the filter length.
- Percentage Overshoot : Defined as the maximum value of the filter step response, minus 1 multiplied by 100. Larger values suggest higher overshoots.
- Percentage Positive Weights : Percentage of filter weights greater than 0.
Each of these calculations is based on the filter's impulse response, with the impulse position controlled by the Impulse Position setting (its default is 1000). Make sure the number of inputs the filter uses is smaller than Impulse Position and that the number of bars on the chart is also greater than Impulse Position . In order for these metrics to be as accurate as possible, make sure the filter weights add up to 1 for low-pass and band-stop filters, and 0 for high-pass and band-pass filters.
The comments section displays information related to the type of filter analyzed. The detection algorithm is based on the metrics described above. The script can detect the following type of filters:
All-Pass
Low-Pass
High-Pass
Band-Pass
Band-Stop
It is assumed that the user is analyzing one of these types of filters. The comments box also displays various warnings. For example, a warning will be displayed when a low-pass/band-stop filter has a non-unity pass-band, and another is displayed if the filter overshoot is considered too important.
HOW TO SET THE SCRIPT UP
In order to use this script, the user must first enter the filter settings in the section provided for this purpose in the top section of the script. The filter to be analyzed must then be entered into the:
f(input)
function, where `input` is the filter's input source. By default, this function is a simple moving average of period length . Be sure to remove it.
If, for example, we wanted to analyze a Blackman filter, we would enter the following:
f(input)=>
pi = 3.14159,sum = 0.,sumw = 0.
for i = 0 to length-1
k = i/length
w = 0.42 - 0.5 * cos(2 * pi * k) + 0.08 * cos(4 * pi * k)
sumw := sumw + w
sum := sum + w*input
sum/sumw
EXAMPLES
In this section we will look at the information given by the script using various filters. The first filter we will showcase is the linearly weighted moving average (WMA) of period 9.
As we can see, its lag is 2.6667, which is indeed correct as the closed form of the lag of the WMA is equal to (period-1)/3 , which for period 9 gives (9-1)/3 which is approximately equal to 2.6667. The WMA does not have overshoots, this is shown by the the percentage overshoot value being equal to 0%. Finally, the percentage of positive weights is 100%, as the WMA does not possess negative weights.
Lets now analyze the Hull moving average of period 9. This moving average aims to provide a low-lag response.
Here we can see how the lag is way lower than that of the WMA. We can also see that the Herfindahl index is higher which indicates the WMA is smoother than the HMA. In order to reduce lag the HMA use negative weights, here 55% (as there are 45% of positive ones). The use of negative weights creates overshoots, we can see with the percentage overshoot being 26.6667%.
The WMA and HMA are both low-pass filters. In both cases the script correctly detected this information. Let's now analyze a simple high-pass filter, calculated as follows:
input - sma(input,length)
Most weights of a high-pass filters are negative, which is why the lag value is negative. This would suggest the indicator is able to predict future input values, which of course is not possible. In the case of high-pass filters, the Herfindahl index is greater than 0.5 and converges toward 1, with higher values of length . The comment box correctly detected the type of filter we were using.
Let's now test the script using the simple center of gravity bandpass filter calculated as follows:
wma(input,length) - sma(input,length)
The script correctly detected the type of filter we are using. Another type of filter that the script can detect is band-stop filters. A simple band-stop filter can be made as follows:
input - (wma(input,length) - sma(input,length))
The script correctly detect the type of filter. Like high-pass filters the Herfindahl index is greater than 0.5 and converges toward 1, with greater values of length . Finally the script can detect all-pass filters, which are filters that do not change the frequency content of the input.
WARNING COMMENTS
The script can give warning when certain filter characteristics are detected. One of them is non-unity pass-band for low-pass filters. This warning comment is displayed when the weights of the filter do not add up to 1. As an example, let's use the following function as a filter:
sum(input,length)
Here the filter pass-band has non unity, and the sum of the weights is equal to length . Therefore the script would display the following comments:
We can also see how the metrics go wild (note that no filter type is detected, as the detected filter could be of the wrong type). The comment mentioning the detection of high overshoot appears when the percentage overshoot is greater than 50%. For example if we use the following filter:
5*wma(input,length) - 4*sma(input,length)
The script would display the following comment:
We can indeed see high overshoots from the filter:
@alexgrover for PineCoders
Look first. Then leap.
Custom EMA PrismThis script implements the Binary Logic Trading (BLT) algorithm to calculate a score from 0 to 7. This score is calculated assigning a power of 2 weight to the positive sign of 3 Phi^3 distant EMAs' slopes. The largest EMA slope positive sign receives weight 4, the middle length EMA slope positive sign receives weight 2 and the shortest EMA slope positive sign receives weight 1. The positive sign of an EMA is defined as 1 if the slope of the EMA is positive and 0, otherwise. Therefore, for EMAs 305, 72 and 17, if slope(EMA305) > 0, slope(EMA72) < 0 and slope(EMA17) > 0, then score will be 4*1 + 2*0 + 1*1 = 5. Up to my knowledge, this score was first proposed by Bo Williams and named by him as Prisma.
Due too sampling issues, this script ONLY WORKS with graphic time of 1d. I would like to thanks to MrBitmanBob for showing me how to get quotations from a graphic time distinct from the current one.
This script also gets sampling data from graphic times 2h and 30m to calculate their score. As, even for smaller graphic times, price data is sampled at the current time frequency, the EMA lengths for those smaller graphic times needed to be proportionally decreased, meaning that when calculating the score for 1d with lengths 305, 72 and 17, the score for 2h must be calculated with lengths 72, 17 and 4, and the score for 30m must be calculated with lengths 17, 4 an 1. I understand that some precision may be lost but it is the best that is possible.
There is an optional setting for Crypto Currencies that instead of calculating the score for 1d, 2h and 30m, it calculates the score for 1d, 4h and 60m. This is due to the fact that Crypto Currencies are traded 24x7. Despite of this setting, the labels at the Style tab of the settings window remains 2h and 30m, because they must be constants.
This script with the corresponding EMAs chart and the EMAs Angle chart provides a broader view of the trading scenario.
StarbuxI made this in starbucks .
Bullish hammer trading signal algorithm
using MACD for trend determination and holding period.
Higher Highs & Lower Lows Stochastics - Vitali ApirineThis is my modified "Higher Highs & Lower Lows Stochastics" employing PSv4.0, originally formulated by Vitali Apirine for TASC - February 2016 Traders Tips. Reading through a TASC magazine of mine, behold, I found a little known indicator that I can't find anywhere on all of Tradingview. That was a tragedy I felt I had to resolve... This indicator is best described as a dual momentum indicator, being helpful with anticipating reversals, spotting emerging trends, and defining correction periods. I felt it worthy of justice to unveil this for all TV members to utilize and also learn from. It's uniqueness is beyond past due for the honor it deserves on Tradingview.
As always, I have included advanced Pine programming techniques that conform to proper "Pine Etiquette". For those of you who are newcomers to Pine Script, this code release may also help you comprehend the "Power of Pine" by employing advanced programming techniques while exhibiting code utilization in a most effective manner. This script's uniqueness displays that we can now override built-in Pine functions. Firstly, you may have noticed that I replaced ema(), sma(), highest(), and lowest(). If you weren't aware of this Pine capability, well, here is a prime example... Now you know! Just heed caution when doing so to ensure your replacement algorithms are 100% sound. Lastly, I also added an additional "Median" line where the companion stochastics seemingly appear to gravitate within a central zone.
NOTICE: You may have observed, there is highest(), lowest(), ema(), and sma() custom functions overwriting Pine built-ins, some of which are audaciously used in ternary. "IF" you are planning to use Pine Script v4.0 functions in ternary, be forewarned, they WILL NOT operate as expected in most scenarios. The reason why I legitimately used them here in ternary is because they are ONLY manually controlled by an input(). If these were dynamically controlled with bar-to-bar dynamic conditional logic, you would most certainly run into serious unexpected programming issues, potentially resulting in hours of frustrations and guaranteed loss of hair. That's my lesson for this release, so never ever forget this when utilizing the full potential of the "Power of Pine". For more information concerning these potential dilemmas, please consult "Execution of Pine functions and historical context inside function blocks" in the "Pine Script v4 User Manual".
Features List Includes:
Dark Background - Easily disabled in indicator Settings->Style for "Light" charts or with Pine commenting
AND much, much more... You have the source!
The comments section below is solely just for commenting and other remarks, ideas, compliments, etc... regarding only this indicator, not others. 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. As always, "Like" it if you simply just like it with a proper thumbs up, and also return to my scripts list occasionally for additional postings. Have a profitable future everyone!
Underworld Hunter Backtesting AlgorhitmThis strategy is built to prove the profitability of my Underworld Hunter indicator . It tests two different strategies. I won't be going into the calculation again since it is part of the original script. I just made a few adjustments.
First one is clearly visual. It plots slimmer twin-coloured lines now and has a different colour for every extreme level. Second is less obvious - I switched Relative Strength Index for Commodity Channel Index.
Extreme levels are as follows: green 100 -► 120, yellow 120 -► 140, orange 140 -► 160, red 160 -► 180 and purple above 180, I will have a special separate algorithm for testing optimal CCI levels someday, in this script, these values are only meant to help you with manual operations and do not influence results of the strategy in any way.
#Trending strategy
The trending strategy opens a position whenever the price leaves the bands and holds it until two consecutive bars are closed within the bands. The picture shows one winning position that hasn't yet been resulted. It also shows a few fakeouts. For this strategy, you want to keep the length below 110, the deviation should be below 2 and you probably want to play lower timeframes.
#Within the bands
The second strategy is pretty much the opposite. It opens a position when the price reaches outer bands and holds it until two consecutive bars are closed within the bands and current bar closes below previous bars low in case of long. It is working on hourly timeframes and you need higher length and deviation to succeed. The picture shows a few positions on EURUSD. Each of them is profitable but would be much higher if you closed it manually when it was time. You need to enable this strategy, which automatically disables the other one.
When using my script, you need to bear in mind that the first strategy doesn't detect optimal levels to close the price. A trend is often followed by a less volatile and boring correction which causes bands to shrink and lower your profits if you don't close manually as it will take longer till bands are reached.
On the other hand, second script literally has no stop-loss. As long as the price is outside the range, it will never close which will cause major drawdowns, unless you control the trade manually. CCI is here to help you with both.
I also recommend combining this with Market Profile (on TW, there is only Volume Profile, which can be used in a similar way) and trading day theory (trending with multiple distributions, trending day, normal day, a variation on a normal day, non-trending day or neutral day). Always keep in mind that it is up to traders to be profitable, indicators can support a good trader, but they will not fix a bad one.
TWAP TrendHere we are experimenting with using TWAP for trend analysis. It appears to work better than VWAP on lower timeframes.
TWAP is a tool used by algorithm based traders that allows them to distribute their orders throughout the day without disturbing price or having their positions known to rival traders in the market. It's similar to VWAP and serves the same function, except it lacks the volume aspect. This can be an issue when position entry/exit may be affected by slippage.
The main benefit of TWAP is deciding how to distribute orders throughout the chosen timeframe. However, just like the VWAP traders will normally use it as a moving average or target for price action to pull into.
There is an option to change the timeframe that TWAP is calculated from.
Originally by NeoButane:
Ichimoku Clouds Strong Bullish/Bearish signals and alertsIchimoku Clouds Strong Bullish/Bearish signals with allerts
The Ichimoku cloud was developed by Goichi Hosoda, a Japanese journalist, and published in the late 1960s. It provides more data points than the standard candlestick chart. While it seems complicated at first glance, those familiar with how to read the charts often find it easy to understand with well-defined trading signals.
We provide you easy-to-use script which helps to decrypt meaning of lines in the indicator. The script takes Ichimoku clouds indicator formulas to calculate Tenkan, Kijun, SenkouA, SenkouB values and examines them in order to produce buy ( Bullish ) and sell ( Bearish ) signals which are displayed at the chart
The most appropriate time frame is 30m
Custom alerts are added to send you a notice with a webhook when bullish or bearish signal arrives.
You can easily add weak and neutral signals alerts by removing "//" in a specified place
Feel free to copy and use this script for your ideas and trading. You can modify the script by adding Parabolic SAR in order to increase accuracy of positions closure
Underworld HunterUnderworld hunter is a combination of triple smoothed moving average, its 1.8 deviations and RSI printed right into your chart. All its parameters can be modified in order to deliver maximum benefit.
Original idea was to identify areas of correction. When RSI extreme disappears and the price is outside of deviations, I would have gone against the trend and wait till retraces a bit. However, I didn't find this setup to be particularly effective in most markets.
When zoomed out, you can see that Underworld Hunter can accurately identify a trend in the current EURUSD market. If the price is outside the deviations, the trend is strong. The closer the price is to a middle moving average, the more sideways and less trending the situation is.
I think it is best to send you to see how Underworld Hunter behaves and figure out if it is a helpful tool for you. I might as well develop some strategy testing algorithms later.
Why is it called Underworld Hunter? In Dota 2 lore, there is a bird that hunts for souls that escape the Underworld. The original strategy works pretty much the same way - you are supposed to hunt for the price that escapes the channel. I kind of like fantasy-themed names for my indicators...
Please report back in comments how do you intend to use my tool and how did your handtesting go! Thanks.
McGinley Dynamic Band DTThis indicator consists of 2 x McGinley Dynamic moving averages with the ability to fill the area between the 2 MA lines.
The McGinley Dynamic MA is a very powerful tool that has many applications and can be a great addition to a traders arsenal if you're interested in it I suggest doing a bit of research.
I personally use this indicator in addition to the other indicators in my algorithm as a method of filtering out ranging trades, thus I will not enter a trade if the price is within the colour filled area
When using this indicator don't forget to adjust the inputs to find the best settings to suit your trading method, timeframe and personality.
The source code is available to use and modify as you wish.
Enjoy
GMS: RSI StrategyThis is just a basic RSI strategy that it easy to use and quite comprehensive so you can quickly test out an idea based on RSI.
- I made it comprehensive in that you can select long, short, or both.
- There is a simple moving average trend filter. You can filter for trades above, below, or don't include it at all.
- The exit is based on a simple moving average.
The source code should be open if you want to see it or modify it for your own project. I hope it helps!
Andre
Global Market Signals
Combo Backtest 123 Reversal & CMOaDisparity 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
The related CMOaDisparity Index article is copyrighted material from Stocks & Commodities Dec 2009
My strategy modification.
WARNING:
- For purpose educate only
- This script to change bars colors.
BEST Engulfing + Breakout StrategyHello traders
This is a simple algorithm for a Tradingview strategy tracking a convergence of 2 unrelated indicators.
Convergence is the solution to my trading problems.
It's a puzzle with infinite possibilities and only a few working combinations.
Here's one that I like
- Engulfing pattern
- Price vs Moving average for detecting a breakout
Definition
Take out the notebooks :) and some coffee (good for focus). I'm bullish in coffee
The engulfing pattern is a two-candle reversal pattern.
The second candle completely ‘engulfs’ the real body of the first one, without regard to the length of the tail shadows.
The bullish Engulfing pattern appears in a downtrend and is a combination of one red candle followed by a larger green candle
The bearish Engulfing pattern appears in a downtrend and is a combination of one green candle followed by a larger red candle
Example: imgur.com
We're bored sir... what's the point of all this?
In summary, an engulfing is a pattern to track reversals. (the whole TradingView audience stands up now giving a standing ovation)
Adding the Price vs Moving average filters allows to track reversals with momentums (half of the audience collapsed because this is too awesome)
Ok sir... you picked up my interest
I included some cool backtest filters:
- date range filtering
- flexible take profit in USD value (plotted in blue)
- flexible stop loss in USD value (plotted in red)
All the best
Dave
Renko Weis Wave VolumeThis is live and non-repainting Renko Weis Wave Volume tool. The tool has it’s own engine and not using integrated function of Trading View.
Renko charts ignore time and focus solely on price changes that meet a minimum requirement. Time is not a factor on Renko chart but as you can see with this script Renko RSI created on time chart.
Renko chart provide several advantages, some of them are filtering insignificant price movements and noise, focusing on important price movements and making support/resistance levels much easier to identify.
As source Closing price or High/Low can be used.
Traditional or ATR can be used for scaling. If ATR is chosen then there is rounding algorithm according to mintick value of the security. For example if mintick value is 0.001 and brick size (ATR/Percentage) is 0.00124 then box size becomes 0.001. And also while using dynamic brick size (ATR), box size changes only when Renko closing price changed.
This tool is based on the Weis Wave described by David H. Weis (a Wyckoff specialist). The Weis Waves Indicator sums up volumes in each wave. This is how we receive a bar chart of cumulative volumes of alternating waves and The cumulative volume makes the Weis wave charts unique.
If there is no volume information for the security then this tool has an option to use “True Range” instead of volume .
Better to use this script with the following one:
Enjoy!
Renko ChartHello All. This is live and non-repainting Renko Charting tool. The tool has it’s own engine and not using integrated function of Trading View.
Renko charts ignore time and focus solely on price changes that meet a minimum requirement. Time is not a factor on Renko chart but as you can see with this script Renko chart created on time chart.
Renko chart provide several advantages, some of them are filtering insignificant price movements and noise, focusing on important price movements and making support/resistance levels much easier to identify.
in the script Renko Trend Line with threshold area is included. and also there is protection from whipsaws, so you can catch big waves with very good entry points. Trend line is calculated by EMA of Renko closing price.
As source Closing price or High/Low can be used. Traditional or ATR can be used for scaling. If ATR is chosen then there is rounding algorithm according to mintick value of the security. For example if mintick value is 0.001 and brick size (ATR/Percentage) is 0.00124 then box size becomes 0.001. And also while using dynamic brick size (ATR), box size changes only when Renko closing price changed.
Renko bar can be seen as area or candle and also optionally bar color changes when Renko trend changed.
Soon other Renko scripts (Renko RSI, Renko Weis Wave, Renko MACD etc) are coming ;)
ENJOY!
Emulating binary operations and several values in one variableBinary operations and storing several numbers in one variable.
It's useful when you need to pass a values numbers to another study. Study-on-study (SOS) in Tradingview allows passing only one value, which is not always convinient. So if we put all those numbers in one - we can pass more values from one study to another.
In Pine we can use up to 52 bits for our data. Because of that we can put 6 1-byte (8-bit) values in one float. Or 12 4-bit values. Or 52 1-bit values.
Stochastic Pop and Drop by Jake Bernstein v1 [Bitduke]I found a simple strategy by Jake Bernstein, modified it a little and created a strategy with Risk Management System (SL+TP); After that I test it on the different cryptocurrency pairs.
About the Indicator
Basically it's the strategy of 2 indicators: Stochastic Oscillator to define the bias and Average Directional Index to confirm it.
One again, It uses Stochastic Oscillator to define the trading bias. In particular, the trading bias was deemed bullish when the weekly 14-period Stochastic Oscillator was above some default value (in him paper - 50) and rising and vice versa.
Once the trading bias is established, Steckler used the Average Directional Index (ADX) to define a slowdown in the trend. ADX measures the strength of the trend and a move below 20 signals a weak trend.
Modifications
I didn't implement Average Directional Index (ADX) and test just different sources for data, oscillator periods and different levels in relation to the crypto market.
So, it shows good results with two tight thresholds at 55 and 45 level.
The bar chart below the defining the bullish and bearish periods (green and red) and gives a signal to enter the trade (purple bars).
Backtesting
Backtested on XBTUSD , BTCPERP (FTX) pairs. You may notice it shows good results on 3h timeframe.
Relatively low drawdown
~ 10% (from 2019 to date) FTX
~ 22% (4 years from 2016) Bitmex
I backtested on the different altcoin pairs as well, but the results were just not good.
Relatively good results were shown by some index pairs from the FTX exchange ( FTX:SHITPERP ), but I think there is a few data for backtesting to be asure in them.
Bitmex 3h (2017 - 2020) :
i.imgur.com
FTX 3h (2019 - 2020):
i.imgur.com
Possible Improvements
- Regarding trading algorithm it would be good to check with strategy with ADX somehow. Maybe for the better entries
- As for Risk Management system, it can be improved by adding trailing stop to the strategy.
Link: school.stockcharts.com