forexguy18

Naresh CE with 13 62 cross

forexguy18 Updated   
ema
Thank you to Lauris, for sharing knowledge and logic for the EMA cross-over (13/62).

The provided Pine Script is a custom script, which is designed to display Chandelier Exit levels on the price chart and generate buy and sell labels based on specific conditions.

Here's a breakdown of the key components and logic of the Pine Script:

Exponential Moving Averages (EMAs):

ema1: The 13-period Exponential Moving Average (EMA) of the closing price.
ema2: The 62-period Exponential Moving Average (EMA) of the closing price.
EMA Plotting:

The script plots the ema1 (13 EMA) and ema2 (62 EMA) lines on the price chart using the plot() function.
Chandelier Exit Calculation:

The Chandelier Exit values are calculated using the Average True Range (ATR).
The script calculates the atr (Average True Range) using the atr() function with the given length.
longStop is calculated as the highest price of the specified length minus the ATR, and shortStop is calculated as the lowest price plus the ATR.
Directional Indicator (dir):

The dir variable is used to determine the direction of the Chandelier Exit based on the comparison of the current close price with the previous long and short stops.
Buy and Sell Signals:

The script generates buy signals when the Chandelier Exit direction changes from short to long (buySignal).
Similarly, sell signals are generated when the Chandelier Exit direction changes from long to short (sellSignal).
The conditions for buy and sell signals are based on the value of dir and its previous value.
Buy and Sell Labels:

Buy and sell labels are plotted on the chart using plotshape() based on the generated buy and sell signals.
The showLabels input parameter controls whether to display the buy and sell labels.
Highlighting States:

The script fills the chart area with color (green for long, red for short) based on the direction of the Chandelier Exit values.
The highlightState input parameter controls whether to apply this highlighting.
Alerts:

The script includes alert conditions based on the direction change (changeCond), buy signal (buySignal), and sell signal (sellSignal) using the alertcondition() function.
The script aims to help traders identify potential buy and sell signals based on the Chandelier Exit levels derived from the 13 EMA and 62 EMA crossovers. The Chandelier Exit values can serve as dynamic stop-loss levels for long and short positions.

Release Notes:
Alert condition is included in the logic
Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?