OPEN-SOURCE SCRIPT

Omega_galsky

Updated
The strategy uses three Exponential Moving Averages (EMAs) — EMA8, EMA21, and EMA89 — to decide when to open buy or sell trades. It also includes a mechanism to move the Stop Loss (SL) to the Break-Even (BE) point, which is the entry price, once the price reaches a Risk-to-Reward (R2R) ratio of 1:1.

Key Steps:
Calculating EMAs: The script computes the EMA values for the specified periods. These help identify market trends and potential entry points.

Buy Conditions:

EMA8 crosses above EMA21.
The candle that causes the crossover is green (closing price is higher than the opening price).
The closing price is above EMA89.
If all conditions are met, a buy order is executed.
Sell Conditions:

EMA8 crosses below EMA21.
The candle that causes the crossover is red (closing price is lower than the opening price).
The closing price is below EMA89.
If all conditions are met, a sell order is executed.
Stop Loss and Take Profit:

Initial Stop Loss and Take Profit levels are calculated based on the entry price and a percentage defined by the user.
These levels help protect against large losses and lock in profits.
Break-Even Logic:

When the price moves favorably to reach a 1:1 R2R ratio:
For a buy trade, the Stop Loss is moved to the entry price if the price increases sufficiently.
For a sell trade, the Stop Loss is moved to the entry price if the price decreases sufficiently.
This ensures the trade is risk-free after the price reaches the predefined level.
Visual Representation:

The EMAs are plotted on the chart for easy visualization of trends and crossovers.
Entry and exit points are also marked on the chart to track trades.
Purpose:
The strategy is designed to capitalize on EMA crossovers while minimizing risks using Break-Even logic and predefined Stop Loss/Take Profit levels. It automates decision-making for trend-following traders and ensures disciplined risk management.
Release Notes
The strategy uses three Exponential Moving Averages (EMAs) — EMA8, EMA21, and EMA89 — to decide when to open buy or sell trades. It also includes a mechanism to move the Stop Loss (SL) to the Break-Even (BE) point, which is the entry price, once the price reaches a Risk-to-Reward (R2R) ratio of 1:1.

Key Steps:
Calculating EMAs: The script computes the EMA values for the specified periods. These help identify market trends and potential entry points.

Buy Conditions:

EMA8 crosses above EMA21.
The candle that causes the crossover is green (closing price is higher than the opening price).
The closing price is above EMA89.
If all conditions are met, a buy order is executed.
Sell Conditions:

EMA8 crosses below EMA21.
The candle that causes the crossover is red (closing price is lower than the opening price).
The closing price is below EMA89.
If all conditions are met, a sell order is executed.
Stop Loss and Take Profit:

Initial Stop Loss and Take Profit levels are calculated based on the entry price and a percentage defined by the user.
These levels help protect against large losses and lock in profits.
Break-Even Logic:

When the price moves favorably to reach a 1:1 R2R ratio:
For a buy trade, the Stop Loss is moved to the entry price if the price increases sufficiently.
For a sell trade, the Stop Loss is moved to the entry price if the price decreases sufficiently.
This ensures the trade is risk-free after the price reaches the predefined level.
Visual Representation:

The EMAs are plotted on the chart for easy visualization of trends and crossovers.
Entry and exit points are also marked on the chart to track trades.
Purpose:
The strategy is designed to capitalize on EMA crossovers while minimizing risks using Break-Even logic and predefined Stop Loss/Take Profit levels. It automates decision-making for trend-following traders and ensures disciplined risk management.
Candlestick analysis

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 publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?

Disclaimer