Custom Price Levels and AveragesThe "Custom Price Levels and Averages" indicator is a versatile tool designed for TradingView. It dynamically calculates and displays key price levels based on user-defined parameters such as distance percentages and position size. The indicator plots three ascending and descending price levels (A, B, C, X, Y, Z) around the last candle close on a specified timeframe. Additionally, it provides the average price for both upward and downward movements, considering the user's specified position size and increase factor. Traders can easily customize the visual appearance by adjusting colors for each plotted line. This indicator assists in identifying potential support and resistance levels and understanding the average price movements within a specified trading context.
Avoid SL hunting by acumulating your position with scaled orders.
Input Parameters:
inputTimeframe: Allows the user to select a specific timeframe (default: "D" for daily).
distancePercentageUp: Determines the percentage increase for ascending price levels (default: 1.5%).
distancePercentageDown: Determines the percentage decrease for descending price levels (default: 1.5%).
position: Specifies the position size in USD for calculating average prices (default: $100).
increaseFactor: Adjusts the increase in position size for each subsequent level (default: 1.5).
calcAvgPrice Function:
Parameters:
priceA, priceB, priceC: Ascending price levels.
priceX, priceY, priceZ: Descending price levels.
position: User-defined position size.
increaseFactor: User-defined increase factor.
Calculation:
Calculates the weighted average price for ascending (priceA, priceB, priceC) and descending (priceX, priceY, priceZ) levels.
Utilizes the specified position size and increase factor to determine the weighted average.
Plotting:
Price Calculations:
priceA, priceB, priceC: Derived by applying percentage increases to the last candle's close.
priceX, priceY, priceZ: Derived by applying percentage decreases to the last candle's close.
avgPriceUp, avgPriceDown: Computed using the calcAvgPrice function for ascending and descending levels, respectively.
Plotting Colors:
User-customizable through input parameters (colorPriceA, colorPriceB, colorPriceC, colorAvgPriceUp, colorPriceX, colorPriceY, colorPriceZ, colorAvgPriceDown).
Styling:
All lines are plotted with minimal thickness (linewidth=1) for a clean visualization.
Overall, the indicator empowers traders to analyze potential support and resistance levels and understand average price movements based on their specified parameters. The flexibility of color customization adds a layer of personalization to suit individual preferences.
Scaled
Scaled Order Sizing and Take Profit Target ArraysWOAH Order Scaling!
This Provides a user with methods to create a list of profit targets and order sizes which grow or shrink. For size, the will add up to specific sum. for Targets they will include the first and last, and can lean towards either, to scale the order grid.
And thanks to @Hoanghetti for the markdown, i've included a basic usage example within the hover , o you don't need to search for the usage example, simply import, and when writing, the code hint contains a full example.
scaled_sizes(total_size, count, weight, min_size, as_percent)
create an array of sizes which grow or shrink from first to last
which add up to 1.0 if set the as_percent flag , or a total value / sum.
Parameters:
total_size : (float) total size to divide ito split
count : (int ) desired number of splits to create
weight : (float) a weight to apply to grow or shrink the split either towards the last being most, or the first being most, or 1.0 being each is equally sized as 1/n count
min_size : (float) a minimum size for the smallest value (in value of ttotal_size units)
as_percent : (float) a minimum size for the smallest value (in value of total_size units)
Returns: Array of Sizes for each split
scaled_targets(count, weight, minimum, maximum)
create a list of take profitt targets from the smallest to larget distance
Parameters:
count : (int ) number of targets
weight : (float) weight to apply to growing or shrinking
minimum : (float) first value of the output
maximum : (float) last value of the output
Returns: Array of percentage targets
On Balance Volume Scaled - OBV ScaledThe main idea of this oscillator is to place the OBV oscillator and its oscillation around the range of 0 and around -50 to +50 and for this scaling of the "On Balance Volume" oscillator, I have used Min-max normalization.
Since this oscillator does not have a specific minimum and maximum, just setting the maximum and minimum does not seem the best thing to do. As in this case, we will constantly observe sudden changes and we will have problems such as volatility. On the one hand, we will constantly deal with sudden changes and problems such as volatility. Also on the other hand, the continuous collisions of the high/low(+50 & -50) and index and returning from that is another thing that we are going to deal with.
Therefore, to solve these problems and create more flexible maximum and minimum ranges, another similar method has been used. Choosing the maximum of our normalization to the size of the moving average of 100 candles of the index maximum and choosing the minimum of normalization to the size of the moving average of 100 candles of the minimums of the OBV index, and then normalizing the OBV index with the Min-max method with those ranges, is the recommended method ,which has been used to eliminate problems. In this case, we will not have any problem hitting 50 and returning or hitting -50 and returning. Also, our scaled OBV index will have the ability to touch and cross 50 and -50 and can fluctuate without problems.
Ehlers Deviation Scaled Super Smoother [CC]The Deviation Scaled Super Smoother was created by John Ehlers and this is an excellent moving average that changes direction very quickly and can keep up with the current underlying trend. This indicator works by applying a Hann Windowed Moving Average to the stock's momentum and scaling that by the Root Mean Square and then using that value in the input for a Super Smoother . I have included strong buy and sell signals in addition to normal ones so lighter colors are normal signals and darker colors are strong ones. Buy when the line turns green and sell when it turns red.
Let me know if there are any other scripts you would like to see me publish!
%G OscillatorIntroduction
Rescaling often involve bringing a series of values in a certain range, there have been many rescaling methods proposed in technical analysis such as the stochastic oscillator, relative strength index or the William %R to name a few. Rescaling the price allow the user to see when the security is overbought or oversold, in the case of the stochastic oscillator it can also determine the price position relative to the highest and lowest price over a user defined period window.
Computing highest and lowest over a certain period window involve calculating what is called a rolling maximum/minimum, those calculations have tried to be efficient but they can still remain relatively complex. This is why i propose a similar rescaling indicator that don't use rolling maximum/minimum for its calculation, the indicator can be interpreted like the stochastic oscillator since they are similar.
The Indicator
The indicator is based on the current price position relative to past observations, for example, if the indicator is equal to 80, this mean that the current price is greater than 80% of the k past observations, where k = 1, 2, 3...length .
The indicator offer many benefits such as a custom rescaling range, unlike the stochastic oscillator this step is directly integrated in the core calculations of the indicator, this can be done by changing the code in line 7 :
a = src > src ? Max : Min
where Max should be the maximum value of the indicator and Min the minimum value, therefore the indicator would lay in a range of (Max,Min).
here the indicator is in a range of (5,2), this mean that :
a = src > src ? 5 : 2
Conclusion
I proposed an alternative to the stochastic oscillator. Both indicators return similar results, advantages of the proposed indicators are its simple calculation and its ability to return custom ranges. I hope it find its use in the community.
Thanks for reading !
Turbo Scaler - The Art Of Being (too) EarlyIntroduction
Fast smooth indicators that produce early signals can sound utopic but mathematically its not a huge deal, the effect of early outputs based on smooth inputs can be seen on differentiators crosses, this is why i propose this indicator that aim to return extra fast signals based on a slightly modified max-min normalization method. The indicator introduce inherent smoothing without having an huge impact on the indicator reactivity.
The Indicator
The indicator is based on max-min normalization (like the stochastic oscillator) however instead of using the highest/lowest of the input we use the highest and lowest of the moving average of the input. This process using as input the closing price and the moving average closing price will return two lines, and because of the nature of max-min normalization we can see that the trigger line (in orange) produce earlier crosses. length control the highest/lowest period while smooth control the output lines smoothness (50 by default).
alpha control the scaling amount, with higher values of alpha creating more constrained scale, when alpha = 1 the scale is in a range of (0,1) while lower values of alpha can make the output move more freely.
alpha = 0.25
alpha = 1
Higher values of alpha create earlier signals.
Downsides Of Early Crosses
Of course such indicator make us exposed to the trend as seen below.
We can nonetheless protect ourselves against such cases scenarios by lowering alpha.
lowering alpha allow to catch movements of the trend without loosing much reactivity at the cost of an increased umber of trades.
Possible Uses
The proposed indicator allow for an high number of uses because of its scale, reactive nature...etc. A method that allow us to go with the main trend is by taking into account the crosses between the lines and the sign of the lines, for example :
The first signal (green) happen when the main line (in blue) crossover the trigger (orange) while both are > 0, the same happen with the second signal however both lines are < 0. This method can use certain levels instead of the sign (main line crossover trigger while both > 0.7...etc).
This method is great for the indicator because such cases scenarios does not happen a lot with ranging markets, we can clearly that when trending the trigger can have the tendency to be flat and higher than 0 thus allowing for the main line to produce those signals.
Conclusion
I have presented a super reactive crosses indicator based on max-min normalization with the ability to both be smooth and produce early entries/exits signals, different methods have been presented in order to allow for different setups using this indicator.
The introduction of the alpha parameter allow for more control which is what those kind of indicators needs. I hope you find an use to it :)
Support Me
Making indicators sure is hard, it takes time and it can be quite lonely to, so i would love talking with you guys while making them :) There isn't better support than the one provided by your friends so drop me a message.
Scaled Normalized Vector Strategy, ver.4.1This modification of the Scaled Normalized Vector Strategy uses trailing stops and is optimized for lower TFs.
Scaled Normalized Vector Strategy, ver.4This is a modification of my Scaled Normalized Vector Strategy.
This mod features some activation functions. Performance remains high. The repainting problem should be tested out.
Scaled Normalized Vector StrategyThis is a scaled Normalized Vector Strategy with a Karobein Oscillator
Original: Drkhodakarami (www.tradingview.com)
Repainting: in general there two types of repainting:
* when the last candle is constantly being redrawn
* when the indicator draws a different configuration after it has been deactivated/reactivated, i.e. refreshed.
The former is a natural behaviour, which presents a constant source of frustration, when a signal directly depends on the current market situation and can be overcome with various indirect techniques like divergence.
The latter suggests a flaw in the indicator design.
Unfortunately, the Normalized Vector Strategy is repainting in the latter sense, although being really promising. Would be nice if our community suggests a solution to this problem ))
As it is this strat should be refreshed each time a decision is being taken.
This strat consistently performs with high accuracy, showing up to 96% scores. Here are some of the best parameters:
TF Lookback Performance (ca.)
1m 13 92%
3m 34 92%
5m 85 92%
15m 210 90%
30m 360 89%
1H 1440, 720 94%, 87%
The Karobein Oscillator has an intrinsic sinusoidal behaviour that helps in determining direction and timing. It does not repaint.
Original: alexgrover (www.tradingview.com)
Bilateral Stochastic Oscillator - For The Sake Of EfficiencyIntroduction
The stochastic oscillator is a feature scaling method commonly used in technical analysis, this method is the same as the running min-max normalization method except that the stochastic oscillator is in a range of (0,100) while min-max normalization is in a range of (0,1). The stochastic oscillator in itself is efficient since it tell's us when the price reached its highest/lowest or crossed this average, however there could be ways to further develop the stochastic oscillator, this is why i propose this new indicator that aim to show all the information a classical stochastic oscillator would give with some additional features.
Min-Max Derivation
The min-max normalization of the price is calculated as follow : (price - min)/(max - min) , this calculation is efficient but there is alternates forms such as :
price - (max - min) - min/(max - min)
This alternate form is the one i chosen to make the indicator except that both range (max - min) are smoothed with a simple moving average, there are also additional modifications that you can see on the code.
The Indicator
The indicator return two main lines, in blue the bull line who show the buying force and in red the bear line who show the selling force.
An orange line show the signal line who represent the moving average of the max(bull,bear), this line aim to show possible exit/reversals points for the current trend.
Length control the highest/lowest period as well as the smoothing amount, signal length control the moving average period of the signal line, the pre-filtering setting indicate which smoothing method will be used to smooth the input source before applying normalization.
The default pre-filtering method is the sma.
The ema method is slightly faster as you can see above.
The triangular moving average is the moving average of another moving average, the impulse response of this filter is a triangular function hence its name. This moving average is really smooth.
The lsma or least squares moving average is the fastest moving average used in this indicator, this filter try to best fit a linear function to the data in a certain window by using the least squares method.
No filtering will use the source price without prior smoothing for the indicator calculation.
Relationship With The Stochastic Oscillator
The crosses between the bull and bear line mean that the stochastic oscillator crossed the 50 level. When the Bull line is equal to 0 this mean that the stochastic oscillator is equal to 0 while a bear line equal to 0 mean a stochastic oscillator equal to 100.
The indicator and below a stochastic oscillator of both period 100
Using Levels
Unlike a stochastic oscillator who would clip at the 0 and 100 level the proposed indicator is not heavily constrained in a range like the stochastic oscillator, this mean that you can apply levels to trigger signals
Possible levels could be 1,2,3... even if the indicator rarely go over 3.
Its then possible to create strategies using such levels as support or resistance one.
Conclusion
I've showed a modified stochastic oscillator who aim to show additional information to the user while keeping all the information a classical stochastic oscillator would give. The proposed indicator is no longer constrained in an hard range and posses more liberty to exploit its scale which in return allow to create strategies based on levels.
For pinescript users what you can learn from this is that alternates forms of specific formulas can be extremely interesting to modify, changes can be really surprising so if you are feeling stuck, modifying alternates forms of know indicators can give great results, use tools such as sympy gamma to get alternates forms of formulas.
Thanks for reading !
If you are looking for something or just want to say thanks try to pm me :)
Smoothed Delta's Ratio OscillatorIntroduction
Scaled and smoothed oscillators can provide easy to read/use information regarding price, therefore i will introduce a new oscillator who create smooth results and use a fast and practical scaling method. In order to allow for even more smoothness the option to smooth the input with a lsma has been added.
Scaling Using Changes
In this indicator scaling in a range of (1,-1) is achieved through the following calculations :
a = sma(abs(change(src,length)),length)
b = change(sma(src,length),length)
c = b/a
where src is our input. The two elements a and b are quite similar, a smooth the absolute change of the input over length period while b calculate the change of the smoothed input over length period, this make a > b and able us to perform scaling in a range of (1,-1).
The Indicator Parameters
Length control the differencing/smoothing period of the indicator, greater values create smoother and less volatile results, this mean that the oscillator will tend to be equal to 1 or -1 in a longer period of time if length is high. The smooth option allow for even smoother results by enabling the input to be smoothed by a lsma of length period.
Conclusions
I presented a smooth oscillator using a new rescaling technique. Parameters can be separated to provide different results, i believe the code is simple enough for everyone to modify it in order to provide interesting creations.
Ehlers Fisherized Deviation-Scaled OscillatorEhlers Fisherized Deviation-Scaled Oscillator script.
This indicator was originally developed by John F. Ehlers (Stocks & Commodities V. 36:11: Probability - Probably A Good Thing To Know).