Running Count Blackjack Free EA

Running Count Blackjack Free EA

10 April 2025, 05:20
Scott Adam Meldrum
0
88

Running Count Blackjack Free EA

EA  Basic Setup -Inputs




Strategy Control Inputs

These inputs determine how the EA behaves with respect to opening extra trades and the sensitivity of signals.

  • input bool enableAdditionalTrades = true;
    Purpose: Enables (or disables) the ability to open extra trades if the trading bias (running total) increases significantly.
    When enabled: The EA can add to an existing position if the signal grows stronger.

  • input double additionalTradeGap = 300.0;
    Purpose: Defines the minimum price gap (in pips, converted to points internally) that must be met between consecutive additional trades.
    Usage: Helps avoid rapid re-entry or “whipsaw” when the price hasn’t moved enough from the previous additional entry.

  • input double additionalTradeThreshold = 3;
    Purpose: Sets the minimum increase in the running total (i.e., the cumulative bias from recent bars) required to trigger an additional trade.
    Usage: Ensures that an extra trade is only taken when the signal’s strength increases by at least this amount compared to the previous trade signal.



    Running Total Configuration

    These parameters control how the EA calculates the bias (or signal strength) by summing the contributions from multiple bars.

    • input int runningTotalBars = 13;
      Purpose: Defines the number of previous bars used to compute the running total of bias values.
      Usage: A larger number smooths out random fluctuations; a smaller number makes the EA more sensitive to recent moves.

    • input double minCountThreshold = 7;
      Purpose: Sets the minimum sum of bias (from the recent bars) required to trigger a new trade.
      Usage: Helps filter out weak or indecisive market conditions.

    • input double maxCountThreshold = 0;
      Purpose: Establishes an upper limit for the bias—if the running total exceeds this threshold, the EA would skip the trade.
      Usage: When set to 0, it’s effectively turned off; if a nonzero value is provided, it prevents trading in overly strong conditions where the bias might be excessively high.


    Trade and Risk Management Inputs

    These settings determine your trade size and risk thresholds.

    • input double fixedLotSize = 0.1;
      Purpose: Defines the fixed number of lots to trade for each order.
      Usage: This is the base volume that will be normalized later to comply with the broker’s volume settings.

    • input int stopLossPoints = 850;
      Purpose: Specifies the stop loss distance in points (a “point” being the minimal price movement defined by the broker’s symbol settings).
      Usage: Determines how far from the entry price the stop loss is placed to limit potential losses.

    • input bool useTrailingStop = true;
      Purpose: Enables (or disables) a trailing stop mechanism.
      Usage: When enabled, the EA will adjust the stop loss during the life of the trade, potentially locking in profits as the market moves favorably.

    • input double takeProfitPercent = 6;
      Purpose: Sets the take profit threshold as a percentage gain relative to the account balance.
      Usage: When equity reaches this percentage above the balance, the EA will close all trades to secure profits.

    • input double maxDrawdownPercent = 1;
      Purpose: Defines the maximum allowable drawdown (as a percentage below the account balance) before all trades are closed.
      Usage: Acts as a safety mechanism to limit losses in adverse market conditions.

    • input int MagicNumber = 123452;
      Purpose: Provides a unique identifier for all trades executed by this EA.
      Usage: Distinguishes these orders from those placed manually or by other EAs running on the same account.


    Single Candle Patterns – Bias and Detection Thresholds

    These inputs set bias values for signals generated by certain single-candle patterns and determine detection criteria.

    • input double biasPinBar = 0.5;
      Purpose: Assigns a bias score for detecting a Pin Bar pattern (a reversal candle with a long tail).
      Usage: A Pin Bar contributes positively or negatively to the trading signal depending on its context.

    • input double biasInvertedHammerBull = 3;
      Purpose: Sets the bias for an Inverted Hammer pattern in a bullish scenario, where a long upper wick may signal a reversal.

    • input double biasWideRangeBull = -3.5;
      Purpose: Assigns a bias to wide-range bullish candles (a large candle body compared to the overall range), which can indicate strong momentum.

    • input double biasMarubozuBull = -1;
      Purpose: Determines the bias for a Marubozu candle—a candle with little or no wicks that indicates strong directional conviction.

    • input double minPinBodyRatio = 0.11;
      Purpose: The minimum ratio of the candle body to the full range required for a candle to qualify as a Pin Bar or hammer pattern.

    • input double dojiBodyThresholdRatio = 0.1;
      Purpose: Establishes the maximum body-to-range ratio for a candle to be considered a Doji.
      Usage: Ensures that only candles with very little body (indicative of market indecision) are flagged.


    Two Candle Patterns – Bias Settings

    These inputs are used for patterns involving two consecutive candles.

    • input double biasBullEngulfing = -1.5;
      Purpose: Sets the bias for a bullish engulfing pattern where a bullish candle completely engulfs a previous bearish candle.

    • input double biasInsideBarBull = 1;
      Purpose: Provides a positive bias for an inside bar pattern, where the current candle’s range is entirely within the previous candle’s range.

    • input double biasHaramiBull = 0;
      Purpose: Defines the bias for a bullish Harami pattern—a small bullish candle contained within a larger bearish candle.
      Usage: A zero value means it has a neutral impact on the signal.

    • input double biasPiercing = 3.5;
      Purpose: Assigns a bias for a Piercing pattern. This is a bullish reversal pattern where a bullish candle closes above the midpoint of a prior bearish candle.


    Three Candle Patterns – Bias and Detection Thresholds

    These inputs apply to signals derived from three-candle formations.

    • input double biasMorningStar = 2;
      Purpose: Bias for a Morning Star pattern (a three-candle bullish reversal that often includes a doji), indicating a shift in momentum.

    • input double biasThreeWhiteSoldiers = 4.5;
      Purpose: A strong bullish bias when three consecutive bullish candles (Three White Soldiers) are detected.

    • input double biasThreeInsideUp = 5;
      Purpose: Bias for a “Three Inside Up” pattern, where an inside pattern confirms bullish reversal.

    • input double biasThreeBarBullRev = 3;
      Purpose: Sets a bias for a custom-defined three-bar bullish reversal pattern.

    • input double biasUpsideGapTwoCrows = 3;
      Purpose: Although named with a “crows” reference, it is associated with bearish gap patterns involving two candles.
      Usage: The setting suggests that such a formation contributes a specific bias to the overall signal.


    Gap Patterns – Open-Close Based Bias Settings

    These inputs address gap patterns by comparing open/close prices, offering additional signals.

    • input double biasGap_OC_Up_BullBull = -1;
      Purpose: Bias value for a gap up scenario where bullish conditions continue (both previous and current candles are bullish).

    • input double biasGap_OC_Up_BullBear = -2;
      Purpose: Bias for a gap up pattern that reverses into bearish behavior.

    • input double biasGap_OC_Down_BullBull = 2;
      Purpose: Bias for a gap down that continues bullish momentum, an unusual situation where market structure might imply a retracement.

    • input double biasGap_OC_Down_BullBear = -3;
      Purpose: Bias for a gap down leading to bearish continuation.


    Gap Patterns – High-Low Based Bias Settings

    These settings consider gaps in the high-low range rather than open-close levels.

    • input double biasGap_HL_Up_BullBull = -2.5;
      Purpose: Bias for a bullish confirmation in a gap up scenario based on the high-low range.

    • input double biasGap_HL_Up_BullBear = -5;
      Purpose: A stronger bearish bias in a gap up scenario when conditions reverse.

    • input double biasGap_HL_Down_BullBull = -1.5;
      Purpose: Bias for gap down with bullish continuation.

    • input double biasGap_HL_Down_BullBear = 0.5;
      Purpose: A mild bias for gap down scenarios that turn bearish.


    Pattern Group Enable/Disable Flags

    These boolean switches let you choose which sets of pattern analyses to run. Disabling a group can simplify the decision-making process if you wish to focus on particular patterns.

    • input bool analyzeSingleCandlePatterns = true;
      Enables or disables the detection of single-candle patterns.

    • input bool analyzeTwoCandlePatterns = true;
      Controls whether two-candle pattern detection is active.

    • input bool analyzeThreeCandlePatterns = true;
      Toggles the analysis for three-candle patterns.

    • input bool analyzeGapPatterns = true;
      Determines if gap-based patterns are to be included in the trading signal.



    MA Cross Visualization Settings (Moving Average Filter)

    These inputs configure two moving averages used as a filter to further confirm trade signals.

    Fast Moving Average (MA1)

    • input bool InpUseMAFilter = true;
      Purpose: Enables or disables the moving average filter entirely.
      Usage: When enabled, the EA will only take a trade if the fast MA is in the desired relation to the slow MA.

    • input string FAST and related text strings ( MA1_TEXT , MA1_TEXT_2 ):
      Purpose: Provide labels or visual separators for the fast MA settings when displayed on the chart.

    • input ENUM_TIMEFRAMES MA1_TIMEFRAME = PERIOD_CURRENT;
      Purpose: Sets the timeframe on which the fast MA is calculated (by default, the current chart’s timeframe).

    • input ENUM_MA_METHOD MA1_MODE = MODE_SMA;
      Purpose: Defines the method used for the fast MA calculation (Simple Moving Average in this case).

    • input int MA1_PERIOD = 60;
      Purpose: Specifies the period (number of bars) to calculate the fast MA.

    • input int MA1_SHIFT = 0;
      Purpose: Allows shifting the fast MA forward or backward relative to the price bars.

    • input ENUM_APPLIED_PRICE MA1_APPLIED_PRICE = PRICE_CLOSE;
      Purpose: Chooses the price data (e.g., close, open, high, low) that is fed into the fast MA calculation.

    Slow Moving Average (MA2)

    • input string SLOW, MA2_TEXT, MA2_TEXT_2 :
      Purpose: Similar to the fast MA strings, these are used for labeling and visual organization for the slow MA settings.

    • input ENUM_TIMEFRAMES MA2_TIMEFRAME = PERIOD_CURRENT;
      Purpose: Sets the timeframe for the slow MA calculation.

    • input ENUM_MA_METHOD MA2_MODE = MODE_SMA;
      Purpose: Determines the method for the slow MA (again using a simple moving average).

    • input int MA2_PERIOD = 155;
      Purpose: Sets the number of bars used in calculating the slow MA. Typically, a longer period is chosen than for the fast MA.

    • input int MA2_SHIFT = 0;
      Purpose: Allows for adjusting the alignment of the slow MA.

    • input ENUM_APPLIED_PRICE MA2_APPLIED_PRICE = PRICE_CLOSE;
      Purpose: Selects which price to use (here, the closing price) for calculating the slow MA.


    Summary

    Each setting has been carefully designed to control either the:

    • Trade Execution and Management: (lot size, stop loss, trailing stops, risk limits, extra trade conditions)

    • Signal Generation: (candlestick pattern biases and thresholds, running total calculation)

    • Market Filtering: (moving average filter for trade confirmation)

    By adjusting these inputs, you can fine-tune the strategy’s sensitivity, risk profile, and market condition adaptability.

    This thorough explanation should help you—and any end user—understand the purpose and function of every configuration parameter in the EA.


    settings