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.
Minmax
Feature scalerFeature scaler | Pine Utilities series, ready to be used in "study-on-study" fashion |
Includes min-max, normalization, standardization and unit length scaling.
One and only source: en.wikipedia.org
Endpoint inputs allow to set an interval of interest for min-max scaler.
Can be (and should be) applied to other studies, or to the chart itself. In this example, I applied min-max scaling to weighted linear regression's slope values.
Unfortunately, "All data" is still "experimental" and works only on charts where less than 5000 bars are available. max_bars_back() didn't help.
Sup TV
Trend ExplorerAre we in a bull or a bear market?
From the technical analysis point of view, the answer is "It depends". It depends from the parameters of your indicator, the timeframe of the pair you are looking and the volatility of that specific market you are looking to.
After I experimented with various trending indicators I decided to develop a framework that potentially could "embed" already existing logic from well known indicators (e.g. Supertrend OTT etc.).
The most important part is that I managed to abstract that logic away and experiment even further to produce some more robust, market and timeframe resolution agnostic results. While at the same time I was able to switch between market and timeframe resolution specific configuration to take some decision.
Finally, I decided to share this code with you folks! Developed this indicator "Trend Explorer" in an effort to make the aforementioned abstraction of all those trending indicators.
The goal is to enable the user to explore and combine different approaches in order to create a more robust and market general/specific, timeframe resolution invariant/fluctuating and volatility auto/manual adjusted indicator according to his needs.
The logic behind the abstraction is fairly simple. The trending indicator consists of two boundary lines the "bull trend low boundary" (green) and the "bear trend high boundary" (red). The indicator also has a control line (orange). Every time the control line crosses a boundary there is a trend reversal! The boundary lines are defined by the thresholds. To be more precise, boundaries are pulled upwards by thresholds (blue) during a bull market and downwards during a bear market. I challenge the user to experiment with the different ways of calculating the thresholds and the control. I am open to suggestions that might improve and extend the possibilities of this indicator. Any feedback, comments, general thoughts or bug reports are welcome.
Why did I chose those defaults?
For threshold calculation I chose MINMAX which calculates the local minimum and maximum using a sliding window. As far as I know it is not used in any existing trending indicator, but it seems reasonable for a trader to search for local min and max to make a decision. The width of the sliding window a.k.a the "period to remember" the local min and max is 30 days by default, just because I believe that for regular people it is a reasonable period of time to forget too.
Also, compared to the SUBADD method MINMAX does not seem to lag behind, especially when using averages in the SUBADD mode. Moreover, I consider MINMAX to be more general than the margins used by the SUBADD since margins should be configured based on the underlying market volatility.
For a source of min and max I chose the low and high values just because they are timeframe resolution invariant, meaning that they have the same (not exactly due to number precision and rounding, but very close) results for a single pair whether you use "4 hour" or "1 day" time interval! Another popular choice might be (close, close) since many traders wait for the daily candle to close in order to discard outliers. However, this approach is not resolution invariant and it depends from the time interval the user has selected.
Do you have any interesting trending indicator you would like to see how it performs in this framework logic? Let me know!
Do you have in mind any variation of Control or Thresholds calculation you would like to test? Please describe it in the comments below so I can add it in my implementation for you!
Did you find any other bug or you experienced any strange behavior? PM me with a description of the bug, the trading pair the timeframe resolution the exact time (candle) and all the necessary configurations for this indicator so I can reproduce it on my machine!
Please enjoy with caution,
Jason
EMA Difference MinMax ScaledDifference between two EMAs and then transformed through a MinMax scaler