OPEN-SOURCE SCRIPT

Ema Short Long Indicator[CHE]

Обновлено
█ CONCEPTS

This Pine Script is an EMA Short Long indicator that displays the crossing EMA lines on the chart. The indicator uses three exponential moving averages (EMAs) to generate the buy and sell signals. The EMA lines are plotted as green (uptrend) and red (downtrend) lines. When the green line is above the white signal line, the indicator generates a buy signal, when the green line is below the white signal line, the indicator generates a sell signal. Arrows are also displayed marking the buy and sell signals. There is also an option to allow indicator repainting or not. Finally, users can also set alerts to be alerted to potential trading opportunities.

Note: please do not disable "time frame gaps". Allows to calculate the indicator on a Timeframe (TF) different from that of the chart Time window. The TF should ideally be higher than the charts to provide a broader perspective than
the TF of the chart. Using TFs lower than the chart's will deliver fragmentary results, since only the last value of intrabar is displayed (multiple values cannot be displayed for a single chart bar). The Gaps setting determines the behavior when the TF is higher than the TF of the chart. If 'gaps' is checked, higher TF values only come in and are interconnected on the diagram when the higher TF completed. This has the advantage of avoidance Real-time epainting. If Gaps is not enabled, Gaps are filled with the last higher TF value calculated, which will not produce a repaint Values on historical bars but repaint values realtime.

█  HOW TO USE IT

Load the indicator on an active chart (see the Help Center if you don't know how).


Time period

By default, the script uses an auto-stepping mechanism to adjust the time period of its moving window to the chart's timeframe. The following table shows chart timeframes and the corresponding time period used by the script. When the chart's timeframe is less than or equal to the timeframe in the first column, the second column's time period is used to calculate the Ema Short Long Indicator [CHE]:

Chart Time
timeframe period

1min 🠆 1H
5min 🠆 4H
1H 🠆 1D
4H 🠆 3D
12H 🠆 1W
1D 🠆 1M
1W 🠆 ​3M

█  DESCRIPTION

The script begins by setting up the chart indicator with a short title, "ESLI", and enabling it as an overlay. It then initializes several variables for time conversions, to be used later in the script.

The timeStep_translate() function converts the timeframe of the chart into a string representing a larger time interval, based on the number of seconds in the timeframe. The resulting string is used to label the horizontal axis of the chart.

Next, the script defines several input variables that can be modified by the user. These include the colors of the EMA lines and the signals, whether or not the indicator is allowed to repaint (i.e. update past values based on future data), and the number of periods used to calculate the EMA and signal lines.

The f_security() function calls the request.security() function to fetch data from the specified security and timeframe, and is used to calculate the EMA and signal lines using the ta.ema() function. The clo variable is assigned the closing price data, adjusted for repainting and timeframe.

The EMA line is calculated using a weighted average of the EMA over the specified period and two times that period, as well as three times that period, divided by six. The signal line is calculated as the EMA of the EMA line over the specified period.

The col_css variable sets the color of the EMA line based on whether it is currently above or below the signal line. The script then plots the EMA and signal lines, and uses the plotshape() function to indicate long and short signals based on the crossovers and crossunders of the EMA and signal lines.

Finally, the script sets up alert conditions using the alertcondition() function to notify the user when a long or short signal is generated, including information about the symbol and closing price.

█  SPECIAL THANKS

Special thanks to LOXX, I wanted to take a moment to express my gratitude for his valuable input in the EMA calculation. His insights and expertise have greatly helped me in improving my Pine Script coding skills. Thanks to his suggestion, I was able to better understand the EMA formula and implement it effectively in my script.

Your generosity in sharing your knowledge and experience is truly appreciated. It is through collaboration and exchanging ideas that we can all grow and become better in our craft.

This script provides exact signals that, with suitable additional indicators, provide very good results.

Best regards

Chervolino
Информация о релизе
EMA Short Long Indicator [CHE] - Comprehensive Description

Overview
The EMA Short Long Indicator [CHE] is a versatile and powerful tool designed for traders who want to utilize the Exponential Moving Average (EMA) for making informed trading decisions. This indicator provides a clear visualization of short-term and long-term trends by plotting EMAs on the chart and generating buy (Long) and sell (Short) signals. Additionally, it features customizable time periods and resolution settings to cater to different trading strategies and preferences.

Features

Customizable Time Period Display
- Show Time Period: Enable or disable the display of the current time period on the chart.
- Size: Adjust the size of the time period display text (options: tiny, small, normal, large, huge, auto).
- Positioning: Place the time period display at the top, middle, or bottom, and align it to the left, center, or right.
- Colors: Customize the background and text colors of the time period display.

Timeframe Types
- Auto Timeframe: Automatically adjusts the timeframe based on the current chart's resolution.
- Multiplier: Set a custom multiplier to adjust the resolution.
- Manual: Manually specify the desired resolution.

Color Customization
Choose colors for the following elements:
- EMA Line: Green by default.
- Signal Line: White by default.
- Long Signal Arrow: Yellow by default.
- Short Signal Arrow: Fuchsia by default.

Basic Settings
- Allow Repainting: Option to enable or disable repainting.
- EMA Period: Set the period for calculating the EMA.
- Signal Period: Set the period for the signal line.

Security Data Handling
Utilizes `request.security` to fetch higher timeframe (HTF) data, ensuring accurate representation of the EMAs and signals.

Buy and Sell Signals
- Long Signal: Generated when the short-term EMA crosses above the long-term EMA.
- Short Signal: Generated when the short-term EMA crosses below the long-term EMA.
- Visual Alerts: Arrows are plotted on the chart to indicate Long and Short signals.
- Alert Conditions: Configurable alerts for both Long and Short signals, providing timely notifications for trading actions.

How It Works
1. EMA Calculation: The script calculates multiple EMAs and averages them to smooth out the data, providing a more reliable trend indicator.
2. Signal Line: An EMA of the averaged EMA is calculated to serve as the signal line.
3. Higher Timeframe Data: The indicator fetches and plots EMAs and signals based on higher timeframe data, depending on user settings.
4. Signal Generation: Crossover and crossunder events between the EMA and signal line generate Long and Short signals, respectively.
5. Time Period Display: Displays the current timeframe on the chart based on user preferences.

Customization and Usage
This indicator is highly customizable, allowing traders to tailor it to their specific needs:
- Adjust Timeframes: Switch between automatic, multiplier-based, or manual resolution settings.
- Set Periods: Modify the EMA and signal periods to suit different trading strategies.
- Visual Customization: Change the colors and positions of various elements for better readability and personal preference.
- Alert Settings: Configure alerts to receive notifications when Long or Short signals are generated.

Conclusion
The EMA Short Long Indicator [CHE] is an essential tool for traders looking to leverage the power of EMAs in their trading strategy. With its customizable settings, clear visual cues, and alert functionalities, it helps traders identify trends and make informed trading decisions effectively. Whether you're a short-term trader or prefer longer-term analysis, this indicator provides the flexibility and precision you need to succeed in the market.
Chart patternsemacrossoverFundamental AnalysislongtradeMoving Averagesshorttradesignals

Скрипт с открытым кодом

В истинном духе TradingView автор этого скрипта опубликовал его с открытым исходным кодом, чтобы трейдеры могли понять, как он работает, и проверить на практике. Вы можете воспользоваться им бесплатно, но повторное использование этого кода в публикации регулируется Правилами поведения. Вы можете добавить этот скрипт в избранное и использовать его на графике.

Хотите использовать этот скрипт на графике?

Отказ от ответственности