OPEN-SOURCE SCRIPT

CCI/MFI/VZO/RSI - HEATMAP

Aggiornato
Heatmap I made/reverse engineered.

Currently tracks the 4 following oscillators:
- CCI (Channel Commodity Index)
- MFI (Money Flow Index)
- VZO (Volume Zone Oscillator)
- RSI (Relative Strength Index)

Any feedback or suggestions highly appreciated.

/* Inspiration taken from ByzantineGeneral (TradingView profile: /u/ByzantineGeneral, indicator: /script/keAGdnWO-Byzantium-Oscillator-Heatmap) */
Note di rilascio
Clarified user input.

- Changed levels (editable = false) -> These where transparent 100% anyways so made the input screen unorganized.
- Changed plot (editable = false) -> These where transparent 100% anyways so made the input screen unorganized.

Only the inputs that have visual difference are now being shown i.e the fill colors
Note di rilascio
New version because the screenshot of showing the indicator was not sized properly.
Note di rilascio
VERSION 1.4

On request, I added buy/long and sell/short signals dependig on certain conditions. The indicator will display those above or below the heatmap. Unfortunately, I had to add some 'whitespace' above and below the heatmap for the signals to become visible, otherwise the signals would blend in with the heatmap.

I want to keep this as a standalone indicator. If you want me to turn this into a strategy, let me know and i'll make a new script for this.
Note di rilascio
VERSION 1.5 (because why not)

CORE CHANGES:
Added color gradients instead of using if/else stacks for choosing color. Thankfully, a gradient framework was already in circulation by PineCoders
You can find the framework here:
Color Gradient Framework [PineCoders]


- Removed the two 'whitespace' horizontal lines again so it looks more clean in my opinion.
- Changed the plotchart symbols to the color white so it is visible even if the oscillator has the maximum color gradient assigned.
- Added more comments to the code for better reusability
Note di rilascio
VERSION 1.6

- Added input for customizing the colors that are used for the gradient (Default values: #0097A7, #9C27B0 - Bullish, Bearish)
- Removed the Oscillator inputs and turned them into constants (Default values: 14, 28, 14, 28 - RSI, VZO, MFI, CCI )
- Removed some unnecessary code: unused color constants and colors needed for previous versions
- Reformatted the code for easier source reading and reusability
Note di rilascio
  • Version Information: The version number and author information have been removed from the code.
  • Simplified Input Colors: The user input colors are now set using the simple #RRGGBB format instead of input.color function. Additionally, the input names have been adjusted for clarity.
  • Renamed Gradient Function: The function f_c_gradientRelativePro has been removed, and the existing f_c_gradientRelative function now handles both cases of gradient color calculation.
  • Removed Redundant Constants: The color constants (C_AQUA, C_BLACK, etc.) have been removed as they were not used in the updated code.
  • Updated Horizontal Lines: The horizontal lines (h0, h1, h2, h3, h4) are now created using hline with the input values (oversoldThreshold, overboughtThreshold, etc.) directly, avoiding any redundant intermediate variables.
  • Updated Signal Conditions: The conditions for generating Long and Short signals have been modified for better performance and accuracy.
  • Signal Marker Colors: The color for the Long and Short signal markers (▲ and ▼) is now set to alertColor to be consistent with the color used in other parts of the indicator.
  • Removed Unused Commented Code: Some commented-out plotting statements have been removed from the code for better clarity and to reduce unnecessary lines.
  • Removed Gradient "center" variable: The _center variable used in the gradient function has been removed, and the calculation is directly applied within the color.from_gradient function.
  • Updated Gradient Colors: The input color names used in the gradient function are updated to match the new input names, and the gradient calculation is simplified using ternary operators.
Note di rilascio
  • Changed the default values for the oversoldThreshold and overboughtThreshold inputs from 25 and 75 to 26 and 74, respectively.
  • Updated the horizontal lines for h1 and h2 to be at levels 25 and 50, respectively.
  • Renamed the variable test to combined to reflect its actual purpose.
  • Changed the title of the plot from "Combined" to "Combined Heatmap" to provide a more descriptive name.
  • Removed the editable=false property from the horizontal lines h1, h2, h3, and h4 since editable properties are not applicable for script plots.
  • Adjusted the conditions for the enterLong and enterShort signals based on the new threshold values (26 and 74).
Note di rilascio
I have rolled out an updated version of the CCI/MFI/VZO/RSI Heatmap indicator. Here's what's new and what you can expect:

Pine Script Version
The indicator is now using Pine Script version 5, which allows us to make use of newer features and functionalities. This makes the indicator more robust and compatible with future updates.

User Inputs
The color input fields have been simplified. You no longer have to specify the type of input; the script automatically detects it based on the default value. This makes the setup process a tad quicker.

Technical Indicators
The calculation logic for RSI, VZO, MFI, and CCI remains the same. So, you can expect the same level of accuracy and performance as the previous version.

Visual Enhancements
We've added transparent horizontal lines for better visual cues. These lines will help you quickly identify the different regions of the plot, enhancing readability.

Code Efficiency
The code has been optimized for better performance, although the core functionalities remain the same.

Signals
The buy and sell signals are generated in the same manner as the previous version, keeping the strategy consistent.

New Color Scheme
The color scheme remains the same; however, the script is now more efficient in generating the gradient colors, which should result in smoother transitions.

Please note that these updates are aimed at improving the efficiency and readability of the indicator. Feel free to reach out if you have any questions or encounter any issues.
Note di rilascio

  1. Input Modification:
    In the old version, the lengths of the indicators were hardcoded. In the new version, these have been changed to user inputs, allowing for more flexibility and customization.
    Grouped related inputs together under labels like "Length", "Alert Thresholds", "Colors", and "Multi-Timeframe" for better organization and user experience.

  2. Multi-Timeframe Analysis:
    Added the ability to analyze a secondary timeframe alongside the current timeframe. This feature helps in providing a more robust analysis by considering higher timeframe data.

  3. Indicator Calculation Enhancement:
    Extended the script to include a secondary combined oscillator calculation (tf2Combined) based on the higher timeframe. This allows for dual timeframe analysis within the same script, providing a more comprehensive view.

  4. Plotting Enhancement:
    Added a new plot for the secondary combined oscillator (tf2Combined) with a distinct title and color to differentiate it from the primary combined oscillator plot.

  5. Color Input Modification:
    Introduced a new color input for the higher timeframe plot for better differentiation and user customization.

  6. Alert Color Modification:
    Changed the alert color input default value for better visibility.

  7. Explanation:

    - The shift from hardcoded values to user inputs enhances the flexibility and usability of the script.
    - The multi-timeframe analysis is a significant upgrade that allows users to analyze higher timeframe data alongside the current timeframe, which can be crucial for identifying broader market trends and making more informed trading decisions.
    - The new plot for the secondary timeframe provides a visual representation of the higher timeframe data, which, when compared to the current timeframe data, can provide a more nuanced understanding of market conditions.
    - The color modifications improve the visual aesthetics of the script, making it easier to differentiate between different plots and understand the alert signals.
Note di rilascio

  1. Multi-Timeframe Enablement:
    A significant addition is the option to enable or disable multi-timeframe analysis. This is controlled by a new input toggle named higherTfEnabled.

  2. Multi-Timeframe Color Modification:
    The color input for the higher timeframe plot has been updated to a new default color. This change makes the secondary timeframe plot more distinguishable from other plots.

  3. Multi-Timeframe Plotting:
    The secondary timeframe plot is now conditional based on the higherTfEnabled input. This allows users to toggle the secondary timeframe plot on and off, providing better control over what is displayed.

  4. Indicator Calculations:
    The calculation methodology for higher timeframe data has been streamlined by consolidating the request.security function calls within the main indicator calculations section. This change improves code readability and maintenance.

  5. Explanation:

    - The new higherTfEnabled toggle is a valuable addition for users who may not always require a multi-timeframe analysis. This feature provides a way to declutter the indicator window when needed.
    - The color modification for the higher timeframe plot ensures that users can easily differentiate between the current and higher timeframe data, improving the overall user experience.
    - Streamlining the higher timeframe data calculations by consolidating the request.security function calls makes the code more readable and easier to maintain. This is a crucial change for anyone who might want to further customize or extend the script.
Note di rilascio
Version Update Summary


This update focuses on improving the efficiency and readability of the code, without changing the core functionality of the indicator. Various parts of the code have been refactored, and common calculations are now reused.


Detailed Changes


Input Groups
  • Old: Variable-length input groups were not efficiently named.
  • New: Shortened and clarified input group names for better readability.

Utility Functions
  • Old: Repeated calculations for combined indicators.
  • New: Introduced calcCombined() function to handle the combined indicator calculation, making the code DRY (Don't Repeat Yourself).

Indicator Calculations
  • Old: Separate calls to request.security() for each higher timeframe indicator.
  • New: Batched the higher timeframe indicator calculations into a single request.security() call, improving efficiency.

Signal Definitions
  • Old: Signal conditions were verbose.
  • New: Shortened variables used in signal definitions for better readability.


What Remains Unchanged?
The core functionality and calculations remain the same.
The color schemes and alert conditions are consistent with the old version.

What Does This Mean for You?
As a user, you'll find the updated version to be functionally identical to the old one. The changes are mainly under the hood, aimed at making the code more efficient and maintainable. No action is required on your part unless you're interested in customizing the indicator further.

Feel free to dive into the new code if you're curious!
Centered OscillatorsheatmapMFIOscillatorsrsi_overboughtrsi_oversoldTrend Analysisvzo

Script open-source

In pieno spirito TradingView, l'autore di questo script lo ha pubblicato open-source, in modo che i trader possano comprenderlo e verificarlo. Un saluto all'autore! È possibile utilizzarlo gratuitamente, ma il riutilizzo di questo codice in una pubblicazione è regolato dal nostro Regolamento. Per aggiungerlo al grafico, mettilo tra i preferiti.

Vuoi usare questo script sui tuoi grafici?


Anche su:

Declinazione di responsabilità