Open-Close Diff with Bollinger Bands (Up to 8σ)1. what this code does
This code does the following
Calculates the difference (diff) between the open (opening) and close (closing) prices
The direction and magnitude of the price change for each candle.
Calculate Bollinger bands from ±3σ to ±8σ
Calculated based on moving average (basis) and standard deviation (stdDev)
Calculates the upper and lower limits of the Bollinger Bands and plots the lines at each σ level (3σ to 8σ).
Changes background color when the Bollinger Band is exceeded.
For example, if the diff is between ±3σ and ±4σ, the background is changed in red or blue.
When a value reaches a Bollinger Band outside of the more outer Bollinger Band (e.g., ±8σ), the transparency of the background color changes to visually highlight the anomaly.
Indicateurs et stratégies
Trends Strategy with TP/SL and FibonacciA Trend Strategy in trading XAUUSD (gold) focuses on identifying and capitalizing on the market's prevailing directional momentum. Gold is a highly liquid asset and often moves in significant trends due to its sensitivity to global economic conditions, inflation expectations, interest rates, and geopolitical events. A trend-following strategy aims to ride these movements, either upward (bullish trend) or downward (bearish trend), maximizing profit potential while minimizing risks.
Key Components of a Trend Strategy for XAUUSD:
Trend Identification:
Use technical indicators such as moving averages (e.g., EMA, SMA) or trendlines to determine the direction of the trend.
A bullish trend is characterized by higher highs and higher lows, while a bearish trend features lower highs and lower lows.
Example: Employ the 50 EMA and 200 EMA Crossover to confirm trend direction. When the 50 EMA crosses above the 200 EMA, it indicates a bullish trend, and vice versa for a bearish trend.
Entry Points:
Enter trades in the direction of the trend. For a bullish trend, buy on pullbacks to support levels or moving averages. For a bearish trend, sell on pullbacks to resistance levels.
Indicators like the RSI (Relative Strength Index) or Stochastic Oscillator can help identify overbought or oversold conditions, providing better entry points.
Exit Points:
Use predefined take-profit and stop-loss levels to manage trades effectively.
For take-profit, set targets at major resistance levels for long positions or support levels for short positions.
For stop-loss, use levels slightly below the recent swing low in a bullish trend or above the recent swing high in a bearish trend.
Confirmation Indicators:
Incorporate additional indicators like the MACD (Moving Average Convergence Divergence) or ADX (Average Directional Index) to confirm trend strength.
The ADX value above 25 suggests a strong trend, while values below 20 indicate a weak or range-bound market.
Risk Management:
Use proper position sizing, typically risking no more than 1-2% of your account per trade.
Avoid over-leveraging, as XAUUSD is highly volatile, which can lead to large price swings.
Trend Continuation and Reversal Monitoring:
Watch for signs of trend exhaustion or reversal using candlestick patterns (e.g., Doji, Engulfing) or divergence on indicators like RSI or MACD.
When the trend weakens, adjust your positions or exit trades to lock in profits.
MAD Ratio with Decile ThresholdsThe MAD Ratio with Decile Thresholds is a technical analysis indicator designed to assess market trends using the ratio of short-term and long-term Simple Moving Averages (SMA). It provides clear signals for potential buying and selling opportunities based on the relationship between these moving averages and predefined thresholds.
Key Features:
MAD Ratio Calculation:
The indicator calculates the MAD Ratio by dividing the 21-period SMA (short-term) by the 200-period SMA (long-term).
Threshold Levels:
Horizontal lines mark key threshold levels:
Ratio = 1: Neutral zone where short- and long-term trends align.
Top Decile Threshold (1.1): Indicates strong bullish conditions.
Bottom Decile Threshold (0.9): Indicates strong bearish conditions.
Buy and Sell Signals:
Strong Buy Signal: Triggered when the MAD Ratio exceeds 1.1, and the 21-SMA crosses above the 200-SMA.
Strong Sell Signal: Triggered when the MAD Ratio drops below 0.9, and the 21-SMA crosses below the 200-SMA.
Weak Buy Signal: Triggered when the MAD Ratio is greater than 1 but below 1.1, and a bullish crossover occurs.
Weak Sell Signal: Triggered when the MAD Ratio is less than 1 but above 0.9, and a bearish crossover occurs.
Visual Elements:
Buy and sell signals are displayed directly on the chart as labels or shapes for easy identification.
Background highlights:
Green zones: Strong bullish conditions (MAD > 1.1).
Red zones: Strong bearish conditions (MAD < 0.9).
The current MAD Ratio value is displayed as text on the chart for real-time monitoring.
Purpose:
This indicator helps traders identify momentum shifts and assess the strength of a trend using both short- and long-term market dynamics. It is especially useful for filtering signals based on decile thresholds to focus on high-probability trade setups.
Ignition Crystal BallIgnition Crystal Ball (ICB) Indicator
Inspired by the John Carter TTM Squeeze concept
1. Introduction
This “Ignition Crystal Ball” indicator combines Bollinger Bands (referred to here as “Ignition Bollinger Bands”) with one or two Keltner Channels to help traders visualize periods of potential “squeeze.” In John Carter’s TTM Squeeze logic, market volatility often shrinks when Bollinger Bands move inside Keltner Channels, and it expands when prices “fire” out of that squeeze.
This script also calculates custom angles on the Bollinger Bands, computes pip differences, and generates buy/sell alerts based on changing conditions. Below is a high-level overview of the indicator’s components, features, and how a trader might use it.
2. Ignition Bollinger Bands (IBB)
2.1 Inputs
• Length (default 20)
• StdDev (default 2.0)
• Threshold Angle (x10)
• Pip Differential Threshold
2.2 Calculation
1. Basis (Center Line)
Uses a simple moving average of close over length_ibb bars.
2. Upper & Lower Bands
Calculated by adding/subtracting (StdDev × standard deviation) from the basis.
2.3 Angle Detection
A custom function angle(_src, _lookback) approximates the slope of the Bollinger Bands in degrees by comparing _src vs. _src and applying an arctangent. The script colors table outputs when these angles exceed the user-defined threshold.
3. Keltner Channels
3.1 Inputs
• Length K1 / K2
• Multiplier K1 / K2
• Source K1 / K2
• Bands Style: Choice among “Average True Range,” “True Range,” or “Range.”
• Use Exponential MA: Toggle between EMA or SMA for the baseline.
3.2 Calculation
The script’s keltnerChannel function:
1. Calculates a moving average (EMA or SMA).
2. Computes a range using either ATR, True Range, or the plain bar range (high - low).
3. Returns the upper, middle, and lower lines.
Two sets of Keltner Channels (K1 and K2) are plotted by default.
4. Bollinger vs. Keltner: Identifying the “Squeeze”
A key part of many TTM Squeeze–style strategies involves looking for when Bollinger Bands move inside narrower Keltner Channels. This script calculates:
upper_pip_diff = (upperIBB - keltner1_upper) * 10000
lower_pip_diff = (keltner1_lower - lowerIBB) * 10000
• If these differences are small, it suggests a “squeeze” is in effect.
• The script also calculates a new_label_pip_diff (the difference between upper_pip_diff and lower_pip_diff) and displays that on the chart as a floating label.
5. Labels, Tables, and Visual Elements
5.1 Floating Labels
The script uses a custom floatingLabel() function to place real-time text boxes near the Bollinger Bands showing:
• upper_pip_diff
• lower_pip_diff
• new_label_pip_diff
• A percentage label that compares the current difference to a previous one.
Colors vary to reflect bullish (green), bearish (red), or neutral (yellow/gray) indications.
5.2 Table Displays
• PipD Table: Shows the absolute distance (in pips) between upper and lower Bollinger Bands.
• Angle Table: Located on the right side of the chart, displays the angles of the upper/lower IBB lines and the basis. If an angle exceeds the threshold, it turns bright (lime or red).
5.3 Plotting & Filling
• IBB: The basis and its upper/lower bands are plotted. The background between them can be filled with a semi-transparent color.
• Keltner Channels: Up to two sets (K1 and K2), each with its own color shading.
6. Alerts
There are two alert conditions, based on a color shift in the script’s logic:
buy_alert_condition = text_color_upper != color.green and text_color_upper == color.green
sell_alert_condition = text_color_upper != color.red and text_color_upper == color.red
• Buy Alert: When the script detects an upper color transition from non-green to green.
• Sell Alert: When the script detects an upper color transition from non-red to red.
7. Usage Tips
1. Spotting Squeezes
Look for times when Bollinger Bands contract inside Keltner Channels, suggesting low volatility.
2. Angle Threshold
The angle table on the right can reveal whether the bands are sloping sharply up or down.
3. Pip Differences (Forex)
For currency traders, tracking pip differences can highlight volatility changes.
4. Multi-Timeframe Analysis
Works on intraday or higher timeframes to detect expansions and contractions in volatility.
5. Alerts
The built-in alerts can notify you as soon as the script’s color logic changes to bullish or bearish.
Günlük İşlem Stratejisi - Güncellenmiş//@version=5
indicator("Günlük İşlem Stratejisi - Güncellenmiş", overlay=true)
// Parametreler
rsiLength = input.int(14, title="RSI Periyodu")
rsiOverbought = input.int(70, title="RSI Aşırı Alım")
rsiOversold = input.int(30, title="RSI Aşırı Satım")
macdShortTerm = input.int(12, title="MACD Kısa Vadeli MA")
macdLongTerm = input.int(26, title="MACD Uzun Vadeli MA")
macdSignalTerm = input.int(9, title="MACD Signal Periyodu")
bbLength = input.int(20, title="Bollinger Band Periyodu")
bbStdDev = input.float(2.0, title="Bollinger Band Std Dev")
// RSI Hesaplaması
rsi = ta.rsi(close, rsiLength)
// MACD Hesaplaması
= ta.macd(close, macdShortTerm, macdLongTerm, macdSignalTerm)
// Bollinger Bands Hesaplaması
= ta.bb(close, bbLength, bbStdDev)
// Alım (Long) ve Satış (Short) Sinyalleri
longSignal = (rsi < rsiOversold) and (macdLine > signalLine) and (close < bbLower)
shortSignal = (rsi > rsiOverbought) and (macdLine < signalLine) and (close > bbUpper)
// Alım ve Satış İşlem Sinyalleri Gösterimi
plotshape(longSignal, title="Long (Alış) Sinyali", location=location.belowbar, color=color.green, style=shape.labelup, text="BUY")
plotshape(shortSignal, title="Short (Satış) Sinyali", location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL")
// İşlem Sinyali İçin Sesli Uyarı
alertcondition(longSignal, title="Long Sinyali", message="Alım Sinyali")
alertcondition(shortSignal, title="Short Sinyali", message="Satış Sinyali")
Hammer & Co.It shows Hammers and all other similar candles.
It even detects a hammer when it is made out of two candles.
EMA based filter is also enables if required.
CandelaCharts - Opening Gap (OG) 📝 Overview
The ICT (Inner Circle Trader) Opening Gap represents the price difference between the previous trading session's closing price and the current session's opening price. This gap serves as a key indicator of market sentiment and can offer valuable clues about the market's potential direction throughout the trading day.
A bullish Opening Gap forms when the market opens higher than the previous session's close, signaling strong buying interest or positive sentiment heading into the new session
A bearish Opening Gap occurs when the market opens lower than the previous session's close, reflecting heightened selling pressure or negative sentiment among market participants
The Opening Gap is significant as it often establishes the market's tone for the trading session. Accurately interpreting this gap enables traders to make informed decisions about when to enter or exit positions. Serving as a gauge of market strength or weakness, the gap provides a clear signal of whether the market is likely to trend upward or downward during the day.
📦 Features
MTF
Mitigation
Consequent Encroachment
Threshold
Hide Overlap
Advanced Styling
⚙️ Settings
Show: Controls whether OGs are displayed on the chart.
Show Last: Sets the number of OGs you want to display.
Length: Determines the length of each OG.
Mitigation: Highlights when an OG has been touched, using a different color without marking it as invalid.
Timeframe: Specifies the timeframe used to detect OGs.
Threshold: Sets the minimum gap size required for OG detection on the chart.
Show Mid-Line: Configures the midpoint line's width and style within the OG. (Consequent Encroachment - CE)
Show Border: Defines the border width and line style of the OG.
Hide Overlap: Removes overlapping OGs from view.
Extend: Extends the OG length to the current candle.
Elongate: Fully extends the OG length to the right side of the chart.
⚡️ Showcase
Simple
Mitigated
Bordered
Consequent Encroachment
Extended
🚨 Alerts
This script provides alert options for all signals.
Bearish Signal
A bearish signal is triggered when the price opens lower than the previous session's close.
Bullish Signal
A bullish signal is triggered when the price opens higher than the previous session's close.
⚠️ Disclaimer
Trading involves significant risk, and many participants may incur losses. The content on this site is not intended as financial advice and should not be interpreted as such. Decisions to buy, sell, hold, or trade securities, commodities, or other financial instruments carry inherent risks and are best made with guidance from qualified financial professionals. Past performance is not indicative of future results.
5Ema Indicator//@version=6
strategy("Simple strategy demo", overlay = true, margin_long = 100, margin_short = 100)
//@variable The length of the `fastMA` and half the length of the `slowMA`.
int lengthInput = input.int(14, "Base length", 2)
// Calculate two moving averages with different lengths.
float fastMA = ta.sma(close, lengthInput)
float slowMA = ta.sma(close, lengthInput * 2)
// Place an order to enter a long position when `fastMA` crosses over `slowMA`.
if ta.crossover(fastMA, slowMA)
strategy.entry("buy", strategy.long)
// Place an order to enter a short position when `fastMA` crosses under `slowMA`.
if ta.crossunder(fastMA, slowMA)
strategy.entry("sell", strategy.short)
// Plot the moving averages.
plot(fastMA, "Fast MA", color.aqua)
plot(slowMA, "Slow MA", color.orange)
vipertrade( Al/Sat Sinyalleri - Heikin Ashi)hakandicel//@version=5
indicator("Güncel Al/Sat Sinyalleri - Heikin Ashi", overlay=true)
// Heikin Ashi Mumlarının Hesaplanması
var float ha_open = na
ha_close = (open + high + low + close) / 4
ha_open := na(ha_open ) ? (open + close) / 2 : (ha_open + ha_close ) / 2
ha_high = math.max(high, math.max(ha_open, ha_close))
ha_low = math.min(low, math.min(ha_open, ha_close))
// Parametreler
length = input.int(14, title="Hareketli Ortalama Periyodu")
source = ha_close // Heikin Ashi kapanış fiyatını kullanıyoruz
// Hareketli Ortalama Hesaplama
sma_line = ta.sma(source, length)
// Al/Sat Şartları
buy_signal = ta.crossover(source, sma_line) // Fiyat SMA'yı yukarı keserse al
sell_signal = ta.crossunder(source, sma_line) // Fiyat SMA'yı aşağı keserse sat
// Alarmlar için Şartlar
alertcondition(buy_signal, title="AL Sinyali", message="AL Sinyali Geldi! Fiyat: {{close}}")
alertcondition(sell_signal, title="SAT Sinyali", message="SAT Sinyali Geldi! Fiyat: {{close}}")
// Grafik Üzerinde Görselleştirme
plot(sma_line, color=color.blue, title="Hareketli Ortalama", linewidth=2)
plotshape(series=buy_signal, title="Al", location=location.belowbar, color=color.green, style=shape.labelup, text="Al", size=size.small)
plotshape(series=sell_signal, title="Sat", location=location.abovebar, color=color.red, style=shape.labeldown, text="Sat", size=size.small)
JAR - 9 MAs with Entry Points The script allows you to display multiple MAs on the chart with customization options for the MA periods and types.
It plots buy and sell signals based on whether the MAs are in the correct order (buy) or reverse order (sell).
simple script and will have more update soon
1-Year Volatility (365 Days)This script adds an indicator to your chart that display the 1-year volatility in %.
EMA Crossover: 5 crossing 9, 13, 21ema crossover and squeez of 5 9 13 and 21, gives 5 9 13 and 21 in one indicator and helps to declutter the screen
Comprehensive Indicator SuiteFor Momentum ,Rsi , MACD and moving Direction we give Comprehensive Indicator Suite if momentum crosses 0 while RSI more than 50 we can expect up movement
VİPER_TRADE( Al/Sat Sinyalleri - Heikin Ashi) HAKAN_DİCEL//@version=5
indicator("Güncel Al/Sat Sinyalleri - Heikin Ashi", overlay=true)
// Heikin Ashi Mumlarının Hesaplanması
var float ha_open = na
ha_close = (open + high + low + close) / 4
ha_open := na(ha_open ) ? (open + close) / 2 : (ha_open + ha_close ) / 2
ha_high = math.max(high, math.max(ha_open, ha_close))
ha_low = math.min(low, math.min(ha_open, ha_close))
// Parametreler
length = input.int(14, title="Hareketli Ortalama Periyodu")
source = ha_close // Heikin Ashi kapanış fiyatını kullanıyoruz
// Hareketli Ortalama Hesaplama
sma_line = ta.sma(source, length)
// Al/Sat Şartları
buy_signal = ta.crossover(source, sma_line) // Fiyat SMA'yı yukarı keserse al
sell_signal = ta.crossunder(source, sma_line) // Fiyat SMA'yı aşağı keserse sat
// Alarmlar için Şartlar
alertcondition(buy_signal, title="AL Sinyali", message="AL Sinyali Geldi! Fiyat: {{close}}")
alertcondition(sell_signal, title="SAT Sinyali", message="SAT Sinyali Geldi! Fiyat: {{close}}")
// Grafik Üzerinde Görselleştirme
plot(sma_line, color=color.blue, title="Hareketli Ortalama", linewidth=2)
plotshape(series=buy_signal, title="Al", location=location.belowbar, color=color.green, style=shape.labelup, text="Al", size=size.small)
plotshape(series=sell_signal, title="Sat", location=location.abovebar, color=color.red, style=shape.labeldown, text="Sat", size=size.small)
Ichimoku - Only Senkou Span A and Tenkan-senchimoku - Only Senkou Span A and Tenkan-sen
Description:
This indicator is a simplified version of the Ichimoku Cloud system, focusing solely on two key components: the Tenkan-sen (Conversion Line) and the Senkou Span A (Leading Span A).
Key Features:
Tenkan-sen (Conversion Line): This line provides a short-term view of the market trend, calculated as the average of the highest high and the lowest low over a specified period. It helps traders identify potential reversal points and trends.
Senkou Span A (Leading Span A): This line is calculated as the average of Tenkan-sen and Kijun-sen and serves as an important part of the Ichimoku Cloud. It provides insight into support and resistance zones, and its position relative to other lines can indicate potential trend strength.
How to Use:
Trend Identification: Use the Tenkan-sen line to gauge short-term momentum. When the price is above the Tenkan-sen, it indicates a bullish trend, while a position below suggests a bearish trend.
Support and Resistance Levels: The Senkou Span A can be used alongside other Ichimoku components as a dynamic support/resistance level. Traders often observe the relationship between Senkou Span A and Senkou Span B for trading signals.
Settings:
Tenkan-sen Length: Adjustable input allowing traders to modify the calculation period for the Tenkan-sen.
Kijun-sen Length: The length is used for Kijun-sen calculations, but it is not displayed in this particular indicator to keep it clean and focused.
This indicator is ideal for traders looking for a streamlined approach to Ichimoku analysis, allowing for quick decision-making based solely on these two essential lines without any shifting applied.
Ar_Upgraded_MACD [AriVestHub]
Introduction
This indicator is an improved version of the MACD. In the simple and default mode of the MACD, there are numerous peaks and troughs. In this version, by applying custom settings, you can draw horizontal lines such that the desired number of peaks and troughs are between the regions. This helps to ignore the peaks and troughs that have smaller fluctuations compared to the others. Doing this manually is almost impossible. After drawing these lines, you can base the entry and exit signals on the peaks and troughs that have the greatest movement and size, as there will be a higher chance of a reversal from those regions.
Key Features
Identification of Key Peaks and Troughs: The script identifies and marks key peaks and troughs.
Customizable Settings: You can adjust the number of horizontal lines and how they are drawn based on your personal needs.
Conclusion
This script is a useful tool for traders looking to identify peak and trough patterns in the MACD. By highlighting these patterns, traders can make more informed trading decisions.
Bitcoin Pi Cycle Period IndicatorBitcoin Pi Cycle Period Indicator
This indicator tracks potential market tops and bottoms in Bitcoin using the Pi Cycle concept. It uses two simple moving averages (SMA): a short-term (111-period) and a long-term (350-period) moving average, with the long-term moving average multiplied by 2. When the short-term SMA crosses above the long-term SMA, it signals a potential market top (Pi Cycle Top), while a cross below signals a potential market bottom (Pi Cycle Bottom).
Features:
Moving Averages: Customizable long and short-period SMAs.
Visuals: Displays the moving averages and Pi Cycle signals directly on the chart.
Alerts: Set up alerts for Pi Cycle Tops and Bottoms to monitor potential market reversal points.
Automatic comparison of symbols depending on custom listIn the indicator settings, specify a list of tickers and the corresponding symbol for comparison. Each new list must be on a separate line. The line must begin with the symbol for comparison, then an equal sign, and then a list of tickers separated by commas. If the ticker selected in the chart window is not found in any of the lists, then the symbol from the first list will be used as the symbol for comparison. For example:
TVC:DXY = OANDA:XAUUSD, OANDA:XAGUSD
OANDA:BCOUSD = OANDA:SPX500USD
OANDA:SPX500USD = BINANCE:BTCUSDT
***
Автоматическое сравнение символов в зависимости от настраиваемого списка
В настройках индикатора укажите список тикеров и соответствующий символ для сравнения. Каждый новый список должен быть на отдельной строке. В начале строки должен быть указан символ для сравнения, затем знак равенства и после него список тикеров, разделенных запятыми. Если выбранный в окне графика тикер не будет найден ни в одном из списков, то в качестве символа для сравнения ему будет соответствовать символ из первого списка. Например:
TVC:DXY = OANDA:XAUUSD, OANDA:XAGUSD
OANDA:BCOUSD = OANDA:SPX500USD
OANDA:SPX500USD = BINANCE:BTCUSDT
Gün BloklarıGün Blokları ve Fiyat Seviyeleri İzleyici - TradingView İndikatörü
Bu TradingView indikatörü, yatırımcılara ve tüccarlara, belirli günlerin başlangıçlarını ve önemli fiyat seviyelerini takip etme imkanı sunar. Hem teknik analiz yaparken hem de günlük işlem stratejilerini belirlerken yardımcı olacak özelliklere sahiptir.
Özellikler:
Gün Başlangıcı Takibi: Pazartesi'den Pazar'a kadar her günün başlangıcında arka plan renkleri değişir ve o günün adı grafikte etiket olarak görüntülenir. Bu, günün hangi aşamasında olduğunuzu hızlıca görmenizi sağlar.
Fiyat Seviyesi Çizimi: Önceki gün, hafta, ay veya 4 saatlik zaman dilimlerinde yüksek ve düşük fiyat seviyeleri grafik üzerinde çizilir. Bu seviyeler, önemli destek ve direnç noktalarını işaret eder.
Çizgi Özelleştirmeleri: Çizgilerin stili (katı, kesikli, noktalı) ve uzunluğu kullanıcı tercihlerine göre özelleştirilebilir. Ayrıca, fiyat etiketlerinin boyutu da ayarlanabilir.
Zaman Dilimi İzleme: Günlük, haftalık, aylık ve hatta 4 saatlik zaman dilimlerinde fiyat hareketlerini izleyebilir ve bu periyotlardaki yüksek/düşük fiyatları grafik üzerinde kolayca görebilirsiniz.
Esnek Kullanım: Her bir zaman dilimi için fiyat seviyelerini göstermek ya da gizlemek, etiketlerin metin boyutlarını değiştirmek gibi birçok esnek ayar yapılabilir.
Kimler İçin Uygun?
Bu indikatör, özellikle günlük ticaret yapanlar, teknik analiz uzmanları ve destek/direnç seviyelerini takip eden yatırımcılar için idealdir. Günlük piyasa hareketlerini daha verimli bir şekilde takip etmek isteyen herkes, bu indikatörü portföyüne dahil edebilir.
Gün Blokları ve Fiyat Seviyeleri İzleyici ile ticaret stratejilerinizi güçlendirin ve piyasadaki önemli seviyeleri kaçırmadan takip edin!
Omega_galskyThe 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.