PROTECTED SOURCE SCRIPT

CZ Scalping/Doji Strategy v1

Telah dikemas kini
The "CZ Scalping/Doji Strategy" is designed to detect potential buy and sell opportunities based on a combination of indicators, including the ATR (Average True Range), SMA (Simple Moving Average), HMA (Hull Moving Average), and Doji candles. It also incorporates a risk management system to define stop-loss and take-profit levels.

Key Parameters and Indicators
Key Value (keyValue): This is a sensitivity factor that influences the calculation of the ATR-based trailing stop. It affects how closely the stop-loss follows the price.

ATR Period (atrPeriod): The period used for calculating the ATR, which measures market volatility. A higher value smooths out short-term fluctuations, while a lower value makes the ATR more responsive to recent price changes.

SMA Length (smaLength): The length of the Simple Moving Average, which serves as a trend filter. The script can dynamically adjust the SMA length if high-frequency trading is enabled.

Risk-Reward Ratio (riskRewardRatio): Defines the desired risk-reward ratio for trades. This ratio determines the relationship between potential profit and the accepted loss for each trade.

Trade Range Multiplier (tradeRangeMultiplier): Multiplies the ATR-based stop-loss value to set a range for trade conditions.

Enable High Frequency (enableHighFrequency): A boolean switch that, when enabled, adjusts the SMA length and trade range multiplier for higher trading frequency.

Indicators
ATR (Average True Range): This is used to calculate the trailing stop-loss (xATRTrailingStop). The stop-loss dynamically adjusts based on the volatility of the asset.

SMA (Simple Moving Average): The SMA serves as a trend filter, allowing trades only when the price is above (for buy signals) or below (for sell signals) the SMA.

HMA (Hull Moving Average): The script calculates and plots three different HMAs with lengths of 20, 25, and 200 periods. These HMAs help to smooth out price data and identify trends more clearly.

Doji Candles: The script identifies and plots Doji candles, which are often seen as indecision points in the market. A Doji candle is characterized by a small difference between the open and close prices.

Trade Logic
Buy Condition: A buy signal is generated when the price crosses above the ATR-based trailing stop, and the price is above the SMA filter. The trade must also meet certain range criteria related to the ATR.

Sell Condition: A sell signal is generated when the price crosses below the ATR-based trailing stop, and the price is below the SMA filter. Similar range criteria apply.

Risk Management
Stop Loss: The stop loss is set based on the ATR and adjusted by the trade range multiplier.

Take Profit: The take profit is calculated as a multiple of the stop loss, determined by the risk-reward ratio.

Alerts
The script includes alert conditions for buy and sell signals, as well as for detecting Doji candles. These alerts can be used to notify traders when specific conditions are met.

Chart Visualization
Plots: The script plots the three HMAs and marks buy/sell signals on the chart with diamonds. The bars are colored based on their relation to the ATR trailing stop: green for bars above the stop and red for bars below.

Doji Indicator: Doji candles are marked on the chart with a special symbol.

Usage
This strategy is intended for traders looking for a scalping method that incorporates volatility-based trailing stops and trend filtering. The additional Doji indicator helps in identifying potential reversals or periods of indecision in the market.

Publishing Considerations
Before publishing this script, ensure that:

Originality: The description clearly explains the unique aspects of this strategy, including the use of the ATR-based trailing stop in combination with trend filtering and Doji candle detection.
Language: The description and title are in English.
Chart: Publish with a clean chart that only includes this script and clear visualizations of the strategy's signals and indicators.
Risk Management: The strategy uses realistic back testing parameters, including appropriate commission, slippage, and position sizing.
Nota Keluaran
The CZ Doji Strategy is a custom strategy that helps detect potential buy and sell signals based on key technical indicators like the Average True Range (ATR), Simple Moving Average (SMA), Hull Moving Average (HMA), and Doji candle patterns. Here’s how to use the script and understand its parameters:

Key Features
ATR Trailing Stop: Automatically adjusts to price volatility using the ATR and Key Value. It helps determine when to enter or exit trades.
SMA Filter: Helps filter out false signals by using a moving average of price to confirm trends.
HMA (Hull Moving Average): Three different HMAs (20, 25, and 200) provide a smoother indication of price trends.
Doji Candle Detection: Highlights potential reversal points using Doji candlestick patterns.
Risk Management: Includes Stop Loss and Take Profit levels based on the ATR, trade range multiplier, and risk-reward ratio.
Input Parameters
Key Value (default = 1.26): Adjusts the sensitivity of the ATR Trailing Stop. Lower values increase sensitivity, higher values reduce it.
ATR Period (default = 26): Sets the length of the ATR calculation.
SMA Length (default = 4): Sets the length of the SMA filter to identify trends.
Risk-Reward Ratio (default = 3): Defines the risk/reward ratio for the strategy.
Trade Range Multiplier (default = 5): Multiplies the distance between the current price and the ATR Trailing Stop to identify large moves.
Enable High Trade Frequency (default = false): If enabled, the strategy adjusts the SMA length and trade range multiplier for more frequent trades.
How It Works
Buy Signal: A buy is triggered when the price crosses above the ATR Trailing Stop and is above the SMA filter. The trade range multiplier determines if the price movement is large enough for a valid signal.
Sell Signal: A sell is triggered when the price crosses below the ATR Trailing Stop and is below the SMA filter.
Doji Candle: A Doji is identified when the difference between the open and close prices is less than or equal to a percentage (default = 0.13) of the total candle size (high - low).
Visual Indicators
HMA Plots: The script plots three HMAs (20, 25, 200) in different colors to visually track trends.
Buy/Sell Signals: Green diamonds indicate buy signals, and red diamonds indicate sell signals on the chart.
Bar Colors: Green bars indicate a bullish trend, and red bars indicate a bearish trend based on the ATR Trailing Stop.
Risk Management
Stop Loss: Automatically set based on the ATR and trade range multiplier.
Take Profit: Set using the risk-reward ratio to maintain consistent profit targets relative to risk.
Alerts
You can set custom alerts for buy/sell signals and Doji detection to receive notifications in real time.
Nota Keluaran
The "CZ Doji Strategy" combines various technical indicators and custom parameters to detect buy/sell signals, manage risk, and optimize trade entry points. Here's a breakdown of the parameters and components:

1. Key Input Parameters:
Key Value (keyValue): This parameter controls the sensitivity of the ATR trailing stop and risk management. Adjusting it allows fine-tuning of the stop-loss distance.
ATR Period (atrPeriod): Defines the lookback period for the Average True Range (ATR) calculation, which measures market volatility.
SMA Length (smaLength): Defines the period for the Simple Moving Average (SMA) filter, used to determine trend direction.
Risk-Reward Ratio (riskRewardRatio): Helps define the take-profit level relative to the stop-loss size.
Trade Range Multiplier (tradeRangeMultiplier): A multiplier that adjusts the trade range relative to the ATR value. Higher values widen the range of valid trade signals.
Enable High Frequency (enableHighFrequency): When enabled, reduces the lookback periods of certain indicators, making the strategy more reactive (for high-frequency trading).
2. User-Defined Moving Average:
MA Period (maPeriod): Period for calculating the moving average.
MA Shift (maShift): Shifts the moving average forward or backward, influencing entry/exit timing.
MA Method (maMethod): Select from Simple, Exponential, or Weighted moving averages. This flexibility lets users choose which type of MA best suits the market conditions they are trading.
3. Moving Average Calculation:
The script defaults to Simple Moving Average (SMA) but will switch to Exponential (EMA) or Weighted (WMA) based on user selection. The moving average is also shifted based on user input, which helps align the strategy’s signals with the user's preference.
4. HMA (Hull Moving Average) Plots:
20 HMA, 25 HMA, and 200 HMA: These Hull Moving Averages provide smoother trend detection and are used to filter out market noise.
HMA Lengths: These periods are used to plot different Hull MAs on the chart, indicating potential long-term and short-term trends.
5. ATR Trailing Stop:
The ATR Trailing Stop is calculated based on the ATR value and adjusts dynamically based on market volatility. It updates based on price movement and volatility to ensure that stop-loss levels adapt to current conditions.
xATRTrailingStop is the core element that determines if the trailing stop will be tightened (when the market goes in your favor) or loosened (when the market is volatile).
6. Buy/Sell Signal Conditions:
Buy Signal: Triggered when the price crosses over the ATR trailing stop and the price is above the SMA filter. Additionally, the distance between the close and the ATR trailing stop should meet the range multiplier condition.
Sell Signal: Triggered when the price crosses under the ATR trailing stop and the price is below the SMA filter, with a similar range multiplier condition for the short trades.
7. Risk Management:
The stop-loss is based on a multiple of the ATR (nLoss), and the take-profit level is set using the Risk-Reward Ratio. This ensures that trades follow the risk/reward rules set by the user.
Stop-Loss (stopLoss) and Take-Profit (takeProfit) are calculated dynamically based on market conditions.
8. Doji Detection:
A Doji candle is identified when the difference between the open and close prices is minimal, indicating market indecision.
The parameter Doji Size (dojiSize) controls the threshold for detecting Doji candles. If a candle meets the criteria, the strategy plots a "Doji" label on the chart.
9. Visual Elements:
The script plots various moving averages (SMA, HMA), buy/sell signals, and highlights candles where a Doji is detected. Bar colors change based on the trailing stop level, indicating market direction (green for bullish, red for bearish).
10. Alerts:
Buy/Sell Alerts are set to notify the trader when a buy or sell signal is generated based on the crossovers of the ATR trailing stop.
An alert condition is also set for Doji candles, allowing traders to get notified when indecision in the market is detected.
How to Use the Indicator:
Sensitivity Adjustments: Use the Key Value to adjust the sensitivity of the ATR trailing stop. A lower value makes the stop tighter and more reactive, while a higher value gives it more breathing room.
Risk-Reward Settings: Set your desired Risk-Reward Ratio and Trade Range Multiplier to determine your stop-loss and take-profit levels based on your risk tolerance.
Moving Average Settings: Choose between SMA, EMA, or WMA for the moving average filter, based on the trading style and market conditions.
Doji Alerts: Monitor for Doji candles if you want to trade around market indecision points.
High-Frequency Mode: Enable the High-Frequency Mode if you want a faster-reacting strategy for more frequent trading.
This strategy can be particularly useful for traders who want to optimize risk management while also identifying potential trend reversals or continuation points through the use of Doji candles, ATR trailing stops, and multiple moving averages.
Candlestick analysisChart patternsCycles

Skrip dilindungi

Skrip ini diterbitkan secara sumber tertutup dan anda boleh menggunakannya dengan bebas. Anda boleh menyukainya untuk menggunakannya pada carta. Anda tidak dapat melihat atau mengubah kod sumbernya.

Ingin menggunakan skrip ini pada carta?


Juga pada:

Penafian