Similarity Search, Karobein and Seasonal Random IndexSimilarity Search, Karobein oscillator (KO) and Seasonal Random Index (SRI)
Description:
This indicator uses dynamic capabilities of Pinescript version 4 coupled with Seasonal Random Index (SRI) and Karobein Oscillator (KO). SRI (green/red areas) is employed to detect trends and KO (black curce) is used to find historical similarities to predict the next bar's direction. The midline arrows are the predictions produced by the similarity search algorithm.
In den Scripts nach "algo" suchen
Moving Regression Prediction BandsIntroducing the Moving Regression Prediction Bands indicator.
Here I aimed to combine the principles of traditional band indicators (such as Bollinger Bands), regression channel and outlier detection methods. Its upper and lower bands define an interval in which the current price was expected to fall with a prescribed probability, as predicted by the previous-step result of the local polynomial regression (for the original Moving Regression script, see link below).
Algorithm
1. At every time step, the script performs local polynomial regression of the sample data within the lookback window specified by the Length input parameter.
2. The fitted polynomial is used to construct the Moving Regression time series as well as to extrapolate data, that is, to predict the next data point ( MRPrediction ).
3. The accuracy of local interpolation is estimated by means of the root-mean-square error ( RMSE ), that is, the deviation between the fitted polynomial and the observed values.
4. The MRPrediction and RMSE values calculated for the previous bar are then used to build the upper and lower bands , which I define as follows:
Upper Band = MRPrediction_prev + Multiplier *( RMSE_prev )
Lower Band = MRPrediction_prev - Multiplier *( RMSE_prev )
Here the Multiplier is a user-defined parameter that should be interpreted as a quantile in the standard normal distribution (the default value of 2.0 roughly corresponds to the 95% prediction interval).
To visualize the central line , the script offers the following options:
Previous-Period MR Prediction: MRPrediction_prev time series from the above equation.
MR: Conventional Moving Regression time series.
Ribbon: “Previous-Period MR Prediction” and “MR” curves plotted together and colored according to their relative value (green if MR > Previous MR Prediction; red otherwise).
Usage
My original idea was to use the band breakouts as potential trading signals. For example, the price crossing above the upper band is a bullish signal , being a potential sign that price is gaining momentum and is out of a previously predicted trend. The exit signal could be the crossing under the lower band or under the central line.
However, be aware that it is an experimental indicator, so you might fin some better strategies.
Feel free to play around!
Local LimitsDisplays recent higher highs, lower highs, lower lows, and higher lows as a collection of local limit indicators.
In its simplicity is a lot more powerful than might appear at first glance.
Does not rely on volatility calculation.
Can be linked together to create an objective view of recent support and resistance levels.
Makes current trends more visible.
Excellent for use as a trailing stop algorithm.
Parameters
Single Bar Sensitivity: True (default) reacts to individual bars. False only responds to the alignment of 2 bars.
Margin (1-5): Adds extra distance from higher lows and lower highs to reduce the sensitivity of broken trends.
Single indicators with configurable sources:
Local Limit Higher
Local Limit Lower
Pinescript Selection Sort Using ArraysThe selection sort algorithm sorts an array by repeatedly finding the smallest element from unsorted array and pushing it to the beginning. Two subarrays are maintained during the execution of the script. One of the subarrays is in a sorted state while the other is in a sorted state. After each iteration of the for loop the sorted list is searched for the next correct element which is then pushed onto the sorted subarray.
Worst case performance : О(n^2) comparisons and O(n)swaps
Best case performance : O(n^2) comparisons and O(n) Swaps
Average performance: О(n^2) comparisons and O(n) Swaps
Worst-case space complexity:О(n) total, O(1) auxiliary
The Pseudocode is given below
procedure selection sort
list : array of items
n : size of list
for i = 1 to n - 1
/* set current element as minimum*/
min = i
/* check the element to be minimum */
for j = i+1 to n
if list < list then
min = j;
end if
end for
/* swap the minimum element with the current element*/
if indexMin != i then
swap list and list
end if
end for
end procedure
Realtime All-Time High and All-Time Low Tracker [WIP]This is a study intended to port the work of /u/QuantNomad's "Kozlod - All-time high/low alerts" to pine version 4 without giving any alerts. It is intended to capture the most extreme points on any given price chart in real time, the absolute high and absolute low points. Ideally, the plotted lines would strictly diverge from one another in opposite directions and widen with new highs or lows on a hypothetical "all-time" resolution.
Most of the original code was replaced and I'm trying to resolve a bug where the script fails to register new highs or lows while at the same time making sure that earlier data is plotted correctly. If applied to an asset that has not yet recovered , is just too new, or has not achieved a lower low than its opening price, this indicator ceases to function correctly. This would not be an issue if pine script was more general purpose and had something similar to Python's max(list) function.
Any and all suggestions are welcome. This is simply to serve as a springboard for any programmers trying to design algorithms or strategies that use these variables on any price chart.
Happy Hunting!
- Patch Hemlock
RSI-VWAP Indicator %█ OVERALL
Simple and effective script that, as you already know, uses vwap as source of the rsi, and with good results as long as the market has no long-term downtrend.
RsiVwap = rsi (vwap (close), Length)
The default settings are for BTC in a 30 minute time frame. For other pairs and time frames you just have to play with the settings.
█ FEATURES
• The option to start trading from a certain date has been added.
• To make the profit more progressive, a percentage of your equity is used for entries and a percentage of your position is used for closings.
• The option to trade in Spot mode has been added, since, for the TradingView backtest, the money is infinite and if you do not limit it somehow,
it would offer you much better profits than the live trading.
QuantityOnLong = Spot ? (EquityPercent / 100) * ((strategy.equity / close) - strategy.position_size) : (EquityPercent / 100) * (strategy.equity / close)
• The option to stop the system when the drawdown exceeds the fixed limit has been added.
Drawdown, as you already know, is a very important measure of risk in trading systems.
The maximum drawdown will tell us what the maximum loss of a trading system has been during a period. This maximum loss is determined by:
strategy.risk.max_drawdown(Risk, strategy.percent_of_equity)
• Leverage plotted on labels added.
█ ALERTS
To enjoy the benefits of automatic trading, TradingView alerts can be used as direct buy-sell orders on spot, or long-close orders with leverage.
Currently there are Chrome extensions that act as a bridge between TradingView and your Exchange or Broker.
This is an example of syntax for this type of extensions. Copy and paste a message like this into the alert window:
{{strategy.order.action}} @ {{strategy.order.price}} | e = {{exchange}} a = account s = {{ticker}} b = {{strategy.order.action}} {{strategy.order.alert_message}}
█ NOTE
Certain Risks of Live Algorithmic Trading You Should Know:
• Backtesting cannot assure actual results.
• The relevant market might fail or behave unexpectedly.
• Your broker may experience failures in its infrastructure, fail to execute your orders in a correct or timely fashion or reject your orders.
• The system you use for generating trading orders, communicating those orders to your broker, and receiving queries and trading results from your broker may fail.
• Time lag at various point in live trading might cause unexpected behavior.
• The systems of third parties in addition to those of the provider from which we obtain various services, your broker, and the applicable securities market may fail or malfunction.
█ THANKS
Thanks to TradingView, its Pine code, its community and especially those Pine wizards who post their ideas that helps us to learn.
If the world is heading toward a equitable new world economic order, let's get rich first ...
Happy trading!
LordPepe Stochastic SignalsThis is the Lord Pepe. Howdy. Basic buy/sell indicator to accumulate along a downtrend and release your stack during the uptrend and oversold levels of the stochastic. The buys should be used to stack, and sells indicate levels of profit taking, they do not signal a long term reversal, only < 25% of stack should be released on "OB" signals.
OB - overbought (sell)
OS - oversold (buy)
Local Limit UpperDisplays recent higher and lower highs.
In it's simplicity is a lot more powerful than might appear at first glance.
Does not rely on volatility calculation.
Can be linked together to create an objective view of recent resistance levels.
Makes current trends more visible.
Excellent as a trailing stop (short) algorithm.
Can be used with its sibling: Local Limit Lower
Local Limit LowerDisplays recent higher and lower lows.
In it's simplicity is a lot more powerful than might appear at first glance.
Does not rely on volatility calculation.
Can be linked together to create an objective view of recent support levels.
Makes current trends more visible.
Excellent as a trailing stop algorithm.
Can be used with its sibling: Local Limit Upper
JetzGiantz StrategyThe algorithm for this strategy was provided by JetzGiantz.
It creates buy and sell signals based on the close and open prices of the previous 3 bars, and compares them to the lowest low, or highest high, between the last 3 and 50 bars.
You can select the month and year you wish to backtest.
You can enter the SL and TP values.
There are no other inputs.
Point and Figure Chart - LiveHello Traders,
This is "Point and Figure Chart (PnF)" script that run in separated window in real time. The separated PnF chart window is timeless, so no relation with the time on the chart. PnF chart consist of "X" and "O" columns. While "X" columns represents rising prices, "O" column represents a falling price. If you have no idea about what PnF charting is then you should search for "Point and Figure Charting" on the net and get some info before using this script.
Now lets talk about details. PnF Chart requires at least two variables to be set => Box size and Reversal. Box size represents the size of each X/O in PnF chart and the reversal is used to calculate new X/O or reversal. for example if currrent column is X column then for new "X", "box size * 1" move is needed and for new "O" column or reversal, "box size * revelsal" move is needed. in the script I use lines as X/O columns.
In the options you can set "Box Size Assingment Method". you have 3 options Traditional, ATR, Percentage . what are they?
Traditional: user-defined box size, means you can set the box size as you wish, using the option . if you use this option then you should set it accordingly.
ATR : that's dynamic box size scaling and on each columns it's calculated once, you can set length for ATR
Percentage: that's also dynamic box size scaling according to closing price when new column appeared. if you use this option then you should set it accordingly.
Reversal: The reversal is typically 3 but you can change it as you wish
"Change Bar Color by PnF Trend": if you enable this option then bar color changes by PnF columns, by default it's not enabled
"Change Column Color When Breakout Occurs": PnF color changes if Double Top/Bottom breakout accours. enabled by default and you can set the colors as you wish using the options
"Change Bar Color When Breakout Occurs": bar colors changed if Double Top/Bottom breakout accours. enabled by default and you can set the colors as you wish using the options
the script checks only Double Top/Bottom breakouts at the moment. there are many other breakouts such Triple/Quadruple, Ascending/Descending Triple Top/Bottom breakouts, Catapult etc.
Also the script shows new X/O level and reversal Levels in PnF window. An example:
If you enable "Change Bar Color by PnF Trend" option:
An example if you disable the option "Change Column Color When Breakout Occurs
You may want to see my another/older "Point and Point Chart" script as well. you can find it in my profile/published scripts and in the Public Library. I use same PnF calculation algorithm in both scripts.
Enjoy!
[blackcat] L3 Bias ScalperLevel: 3
Background
Bias alone is a powerful tool for trading. I use SMA3, SMA10, SMA20, SMA30 to cover short and middle term of the trend for scalping. Multiple biases can be introduced for long and short entries.
Function
Use SMAs and biases for scalping with whale move alert (banker fund flow detection)
Key Signal
buy --> entry signal for long
strongbuy --> entry signal for long
add --> buy more or re-entry signal for long
reduce --> partial exit for long
exit --> complete exit for long
sell --> short entry signal
whalemove --> banker fund move detection
Pros and Cons
This script provides entry signal together with whale detection by bias algorithms, you can use whale move to predict next move of trend in large time frame. However, trading signal should be further filtered out for more precise entry signal.
Remarks
At beginning, I want to make it simple and it looks very complex at the end...
Readme
In real life, I am a prolific inventor. I have successfully applied for more than 60 international and regional patents in the past 12 years. But in the past two years or so, I have tried to transfer my creativity to the development of trading strategies. Tradingview is the ideal platform for me. I am selecting and contributing some of the hundreds of scripts to publish in Tradingview community. Welcome everyone to interact with me to discuss these interesting pine scripts.
The scripts posted are categorized into 5 levels according to my efforts or manhours put into these works.
Level 1 : interesting script snippets or distinctive improvement from classic indicators or strategy. Level 1 scripts can usually appear in more complex indicators as a function module or element.
Level 2 : composite indicator/strategy. By selecting or combining several independent or dependent functions or sub indicators in proper way, the composite script exhibits a resonance phenomenon which can filter out noise or fake trading signal to enhance trading confidence level.
Level 3 : comprehensive indicator/strategy. They are simple trading systems based on my strategies. They are commonly containing several or all of entry signal, close signal, stop loss, take profit, re-entry, risk management, and position sizing techniques. Even some interesting fundamental and mass psychological aspects are incorporated.
Level 4 : script snippets or functions that do not disclose source code. Interesting element that can reveal market laws and work as raw material for indicators and strategies. If you find Level 1~2 scripts are helpful, Level 4 is a private version that took me far more efforts to develop.
Level 5 : indicator/strategy that do not disclose source code. private version of Level 3 script with my accumulated script processing skills or a large number of custom functions. I had a private function library built in past two years. Level 5 scripts use many of them to achieve private trading strategy.
[ST] S/R density study v3This algorithm draws supports/resistance levels automatically based on historic candle density at each height. The basic idea is the levels where price is rejected quickly is likely to have fewer candles in the past than the levels above and below. This does not take volume into account. The lookback and number of levels has to be kept low to prevent too many calculations. I haven't looked if there's new pinescript features to let me do this more efficiently yet.
It checks for candle density to decrease once or twice and then increase once or twice before it draws a line at that lowest level. There's an option to draw more lines by only checking for a single decrease and increase.
It likely won't catch all the levels but it seems to get a good amount to help me position stops on other side of S/R or exits on the trade side of S/R.
I've been meaning to share more scripts but keep forgetting. Keeping my scripts free but feel free to like or tip haha.
Keltner Channel [LINKUSDT] 1HThis is a long-only strategy tested on LINK/USDT, 1 hour bar, from Feb 2019. The entry is determined by the breakout of upper Keltnel Channel and when the +DI is higher than 32. Instead of a fixed stop-loss from the original script , I change the exit to the middle band of the Keltnel Channel. 1st profit target will close 20% of the position. 2nd profit target will close 30% of the position. While the remaining 50% position will be closed when the price closes below the middle band of the Keltnel Channel, to take advantage of big trend. All parameters are adjustable. I added another option to enable or disable the ribbon trend filter.
My thoughts: For the same period, LINK appreciated 3000%. So I guess most in and out strategies couldn’t beat a buy and hold strategy during this period. But this doesn’t mean that this strategy is not feasible as each strategy is designed to only take advantage of a certain pattern or behavior of the market. Also, short term strategies allow you to use leverage and hence enable you to use you capital efficiently. Commission is set to 0.1%, taking account of the slippage.
Suggestion: Please perform walk forward analysis before you use real money for trading. Parameters need to be adjusted from time to time depends on your analysis. Can try using ATR for profit targets as over a longer term, the volatility might drop hence a high fixed % profit targets might not be realistic.
Any suggestions are welcome!
RVSI & MACD Confluence BackgroundThis indicator colors the background in vertical (green/red) stripes to indicate if the current trend is possibly bull / bear
A region where the background is not colored indicates that the present trend can not be identified
The algo combines the RVSI (Relative Volume Strength Index {ref fract} ) and the MACD
The Relative Volume Strength Index has been adapted to include 2 moving averages, one fast and one slow
This same fast slow lookback length is applied to the MACD for simplicity
What's interesting is that there is a very strong confluence between the MACD and RVSI, as the MACD is obtained from 'price action only' and the RVSI from the 'volume only'
So a break in confluence of these two might suggest that the current trend is weakening in confidence or can not be clearly identified
Generally, a green background means consider going long ie price trend is rising
A red background means consider going short ie price trend is falling
An absent background color means - consider exiting current trade or wait to get into a new trade
Best Regards, MoonFlag - and a special thanks/mention to 'fract' for the RVSI algo this is derived from
Trend Trader Buy/Sell SignalsTrend Trader
The code is open source, what it uses to print signals is MACD cross and ADX. Bar colors change in relation to where price is according to the 50 day MA. The MA ribbon is used for visualizing trend and using it for dynamic support/resistance. The ribbon is comprised of the 50 day and 100 day MAs.
Main reason to publish this script is because some like to jumble up scripts together slap some moving averages on it to "follow trend" and then label it an algorithm, market it and sell it to people online. No single system will work 100% of the time, do you due diligence in anything you are interested in buying. Plenty of free scripts in the TV library that can do you justice when trading.
Cycle Swing MomentumAdaptive Ultra-Smooth Momentum indicator
The Cycle-Swing-Indicator "CSI" provides an optimized "momentum" oscillator based on the current dominant cycle by looking at the swing of the dominant cycle instead of the raw source momentum. Offering the following improvements:
Smoothness
Zero delay
Sharpness at turning points
Robust and adaptable to market conditions
Accurate deviation detection
The following common problems with standard indicators are solved by this indicator:
First, normal indicators introduce a lot of false signals due to their noisy signal line. Second, to compensate for the noise, one would normally try to add some smoothing. But this only results in adding more delay to the indicator, which makes it almost useless. Third, standard indicators require a length adjustment to derive reliable signals. However, you never know how to set the right length.
All three problems described above are solved by the developed adaptive cyclic algorithm.
The above chart shows current Bitcoin 4h data from the last days as of writing with the proposed signal reading for this indicator. The standard momentum indicator is included for comparison.
HOW TO USE
The indicator works without any parameter and can be applied to any chart and any time-frame. It will adapt automatically to the Dominant Cycle and use the dominant cycle of the source data to derive the ultra smooth momentum curve. Adaptive upper/lower bands are included and highlight areas with extreme readings. Automatic divergence detection can be turned off/on.
HOW TO READ
The indicator can be used like any oscillator. In addition, it provides adaptive high and low bands.
* Look for turns above the upper/lower bands
* Look for divergences between source and signals line
Further reading/Original source:
The indicator uses the dominant cycle to optimize signal, smoothing and cyclic memory. To get more in-depth information on the Cycle Swing Indicator, please read Chapter 10 "Cycle Swing Indicator: Trading the swing of the dominant cycle" of the book "Decoding the Hidden Market Rhythm, Part 1" available at your favorite book store.
Related ideas:
Please also check the cyclic RSI indicator which also uses cyclic information to improve the signal.
CSPDMost Advanced & Accurate CandleStick Pattern Detector
Looking All Over of All Markets for All Important Powerful Reversal | Corrective Patterns (25 type)
Filtering the Results with Optional Features like Oscillator, Bollinger Bands, Volume Confirmation, Prior and Following Candles Confirmation which are Fully Customizable.
With this you can detect:
Hammer | Shooting star
Inverted Hammer | Hanging
Long legged Doji | Dragonfly Doji | Gravestone Doji
Bullish tweezers | Bearish tweezers
Bullish inside bar | Bearish inside bar
Bullish three line strike | Bearish three line strike
Bullish engulfing | Bearish engulfing
Piercing line | Dark cloud cover
Bullish abandoned baby | Bearish abandoned baby
Morning star | Evening star
Three white soldiers | Three black crows
*Bullish kayo | *Bearish kayo
Features:
Prior and Following candles Confirmation
You can set prior and following candle as basic prerequisites for marking candles as pattern to make sure you are at the top or bottom of the trend.
Volume confirmation
You can active volume increasing confirmation for some of pattern with adjustable increase % relative to prior candle | candles.
Oscillator Confirmation
Active oscillator confirmation. Select your approved oscillator from list (Stochastic, RSI, StochRSI, MFI, StochMFI) then enter desired value for marking candles as bullish | bearish pattern.
Bollinger Bands Confirmation
Active BB confirmation. Configure your Bollinger Bands. Now only see the patterns which reached or crossed from Bands. Also you can enable BB clod to have your BB indicator at the same time.
Adjustable Flexibility and Precision
You can set tolerance% for Osc and BB Confirmation - each one separately - for more control.
Self-adaptability
The properties of markets change over time, for example the amplitude of fluctuations and the intensity of movements. The script is designed in such a way that you can examine the price history as a benchmark for changes in market properties to adopt determinants. Also you can control those manually.
Self-regulatory
The user has the ability to change input factors depending on their point of view.
Behind the pattern recognition algorithms, there are relationships and similarities in their appearance that cause them to be influenced by each other. Simultaneously with changing the determining factors of each pattern by you, script automatically adjusts other details in accordance with your changes.
Alerts
You can set for type of pattern or each one of pattern have been detected.
Fully Costumizable
All of these options can be change and adjust.
Note 1.
The patterns are based on extensive study of reference and famous sources and the experience of me and my friends in trading and analysis with price action methods.
Note 2.
Due to the Pine limitations in the number of outputs | plots for each script, our attempt has been made to select the best and most important patterns.
Note 3.
So far, many scripts have been written in this field, but our experience with all of them and even the build in version was not satisfactory, and this was the initial motivation for making the script.
We strive to improve progress and elimination of shortcomings and we will continue to make this better.
Note 4.
Through personal experience and based on the principles of market and candlestick psychology, we discovered a new type of pattern and named it as Kayo.
kayo is a two candle pattern which formed when:
1.We have a pivot point with prior candles as left bars and following candles as right bar. Pivot candle called as second candle.
2.In a bullish kayo, first candle must closed descending and second candle must closed as ascending. For bearish kayo vise versa.
3.In a bullish kayo, second candle's lower wick must be longer then upper wick.
4. A pattern marked as kayo when its conditions do not correspond to any of the other patterns(include the confirmation that user added), ie it has the last naming priority over the other patterns.
Note 5.
When you active confirmation options for patterns like hammer, engulf and etc which they conditions are like kayo in some extent, if they can't pass the confirmation steps, they can be marked as kayo pattern.
Note 6.
If you active volume confirmation for Three white soldiers | Three black crows, the confirmation get passed if the volume of forth or third candle increased as value as entered relative to volume EMA3 of 3 candles.
Note 7.
In a bullish pattern all highs of following candles MUST be higher than prior highs and all lows of following candles MUST be higher than prior lows. For bearish patterns vise versa.
This type of confirmation depends on High and Low NOT close!
Gift to price action lovers!
Support us with your like and comments. let us know your experience, points and idea to make this better together.
Heavy CandleHeavy Candle compares current candle size to its previous, the one before that and different Average True Ranges. The point is to objectively highlight a sizeable candle to enter the market with. The direction is based on if the close is above VWAP or below it.
To plot a signal, the new candle has to:
►Oversize previous candle times multiplier 1 one OR the candle before that times multiplier 1.
►Be higher than at least two Average True Ranges.
There is no built-in algorithm to judge the character of where the signal appears and of what quality it is. It can be used as a non-subjective entry trigger but only in conjunction with other analysis.
Traders are free to adapt the script to their needs and change the code as they see fit. Just mention me if you decide to make it public.
Aggregate CandlesThis script creates candles based on an aggregated Index price from various exchange tickers. A lot of exchanges have specific flash crash wicks, missing data, erraticness compared to other exchanges particularly in their first few months, this is an attempt to clean up the price history, be it for TA ( trendlines , S/R etc.) or use in algos or other indicators, without reliance on one exchange. It uses the new Array functionality to generate median and averages, and is entirely original work. This particular version is a generic version of the BTC version. Please read the header before use, and if you do wish to use the code, please ask permission first.
[blackcat] L2 Ehlers Hilbert Channel Breakout Trading SystemLevel: 2
Background
John F. Ehlers introuced Hilbert Channel Breakout Trading System in Nov, 2000.
Function
This indicator will show how the adaptive filter is being applied to a trading strategy. After the Hilbert Channel Breakout Signal is optimized, set the inputs for this indicator to match the corresponding inputs for the signal.
In the March 2000 STOCKS & COMMODITIES, John Ehlers published a algorithm for the Hilbert cycle period, an indicator that plots the length of the current market cycle. The Hilbert transform achieved computational efficiency by using a two-dimensional numbering system. Unfortunately, this introduces amplitude error in calculating the quadrature component. Dr. Ehlers compensated for this error. He have updated the method of compensating for the amplitude error by applying a straight-line compensation term using the frequency calculation from one bar ago. This is possible because the cycle period cannot change drastically from bar to bar. The slowly varying cycle period is adequate to do a good job of amplitude compensation.
In addition, Dr. Ehlers have used a different way to compute the cycle period. He used a homodyne discriminator because it exhibits superior performance in a low signal-to-noise environment. Homodyne means he used the signal multiplied by itself one bar ago to produce a zero-frequency beat note. This beat note carries the phase angle of the one-bar change. Still using the basic definition of a cycle, the one-bar rate of change of phase is exactly the cycle period.
Here is the pine v4 code to generate the signals in the Hilbert channel breakout trading system, as discussed in Dr. Ehlers article in this issue, "Optimizing With Hilbert Indicators." The signal itself is a simple channel breakout system that generates buy and exit signals, that shows whether the system is long or flat; the high of the bar and the value of the entry channel; and the low of the bar and the value of the exit channel. This helps you see on a bar-by-bar basis exactly how the system is behaving.
Key Signal
longcond--> when high breakouts EntryChannel to long
shortcond--> when low breakouts ExitChannel to short
Pros and Cons
100% John F. Ehlers definition translation, even variable names are the same. This help readers who would like to use pine to read his book.
Remarks
The 66th script for Blackcat1402 John F. Ehlers Week publication.
I tested it and believe it work better in small time frame e.g. 15m than large time frames.
Readme
In real life, I am a prolific inventor. I have successfully applied for more than 60 international and regional patents in the past 12 years. But in the past two years or so, I have tried to transfer my creativity to the development of trading strategies. Tradingview is the ideal platform for me. I am selecting and contributing some of the hundreds of scripts to publish in Tradingview community. Welcome everyone to interact with me to discuss these interesting pine scripts.
The scripts posted are categorized into 5 levels according to my efforts or manhours put into these works.
Level 1 : interesting script snippets or distinctive improvement from classic indicators or strategy. Level 1 scripts can usually appear in more complex indicators as a function module or element.
Level 2 : composite indicator/strategy. By selecting or combining several independent or dependent functions or sub indicators in proper way, the composite script exhibits a resonance phenomenon which can filter out noise or fake trading signal to enhance trading confidence level.
Level 3 : comprehensive indicator/strategy. They are simple trading systems based on my strategies. They are commonly containing several or all of entry signal, close signal, stop loss, take profit, re-entry, risk management, and position sizing techniques. Even some interesting fundamental and mass psychological aspects are incorporated.
Level 4 : script snippets or functions that do not disclose source code. Interesting element that can reveal market laws and work as raw material for indicators and strategies. If you find Level 1~2 scripts are helpful, Level 4 is a private version that took me far more efforts to develop.
Level 5 : indicator/strategy that do not disclose source code. private version of Level 3 script with my accumulated script processing skills or a large number of custom functions. I had a private function library built in past two years. Level 5 scripts use many of them to achieve private trading strategy.
[blackcat] L2 Ehlers DC using the HomoDyne DiscriminatorLevel: 2
Background
John F. Ehlers introuced Measuring the Dominant Cycle using the HomoDyne Discriminator in his "Cycle Analytics for Traders" chapter 14 on 2013.
Function
With Hilbert transformer, the third algorithm for computing the dominant cycle is the homodyne approach. Homodyne means the signal is multiplied by itself. More precisely, we want to multiply the signal of the current bar with the complex value of the signal one bar ago. The complex conjugate is, by definition, a complex number whose sign of the imaginary component has been reversed.
Key Signal
DomCycle --> Dominant Cycle
Pros and Cons
100% John F. Ehlers definition translation, even variable names are the same. This help readers who would like to use pine to read his book.
Remarks
The 61th script for Blackcat1402 John F. Ehlers Week publication.
Readme
In real life, I am a prolific inventor. I have successfully applied for more than 60 international and regional patents in the past 12 years. But in the past two years or so, I have tried to transfer my creativity to the development of trading strategies. Tradingview is the ideal platform for me. I am selecting and contributing some of the hundreds of scripts to publish in Tradingview community. Welcome everyone to interact with me to discuss these interesting pine scripts.
The scripts posted are categorized into 5 levels according to my efforts or manhours put into these works.
Level 1 : interesting script snippets or distinctive improvement from classic indicators or strategy. Level 1 scripts can usually appear in more complex indicators as a function module or element.
Level 2 : composite indicator/strategy. By selecting or combining several independent or dependent functions or sub indicators in proper way, the composite script exhibits a resonance phenomenon which can filter out noise or fake trading signal to enhance trading confidence level.
Level 3 : comprehensive indicator/strategy. They are simple trading systems based on my strategies. They are commonly containing several or all of entry signal, close signal, stop loss, take profit, re-entry, risk management, and position sizing techniques. Even some interesting fundamental and mass psychological aspects are incorporated.
Level 4 : script snippets or functions that do not disclose source code. Interesting element that can reveal market laws and work as raw material for indicators and strategies. If you find Level 1~2 scripts are helpful, Level 4 is a private version that took me far more efforts to develop.
Level 5 : indicator/strategy that do not disclose source code. private version of Level 3 script with my accumulated script processing skills or a large number of custom functions. I had a private function library built in past two years. Level 5 scripts use many of them to achieve private trading strategy.
[blackcat] L2 Ehlers DC using the Phase AccumulationLevel: 2
Background
John F. Ehlers introuced Measuring the Dominant Cycle using the Phase Accumulation in his "Cycle Analytics for Traders" chapter 14 on 2013.
Function
With Hilbert transformer, the next algorithm to compute the dominant cycle is the phase accumulation method. The phase accumulation method of computing the dominant cycle is perhaps the easiest to comprehend. In this technique, we measure the phase at each sample by taking the arctangent of the ratio of the quadrature component to the in-phase component. A delta phase is generated by taking the difference of the phase between successive samples. At each sample we can then look backwards, adding up the delta phases. When the sum of the delta phases reaches 360 degrees, we must have passed through one full cycle, on average. The process is repeated for each new sample.
The phase accumulation method of cycle measurement always uses one full cycle's worth of historical data. This is both an advantage and a disadvantage. The advantage is the lag in obtaining the answer scales directly with the cycle period. That is, the measurement of a short cycle period has less lag than the measurement of a longer cycle period. However, the number of samples used in making the measurement means the averaging period is variable with cycle period. Longer averaging reduces the noise level compared to the signal. Therefore, shorter cycle periods necessarily have a higher output signal-to-noise ratio.
Key Signal
DomCycle --> Dominant Cycle
Pros and Cons
100% John F. Ehlers definition translation, even variable names are the same. This help readers who would like to use pine to read his book.
Remarks
The 60th script for Blackcat1402 John F. Ehlers Week publication.
Readme
In real life, I am a prolific inventor. I have successfully applied for more than 60 international and regional patents in the past 12 years. But in the past two years or so, I have tried to transfer my creativity to the development of trading strategies. Tradingview is the ideal platform for me. I am selecting and contributing some of the hundreds of scripts to publish in Tradingview community. Welcome everyone to interact with me to discuss these interesting pine scripts.
The scripts posted are categorized into 5 levels according to my efforts or manhours put into these works.
Level 1 : interesting script snippets or distinctive improvement from classic indicators or strategy. Level 1 scripts can usually appear in more complex indicators as a function module or element.
Level 2 : composite indicator/strategy. By selecting or combining several independent or dependent functions or sub indicators in proper way, the composite script exhibits a resonance phenomenon which can filter out noise or fake trading signal to enhance trading confidence level.
Level 3 : comprehensive indicator/strategy. They are simple trading systems based on my strategies. They are commonly containing several or all of entry signal, close signal, stop loss, take profit, re-entry, risk management, and position sizing techniques. Even some interesting fundamental and mass psychological aspects are incorporated.
Level 4 : script snippets or functions that do not disclose source code. Interesting element that can reveal market laws and work as raw material for indicators and strategies. If you find Level 1~2 scripts are helpful, Level 4 is a private version that took me far more efforts to develop.
Level 5 : indicator/strategy that do not disclose source code. private version of Level 3 script with my accumulated script processing skills or a large number of custom functions. I had a private function library built in past two years. Level 5 scripts use many of them to achieve private trading strategy.