# Universal Buffer Reader EA - Input Parameters Reference **Version**: 2.0 **Date**: 2025-01-20 --- ## Quick Reference | Parameter | Type | Default | Description | |-----------|------|---------|-------------| | **General Settings** | | `Trade_Mode` | enum | `MODE_INDICATOR` | Trade mode: Indicator or Manual | | `LotSize` | double | `0.03` | Fixed lot size (if not using % balance) | | `Slippage` | int | `3` | Maximum slippage in points | | `MagicNumber` | int | `24680` | Unique identifier for EA trades | | `TakeScreenshotOnOpen` | bool | `true` | Capture screenshot when order opens | | `EnableDebugPrints` | bool | `true` | Enable debug logging | | `ExitOnOppositeSignal` | bool | `false` | Close opposite trades on new signal | | **Money Management** | | `UsePercentBalanceLot` | bool | `true` | Calculate lot size as % of balance | | `PercentOfBalanceForProfit` | double | `1.0` | % of balance for lot calculation | | `DailyProfitTargetPercent` | double | `2.0` | Daily profit target as % of balance | | **Time Filter** | | `EnableTimeFilter` | bool | `true` | Enable time-based trading filter | | `TradeSunday` | bool | `false` | Allow trading on Sunday | | `TradeMonday` | bool | `true` | Allow trading on Monday | | `TradeTuesday` | bool | `true` | Allow trading on Tuesday | | `TradeWednesday` | bool | `true` | Allow trading on Wednesday | | `TradeThursday` | bool | `true` | Allow trading on Thursday | | `TradeFriday` | bool | `true` | Allow trading on Friday | | `TradeSaturday` | bool | `false` | Allow trading on Saturday | | `AsianSession` | bool | `true` | Allow trading during Asian session | | `EuropeSession` | bool | `true` | Allow trading during Europe session | | `AmericaSession` | bool | `true` | Allow trading during America session | | **Signal Detection** | | `IndicatorName` | string | `"Custom Indicator"` | Name of custom indicator | | `BuySignalBuffer` | int | `0` | Buffer index for buy signal price | | `SellSignalBuffer` | int | `1` | Buffer index for sell signal price | | `BuySLBuffer` | int | `2` | Buffer index for buy stop loss | | `BuyTP1Buffer` | int | `3` | Buffer index for buy TP1 | | `BuyTP2Buffer` | int | `4` | Buffer index for buy TP2 | | `BuyTP3Buffer` | int | `5` | Buffer index for buy TP3 | | `SellSLBuffer` | int | `6` | Buffer index for sell stop loss | | `SellTP1Buffer` | int | `7` | Buffer index for sell TP1 | | `SellTP2Buffer` | int | `8` | Buffer index for sell TP2 | | `SellTP3Buffer` | int | `9` | Buffer index for sell TP3 | | `ATRPeriod` | int | `14` | ATR period for fallback calculation | | `ATRMultiple` | double | `1.5` | ATR multiple for SL/TP calculation | | `MinTPPips` | int | `20` | Minimum take profit in pips | | **Risk Management** | | `EnableBreakeven` | bool | `true` | Enable breakeven after profit | | `BreakevenPips` | int | `10` | Profit in pips to trigger breakeven | | `EnableTPBasedTrailing` | bool | `true` | Enable TP-based trailing stop | | `TPBasedTrailingStep` | int | `30` | Pips between TP levels for trailing | | `EnableTrailingStop` | bool | `true` | Enable standard trailing stop | | `TrailingStopPips` | int | `15` | Trailing stop distance in pips | | `TrailingStartPips` | int | `30` | Profit in pips to start trailing | | **Partial Close** | | `EnablePartialClose` | bool | `true` | Enable partial close at TPs | | `UseEqualDivision` | bool | `true` | Divide position equally among TPs | | `PartialCloseTP1Percent` | double | `33.33` | % to close at TP1 | | `PartialCloseTP2Percent` | double | `33.33` | % to close at TP2 | | `PartialCloseTP3Percent` | double | `33.34` | % to close at TP3 | --- ## Detailed Descriptions ### General Settings #### Trade_Mode - **Values**: `MODE_INDICATOR`, `MODE_MANUAL` - **Description**: Selects how the EA generates trade signals - `MODE_INDICATOR`: Uses custom indicator buffers for signals - `MODE_MANUAL`: Uses manual buy/sell buttons on chart - **Default**: `MODE_INDICATOR` #### LotSize - **Range**: `0.01` to `100.0` - **Description**: Fixed lot size used when `UsePercentBalanceLot = false` - **Default**: `0.03` #### Slippage - **Range**: `0` to `100` - **Description**: Maximum allowed slippage in points when opening orders - **Default**: `3` #### MagicNumber - **Range**: `1` to `2147483647` - **Description**: Unique identifier to distinguish EA trades from manual trades - **Default**: `24680` #### TakeScreenshotOnOpen - **Values**: `true`, `false` - **Description**: Captures a screenshot of the chart when a new order is opened - **Default**: `true` #### EnableDebugPrints - **Values**: `true`, `false` - **Description**: Enables detailed debug logging in Experts tab - **Default**: `true` #### ExitOnOppositeSignal - **Values**: `true`, `false` - **Description**: Closes existing opposite trades when a new signal is detected - **Default**: `false` --- ### Money Management Settings #### UsePercentBalanceLot - **Values**: `true`, `false` - **Description**: If true, calculates lot size as percentage of account balance - **Default**: `true` #### PercentOfBalanceForProfit - **Range**: `0.1` to `100.0` - **Description**: Percentage of account balance to use for lot size calculation - **Formula**: `LotSize = (Balance * Percent / 100) / (ContractSize * Price)` - **Default**: `1.0` #### DailyProfitTargetPercent - **Range**: `0.1` to `100.0` - **Description**: Daily profit target as percentage of account balance - **Behavior**: EA stops trading when target is reached, resets next day - **Default**: `2.0` --- ### Time Filter Settings #### EnableTimeFilter - **Values**: `true`, `false` - **Description**: Enables time-based trading restrictions - **Default**: `true` #### TradeSunday, TradeMonday, ..., TradeSaturday - **Values**: `true`, `false` - **Description**: Enables trading on specific days of the week - **Default**: Mon-Fri enabled, Sat-Sun disabled #### AsianSession, EuropeSession, AmericaSession - **Values**: `true`, `false` - **Description**: Enables trading during specific trading sessions - **Session Times**: - Asian: 00:00 - 08:00 GMT - Europe: 07:00 - 16:00 GMT - America: 13:00 - 22:00 GMT - **Default**: All sessions enabled --- ### Signal Detection Settings #### IndicatorName - **Type**: string - **Description**: Name of the custom indicator to use for signals - **Requirement**: Indicator must be in `Indicators/` folder - **Default**: `"Custom Indicator"` #### BuySignalBuffer, SellSignalBuffer - **Range**: `0` to `7` - **Description**: Buffer indices containing buy/sell signal prices - **Behavior**: Non-zero value in buffer indicates signal - **Default**: `0` (buy), `1` (sell) #### BuySLBuffer, BuyTP1Buffer, BuyTP2Buffer, BuyTP3Buffer - **Range**: `0` to `7` - **Description**: Buffer indices containing buy SL/TP levels - **Behavior**: If buffer is empty, uses ATR fallback - **Default**: `2` (SL), `3` (TP1), `4` (TP2), `5` (TP3) #### SellSLBuffer, SellTP1Buffer, SellTP2Buffer, SellTP3Buffer - **Range**: `0` to `7` - **Description**: Buffer indices containing sell SL/TP levels - **Behavior**: If buffer is empty, uses ATR fallback - **Default**: `6` (SL), `7` (TP1), `8` (TP2), `9` (TP3) #### ATRPeriod - **Range**: `1` to `100` - **Description**: Period for ATR indicator (used as fallback) - **Default**: `14` #### ATRMultiple - **Range**: `0.5` to `5.0` - **Description**: Multiple of ATR to use for SL/TP calculation - **Formula**: `SL = EntryPrice ± (ATR * ATRMultiple)` - **Default**: `1.5` #### MinTPPips - **Range**: `1` to `1000` - **Description**: Minimum take profit distance in pips - **Behavior**: Enforces minimum TP even if indicator provides smaller value - **Default**: `20` --- ### Risk Management Settings #### EnableBreakeven - **Values**: `true`, `false` - **Description**: Moves stop loss to breakeven after specified profit - **Default**: `true` #### BreakevenPips - **Range**: `1` to `100` - **Description**: Profit in pips required to trigger breakeven - **Behavior**: SL moved to open price + spread - **Default**: `10` #### EnableTPBasedTrailing - **Values**: `true`, `false` - **Description**: Enables trailing stop based on TP levels - **Behavior**: - TP1 reached → SL to breakeven - TP2 reached → SL to TP1 - TP3 reached → SL to TP2 - **Default**: `true` #### TPBasedTrailingStep - **Range**: `10` to `100` - **Description**: Minimum pips between TP levels for trailing - **Default**: `30` #### EnableTrailingStop - **Values**: `true`, `false` - **Description**: Enables standard trailing stop after all TPs - **Default**: `true` #### TrailingStopPips - **Range**: `1` to `100` - **Description**: Distance of trailing stop from current price - **Default**: `15` #### TrailingStartPips - **Range**: `1` to `100` - **Description**: Minimum profit in pips to start trailing - **Default**: `30` --- ### Partial Close Settings #### EnablePartialClose - **Values**: `true`, `false` - **Description**: Enables partial position closing at TP levels - **Default**: `true` #### UseEqualDivision - **Values**: `true`, `false` - **Description**: If true, divides position equally among TPs - **Behavior**: - `true`: Uses equal division (33.33%, 33.33%, 33.34%) - `false`: Uses custom percentages - **Default**: `true` #### PartialCloseTP1Percent, PartialCloseTP2Percent, PartialCloseTP3Percent - **Range**: `0.01` to `100.0` - **Description**: Percentage of position to close at each TP - **Requirement**: Sum must equal 100% - **Default**: `33.33`, `33.33`, `33.34` --- ## Configuration Examples ### Conservative Configuration ``` Trade_Mode = MODE_INDICATOR LotSize = 0.01 UsePercentBalanceLot = false EnableBreakeven = true BreakevenPips = 15 EnableTrailingStop = true TrailingStopPips = 20 EnablePartialClose = true UseEqualDivision = true ``` ### Aggressive Configuration ``` Trade_Mode = MODE_INDICATOR LotSize = 0.1 UsePercentBalanceLot = true PercentOfBalanceForProfit = 2.0 EnableBreakeven = true BreakevenPips = 5 EnableTrailingStop = true TrailingStopPips = 10 EnablePartialClose = true UseEqualDivision = false PartialCloseTP1Percent = 50.0 PartialCloseTP2Percent = 30.0 PartialCloseTP3Percent = 20.0 ``` ### Manual Trading Configuration ``` Trade_Mode = MODE_MANUAL LotSize = 0.05 EnableTimeFilter = false EnableBreakeven = true BreakevenPips = 10 EnableTrailingStop = true TrailingStopPips = 15 EnablePartialClose = true UseEqualDivision = true ``` --- ## Troubleshooting ### EA Not Trading 1. Check `EnableTimeFilter` - ensure current time is allowed 2. Check `DailyProfitTargetPercent` - ensure target not reached 3. Check `EnableDebugPrints` - enable to see why trades aren't opening 4. Check indicator buffers - ensure indicator is providing signals ### Orders Not Opening 1. Check `LotSize` - ensure within broker limits 2. Check `Slippage` - increase if orders are rejected 3. Check `MagicNumber` - ensure unique 4. Check broker requirements - minimum lot, maximum lot, lot step ### Partial Closes Not Working 1. Check `EnablePartialClose` - ensure enabled 2. Check TP levels - ensure price reaches TP levels 3. Check `UseEqualDivision` - ensure correct setting 4. Check order comment - ensure TP levels are embedded ### State Not Persisting 1. Check global variables - ensure not deleted 2. Check `MagicNumber` - ensure consistent 3. Check symbol name - ensure correct 4. Check EA restart - state should survive restart --- ## Best Practices 1. **Always test on demo account first** 2. **Start with conservative settings** 3. **Enable debug prints during testing** 4. **Monitor trades closely in first week** 5. **Adjust settings based on performance** 6. **Keep backup of working configuration** 7. **Document any custom indicator requirements** 8. **Review logs regularly for errors** --- **Last Updated**: 2025-01-20 **Version**: 2.0