close price numberIn this script, we're creating a custom indicator to plot the previous day's closing price on the chart. This script retrieves the previous day's close using ta.change(time('d')) function. Then, it checks the value of the previous day's close and determines the increment accordingly input . Finally, it calculates the current day's close by adding the increment to the previous day's close and plots it on the chart.
The script can be integrated into a trading strategy to generate buy or sell signals based on the crossing closing price+increment line ...
Psychological Levels: previous day close price + increment numbers tend to have psychological significance in trading. Traders often pay attention to these levels because they represent key price levels that are easy to remember and widely recognized. When the price approaches these levels, traders may anticipate increased buying or selling pressure, leading to potential support or resistance.
For take profit and stop loss -Trader can use this as a take profit level on every previous day close+increment or close-decrement
buy signal-
1)whenever price cross any previous day close+number it give buy signal
2) i am using ma for filter buy signal we can enable and disable that function from input
sell signal-
1)whenever price cross any previous day close-number it give sell signal
2) i am using ma for filter sell signal we can enable and disable that function from input
SNR
Multi Timeframe Support and Resistance [ABA Invest]About
Automatic level of support and resistance ( SnR ) in the chart. It helps users to decide where is the level of SnR and also optimize the level by changing the input base on their needs
Input:
Pivot - The number of bars left and right side of the pivot to choose how detailed the SnR level
Type - To draw the line on the candle wick endpoints or body
Timeframes option - you can choose to display other timeframes beside the current chart timeframe
Adaptive moving average - to help users identify breaks of the SnR level with the moving average line
Line length - length of the moving average line if you activate the adaptive moving average option
How to use:
Attach the indicator to the chart and then you will find the red and green lines. Red line work as resistance level and green line works as support level and also you can merge adjacent line levels into an area of SnR.
The Adaptive moving average (AMA) line function is to see the break of SnR level and prepare for the setup.
Buy setup: AMA line break resistance level, when the price retest the support (the previous break resistance) we can enter buy trade
Sell setup: AMA line break support level, when the price retest the resistance (the previous break support) we can enter sell trade
Note: Don’t blindly follow the AMA trend signal
[blackcat] L2 Ehlers Enhanced Signal to Noise IndicatorLevel: 2
Background
John F. Ehlers introuced another Enhanced Signal to Noise Indicator in his "Rocket Science for Traders" chapter 8.
Function
blackcat L2 Ehlers Signal to Noise Indicator is used to measure Signal-to-Noise Ratio (SNR). In this code, the period of the measured dominant cycle is calculated in exactly the same manner as we calculated it for the Primary SNR Indicator. Near the end of the code, after the dominant cycle is determined, Dr. Ehlers computes the SNR. The Quadrature component Q3 is calculated by multiplying the 2-bar momentum of the Weighted Moving Average (WMA) smoothing by the dominant cycle amplitude correction factor.
Key Signal
Smooth --> 4 bar WMA w/ 1 bar lag
Detrender --> The amplitude response of a minimum-length HT can be improved by adjusting the filter coefficients by
trial and error. HT does not allow DC component at zero frequency for transformation. So, Detrender is used to remove DC component/ trend component.
Q1 --> Quadrature phase signal
I1 --> In-phase signal
Period --> Dominant Cycle in bars
SNR --> Signal-to-Noise Ratio
Pros and Cons
100% John F. Ehlers definition translation of original work, even variable names are the same. This help readers who would like to use pine to read his book. If you had read his works, then you will be quite familiar with my code style.
Remarks
The 6th 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 Signal to Noise IndicatorLevel: 2
Background
John F. Ehlers introuced Signal to Noise Indicator in his "Rocket Science for Traders" chapter 8. Dr. Ehlers terms the case where half the average daily trading range is equal to the signal amplitude as our zero decibel Signal-to-Noise Ratio (0 dB SNR) condition. He wants the signal amplitude to be at least twice the noise amplitude (6dB SNR) so that there exists a reasonable chance to make a profit from the chart analysis.
Function
blackcat L2 Ehlers Signal to Noise Indicator is used to measure Signal-to-Noise Ratio (SNR). The SNR in decibels is calculated in a single line of code near the end. The signal power is divided by the noise power to get a power ratio. The logarithm of the power ratio. At 0 dB, the peak-to-peak noise signal is twice the amplitude of the signal. Therefore, when we compute the 0 dB case, the ratio is calculated to be 10*log(1/2)^2 = -6 dB. We must then add 6 dB back into the computation to remove this bias, establishing the definition of 0 dB SNR.
Key Signal
Smooth --> 4 bar WMA w/ 1 bar lag
Detrender --> The amplitude response of a minimum-length HT can be improved by adjusting the filter coefficients by
trial and error. HT does not allow DC component at zero frequency for transformation. So, Detrender is used to remove DC component/ trend component.
Q1 --> Quadrature phase signal
I1 --> In-phase signal
Period --> Dominant Cycle in bars
SNR --> Signal-to-Noise Ratio
Pros and Cons
100% John F. Ehlers definition translation of original work, even variable names are the same. This help readers who would like to use pine to read his book. If you had read his works, then you will be quite familiar with my code style.
Remarks
The 5th 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.
True Strong Classical Support/Resistance LevelsThis script is based on the approach of filtering signals by checking higher timeframes.
So basically setting higher numbers in "Strength Of Levels" option, will make the indicator check for support and/or resistance levels in timeframes higher than the current.
Unfortunately, I was forced to still use inefficient built-in functions pivothigh() and pivotlow(). I hope they fix them up soon!
I'm looking for any opinion about the idea and if you like any of my scripts, anything you send means a lot to me.
This script is published for the third time because of some moderators absurd behavior.
But thank heavens, the code is now more clean and of course the option "Strength Of Levels" accepts float numbers.
Ehlers Enhanced Signal To Noise Ratio [CC]The Enhanced Signal To Noise Ratio was created by John Ehlers (Rocket Science For Traders pgs 87-88) and this is my favorite Ehlers Signal To Noise Ratio indicator. Scalpers like to use this indicator because when it is above the dotted line then the stock is trending and not trading sideways. Buy when the indicator line is green and sell when it is red.
Let me know when you want to see me publish other indicators or if you want something custom done!
Ehlers Alternate Signal To Noise Ratio [CC]The Alternate Signal To Noise Ratio was created by John Ehlers (Rocket Science For Traders pgs 84-85) and this is a variation of his signal to noise ratio that some scalpers might find more useful than his default signal to noise ratio. You would want to buy and sell when the indicator is above the dotted line because that means the stock is volatile enough to maximize any movement of the trade in either direction. Buy when the indicator line is green and sell when it is red.
Let me know if there are other indicators you would like to see me publish or if you want something custom done!
Hidden Supports & Resistances + Round LevelsIf you search the internet, you won't find much about these types of resistance and support levels. Hidden levels are SnR levels calculated based on some psychological patterns and sometimes it's unbelievable that the chart responds to these levels.
So use the indicator and check the idea.
Classical Supports & ResistancesThis indicator shows classical resistance and support levels which retraced the chart lately. Notice that the condensed lines laying close together are showing an area of support and/or resistance.
But after all, it was a tedious work creating this indicator because like I've already said, pine script is a very odd and weak language which does not have many ordinary features like useful loops, simple line drawing and even reasonable variable casting!
So I was forced to use its built-in pivothigh() and pivotlow() functions without any handy documentation. I assume that even these functions don't work as expected, and because of that, I embedded "Sensitivity" and "Lookback Time" options in the indicator as a workaround.
Feel free to use it and send me your comments/solutions.
Ehlers Signal To Noise Ratio [CC]The Signal To Noise Ratio was created by John Ehlers (Rocket Science For Traders pgs 81-82) and this indicator is perfect for all of the scalpers out there! This will let you know when the stock is at a high volatility or not and when to buy or sell. If the indicator crosses over the dotted line then that means the stock is volatile and it is trading flat then it will be below the dotted line. Buy when the indicator line is green and sell when it is red.
This was a custom request so let me know if there are any other scripts you would like me to publish or if you want something custom done!
Signal To Noise Ratio IndicatorThis is a trend indicator at its core so combine with rsi or a moving average of your choice to see which direction the stock is trending in.
Only enter a position (long or short) when signal to noise ratio is above the signal line
This is one of my first indicators posted on here so be sure to leave me feedback
[CS] AMA Strategy - Channel Break-Out"There are various ways to detect trends with moving averages. The moving average is a rolling filter and uptrends are detected when either the price is above the moving average or when the moving average’s slope is positive.
Given that an SMA can be well approximated by a constant-α AMA, it makes a lot of sense to adopt the AMA as the principal representative of this family of indicators. Not only it is potentially flexible in the definition of its effective lookback but it is also recursive. The ability to compute indicators recursively is a very big positive in latency-sensitive applications like high-frequency trading and market-making. From the definition of the AMA, it is easy to derive that AMA > 0 if P(i) > AMA(i-1). This means that the position of the price relative to an AMA dictates its slope and provides a way to determine whether the market is in an uptrend or a downtrend."
You can find this and other very efficient strategies from the same author here:
www.amazon.com
In the following repository you can find this system implemented in lisp:
github.com
To formalize, define the upside and downside deviations as the same sensitivity moving averages of relative price appreciations and depreciations
from one observation to another:
D+(0) = 0 D+(t) = α(t − 1)max((P(t) − P(t − 1))/P(t − 1)) , 0) + (1 − α(t − 1))D+(t − 1)
D−(0) = 0 D−(t) = −α(t − 1)min((P(t) − P(t − 1))/P(t − 1)) , 0)+ (1 − α(t − 1))D−(t − 1)
The AMA is computed by
AMA(0) = P(0) AMA(t) = α(t − 1)P(t) + (1 − α(t − 1))AMA(t − 1)
And the channels
H(t) = (1 + βH(t − 1))AMA(t) L(t) = (1 − βL(t − 1))AMA(t)
For a scale constant β, the upper and lower channels are defined to be
βH(t) = β D− βL(t) = β D+
The signal-to-noise ratio calculations are state dependent:
SNR(t) = ((P(t) − AMA(t − 1))/AMA(t − 1)) / β D−(t) IfP(t) > H(t)
SNR(t) = −((P(t) − AMA(t − 1))/AMA(t − 1)) / β D−(t) IfP(t) < L(t)
SNR(t) = 0 otherwise.
Finally the overall sensitivity α(t) is determined via the following func-
tion of SNR(t):
α(t) = αmin + (αmax − αmin) ∗ Arctan(γ SNR(t))
Note: I added a moving average to α(t) that could add some lag. You can optimize the indicator by eventually removing it from the computation.
Signal to Noise Ratio [SNR]Intro
This script measures the Signal to Noise ratio of a security and plots it in deciBels scale!
Usage
Ideally, you would want the ratio to be above 10 dB, meaning the Signal strength is 10x the noise strength.
As a baseline, you should not rely on indicators that use any kind of moving average if the SNR is below 6 dB - meaning Signal strength is only 4x noise strength.
I've written the SNR as a functional block so you may simply copy and paste, then call getSNR() to get the ratio in dB.
Principle
I consider a bar's High and Low to be the range of that period and (High + Low)/2 to be the "real" value of the signal.
This script compares a bars range (noise) to the perceived signal using a Hilbert Transform.
Cheers,
DasanC