O3xau mt5 ea
- Experts
- Lie Ning Mao
- Version: 1.33
- Activations: 5
// Trading
input string TradeSymbol = "XAUUSD"; // trading symbol
input ENUM_TIMEFRAMES TradeTimeframe = PERIOD_M1; // timeframe
// General order control
input bool EnableCloseAllSellOnBuy = false; // close sell positions when opening buy
input bool EnableOpenOrder = true; // allow opening new orders
input int Seconds = 30; // minimum interval between orders (s)
input double Lots = 0.01; // lot size per order
// Equity pullback protection
input bool EnableEquityPullbackRule = true; // enable equity pullback full-close
input double EquityPullbackThresholdUSD = 200.0; // drawdown USD from peak to trigger full-close
input bool EquityPullbackOnlyThisEA = true; // only close positions opened by this EA (MagicNumber)
input bool EquityPullbackRequireAboveInitial = true; // require current equity > initial equity to allow trigger
// Balance vs Balance+USD full-close rule
input bool EnableBalanceUsdRule = false; // enable rule: equity > balance + threshold
input double BalanceUsdThreshold = 5.0; // USD threshold for equity - balance
input int FloatingLossCountThreshold = 1; // number of floating-loss positions (>=) to trigger close
input bool CloseAllPositionsOnlyEA = true; // only close this EA's positions (true) or all (false)
// Order / trade settings
input int Deviation = 33; // allowed slippage (points)
input double TP_USDPer001 = 13.0; // initial TP target per 0.01 lot (USD)
input bool EnableInitialTP = true; // set TP on open
input int MagicNumber = 12346; // EA magic number
input double ProfitTargetUSD = 50.0; // per-position profit target (USD)
input bool CloseOtherMagics = false; // include other magics when closing for profit
// SAR settings
input bool EnableSAR = true; // enable SAR filter
input bool iSAR_Reverse = false; // reverse SAR open logic
input double SAR_Acceleration = 0.007; // SAR acceleration factor
input double SAR_Start = 0.076; // SAR start AF
input double SAR_Maximum = 0.2; // SAR max AF
input int SAR_SmoothBars = 1; // SAR smoothing bars
// Trailing / dynamic SL / spread compensation
input double TrailingStopUSDPer001 = 1.32; // trailing stop trigger USD per 0.01 lot
input bool TrailingStopOnlyThisMagic = true; // trailing only for this magic
input double TrailingBufferPips = 0.5; // trailing buffer (pips)
input double SpreadCompensationPer001 = 0.2; // spread compensation USD per 0.01 lot
// Dynamic SL tracking
input double DynamicSLRatio = 0.72; // dynamic SL tracking ratio
input bool EnableDynamicSL = true; // enable dynamic SL tracking
input double MinPriceRiseUSD = 1; // min price rise (USD) to adjust SL
// Stop loss
input bool EnableStopLoss = true; // enable stop loss rule
input double StopLossUSDPer001 = 50.0; // stop loss USD per 0.01 lot
input bool StopLossOnlyThisMagic = true; // stop loss applies only to this magic
// Floating loss protection TP
input bool EnableLossProtectionTP = true; // enable floating-loss protection TP
input double LossProtectionUSDPer001 = 3.3; // trigger USD per 0.01 lot for protection
input double ProtectionTPUSDPer001 = 3.3; // protection TP USD per 0.01 lot
input bool LossProtectionOnlyThisMagic = true; // protection only for this magic
// Account & risk management
input double MinBalance = 100.0; // minimum balance to allow opens
input double MinMarginLevel = 100.0; // minimum margin level (%) to allow opens
input bool EnableDynamicMaxOrders = true; // enable dynamic max positions calculation
input int BaseMaxOrders = 50; // base max positions reference
input double MarginSafetyFactor = 0.5; // safety factor for usable margin
input bool ShowRiskInfo = true; // show periodic risk info
input double MinOpenPriceDiffUSD = 0.3; // min price diff from prior close (USD) to allow open
