// Input parameters - fully inherited from original EA
input bool EnableCloseAllSellOnBuy = false; // Close all sell positions when opening buy, true=close all, false=do not close
input bool EnableOpenOrder = true; // Global order switch, false=do not open orders but still allow trailing stop
input int Seconds = 360; // Minimum interval seconds for order (7.2min fits $200/day target)
input double Lots = 0.01; // Lot size per order
input int Deviation = 33; // Maximum allowed slippage (points)
input double TP_USDPer001 = 13.3; // Take profit per 0.01 lot (USD, set TP when opening, calculated by actual lot size)
input bool EnableInitialTP = true; // Set initial TP when opening order (false=only rely on floating loss protection and trailing stop for TP)
input int MagicNumber = 66666; // Magic number (distinguish from original EA)
input double ProfitTargetUSD = 13.3; // Single position profit target (USD, close when reached, set reasonably to avoid greed)
input bool CloseOtherMagics = false; // Include other magic positions when closing for profit
// SAR parameters - fully inherited from original EA
input bool EnableSAR = true; // Enable SAR signal filter (false=disable all SAR restrictions)
input bool iSAR_Reverse = false; // iSAR reverse open: true=open buy when SAR above candle, false=open buy only when SAR switches from above to below
input double SAR_Acceleration = 0.071; // SAR acceleration (recommended 0.01~0.03, more sensitive trend signal)
input double SAR_Start = 0.076; // SAR initial value (0=default)
input double SAR_Maximum = 0.2; // SAR maximum value (recommended 0.1~0.2)
input int SAR_SmoothBars = 1; // SAR smoothing bars (average of recent N bars)
// Trailing stop parameters - fully inherited from original EA (note: this is trailing stop SL, not TP)
input double TrailingStopUSDPer001 = 1.33; // Trailing stop trigger per 0.01 lot (USD, set trailing stop SL after profit exceeds this amount)
input bool TrailingStopOnlyThisMagic = true; // Only trailing stop for this magic positions (true=this EA only, false=all BUY positions)
input double TrailingBufferPips = 0.3; // Trailing stop buffer pips (reduce frequent modification, smaller is more sensitive)
input double SpreadCompensationPer001 = 0.2; // Stop loss price compensation per 0.01 lot (USD, calculated by actual lot size, tighter following price)
// New: dynamic SL tracking parameters
input double DynamicSLRatio = 0.72; // Dynamic SL tracking ratio (0.5=price rises $1, SL moves up $0.5)
input double LossProtectionUSDPer001 = 13.3; // Floating loss trigger per 0.01 lot (USD, set protection TP when price drops below open price by this amount)
input double ProtectionTPUSDPer001 = 13.3; // Protection TP per 0.01 lot (USD, set above open price to reduce loss, can override existing TP)
input bool LossProtectionOnlyThisMagic = true; // Only set protection TP for this magic positions
// Original EA risk management parameters
input double MinBalance = 100.0; // Minimum account balance (do not open orders if below)
// New advanced risk management parameters
input double MinMarginLevel = 100.0; // Minimum margin level (%) (do not open orders if below)
input bool EnableDynamicMaxOrders = true; // Enable dynamic max position calculation (recommended, smart control based on margin level)
input int BaseMaxOrders = 50; // Base max position count (reference for dynamic calculation)
input double MarginSafetyFactor = 0.5; // Margin safety factor (use 50% of available margin, more conservative)
input bool ShowRiskInfo = true; // Show risk info
input double MinOpenPriceDiffUSD = 0.3; // Minimum price difference between previous close and current price (USD, do not open order if below)
上周回测参数
// Input parameters - fully inherited from original EA
input bool EnableCloseAllSellOnBuy = false; // Close all sell positions when opening buy, true=close all, false=do not close
input bool EnableOpenOrder = true; // Global order switch, false=do not open orders but still allow trailing stop
input int Seconds = 360; // Minimum interval seconds for order (7.2min fits $200/day target)
input double Lots = 0.01; // Lot size per order
input int Deviation = 33; // Maximum allowed slippage (points)
input double TP_USDPer001 = 13.3; // Take profit per 0.01 lot (USD, set TP when opening, calculated by actual lot size)
input bool EnableInitialTP = true; // Set initial TP when opening order (false=only rely on floating loss protection and trailing stop for TP)
input int MagicNumber = 66666; // Magic number (distinguish from original EA)
input double ProfitTargetUSD = 13.3; // Single position profit target (USD, close when reached, set reasonably to avoid greed)
input bool CloseOtherMagics = false; // Include other magic positions when closing for profit
// SAR parameters - fully inherited from original EA
input bool EnableSAR = true; // Enable SAR signal filter (false=disable all SAR restrictions)
input bool iSAR_Reverse = false; // iSAR reverse open: true=open buy when SAR above candle, false=open buy only when SAR switches from above to below
input double SAR_Acceleration = 0.071; // SAR acceleration (recommended 0.01~0.03, more sensitive trend signal)
input double SAR_Start = 0.076; // SAR initial value (0=default)
input double SAR_Maximum = 0.2; // SAR maximum value (recommended 0.1~0.2)
input int SAR_SmoothBars = 1; // SAR smoothing bars (average of recent N bars)
// Trailing stop parameters - fully inherited from original EA (note: this is trailing stop SL, not TP)
input double TrailingStopUSDPer001 = 1.33; // Trailing stop trigger per 0.01 lot (USD, set trailing stop SL after profit exceeds this amount)
input bool TrailingStopOnlyThisMagic = true; // Only trailing stop for this magic positions (true=this EA only, false=all BUY positions)
input double TrailingBufferPips = 0.3; // Trailing stop buffer pips (reduce frequent modification, smaller is more sensitive)
input double SpreadCompensationPer001 = 0.2; // Stop loss price compensation per 0.01 lot (USD, calculated by actual lot size, tighter following price)
// New: dynamic SL tracking parameters
input double DynamicSLRatio = 0.72; // Dynamic SL tracking ratio (0.5=price rises $1, SL moves up $0.5)
input bool EnableDynamicSL = true; // Enable dynamic SL tracking
input double MinPriceRiseUSD = 0.9; // Minimum price rise to trigger SL adjustment (USD, only adjust SL when price rises above this amount)
// Stop loss parameters - new feature
input bool EnableStopLoss = true; // Enable stop loss
input double StopLossUSDPer001 = 85.0; // Stop loss per 0.01 lot (USD, calculated by actual lot size)
input bool StopLossOnlyThisMagic = true; // Only stop loss for this magic positions (true=this EA only, false=all BUY positions)
// Floating loss protection TP parameters - new feature
input bool EnableLossProtectionTP = true; // Enable floating loss protection TP
input double LossProtectionUSDPer001 = 13.3; // Floating loss trigger per 0.01 lot (USD, set protection TP when price drops below open price by this amount)
input double ProtectionTPUSDPer001 = 13.3; // Protection TP per 0.01 lot (USD, set above open price to reduce loss, can override existing TP)
input bool LossProtectionOnlyThisMagic = true; // Only set protection TP for this magic positions
// Original EA risk management parameters
input double MinBalance = 100.0; // Minimum account balance (do not open orders if below)
// New advanced risk management parameters
input double MinMarginLevel = 100.0; // Minimum margin level (%) (do not open orders if below)
input bool EnableDynamicMaxOrders = true; // Enable dynamic max position calculation (recommended, smart control based on margin level)
input int BaseMaxOrders = 50; // Base max position count (reference for dynamic calculation)
input double MarginSafetyFactor = 0.5; // Margin safety factor (use 50% of available margin, more conservative)
input bool ShowRiskInfo = true; // Show risk info
input double MinOpenPriceDiffUSD = 0.3; // Minimum price difference between previous close and current price (USD, do not open order if below)