Purpose of the Script: This script is designed to generate buy and sell signals for trading Forex and cryptocurrencies by analyzing price trends using exponential moving averages (EMAs), volatility, and volume filters. The signals are displayed as arrows on the chart.
What the Script Does Input Settings:
The script allows the user to configure various settings, such as the lengths of EMAs, a higher timeframe for trend confirmation, and thresholds for volume and volatility (ATR - Average True Range). Key settings: 5 EMA Length – Length of the short-term EMA. 13 EMA Length – Length of the medium-term EMA. 26 EMA Length – Length of the long-term EMA. 21 EMA Length – Used for trend confirmation on a higher timeframe. Higher Timeframe – Lets you select a timeframe (e.g., daily) for confirming the overall trend. ATR Threshold – Filters out signals when the market's volatility is too low. Volume Filter – Ensures sufficient trading activity before generating signals. Calculating EMAs (Exponential Moving Averages):
Four EMAs are calculated: ema5 (short-term), ema13 (medium-term), ema26 (long-term), and ema21 (higher timeframe confirmation). These EMAs help determine price trends and crossovers, which are critical for identifying buy and sell opportunities. Trend Confirmation Using a Higher Timeframe:
The 21 EMA on the higher timeframe (e.g., daily) is used to confirm the overall direction of the market. Defining Signal Conditions:
Buy Signal: A buy signal is generated when:
ema5 crosses above ema13 (indicating a bullish trend). ema5 crosses above ema26 (stronger bullish confirmation). The closing price is above ema5, ema13, ema26, and the 21 EMA on the higher timeframe. The market's volatility (ATR) is above the defined threshold. The volume meets the conditions or volume filtering is disabled. Sell Signal: A sell signal is generated when:
ema5 crosses below ema13 (indicating a bearish trend). ema5 crosses below ema26 (stronger bearish confirmation). The closing price is below ema5, ema13, ema26, and the 21 EMA on the higher timeframe. The market's volatility (ATR) is above the defined threshold. The volume meets the conditions or volume filtering is disabled. Volume Filtering:
Ensures there’s enough trading activity by comparing the current volume to a 20-period moving average of volume. Persistent Variables:
These variables (crossed13 and crossed13Sell) help track whether the short-term EMA (ema5) has crossed the medium-term EMA (ema13). This prevents false or repeated signals. Displaying Signals on the Chart:
Buy signals are displayed as green upward arrows below the price. Sell signals are displayed as red downward arrows above the price.
How It Helps Traders: This script provides visual cues for potential entry and exit points by combining moving average crossovers, volatility, volume, and higher timeframe trend confirmation. It works well for trending markets and ensures signals are filtered for stronger conditions to reduce noise.
No verdadeiro espírito do TradingView, o autor desse script o publicou como código aberto, para que os traders possam compreendê-lo e analisá-lo. Parabéns ao autor! Você pode usá-lo gratuitamente, mas a reutilização desse código em publicações é regida pelas Regras da Casa. Você pode favoritá-lo para usá-lo em um gráfico.
As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.