Enhanced Mean Reversion Strategy with SMA Bands Requirements: Generate a properly…
- User
Enhanced Mean Reversion Strategy with SMA Bands
Requirements: Generate a properly formatted MetaTrader 4 (MT4) expert advisor (EA) script to trade based on a custom indicator buffer values and conditions set out below.
Core Strategy Rules:
- Short Entry: o When bid price (or current candle close price) crosses above (or is equal to) higher band, open 2 short positions as per below: o 1st position size (50% of risk): if 0.1% risk (by default) ie 1 lot size = 0.50 lot size o 2nd position size (50% of risk): if 0.1% risk (by default) ie 1 lot size = 0.50 lot size o Stop loss: Upper band + (distance between middle and upper band in Pips multiplied by 1 by default) o Take profit options: o 1st position: SMA midline (1:1 risk reward) o 2nd position: Lower band (1:2 risk reward) Breakeven: Move 2nd position to breakeven when the 1st position target is reached Trail stop: After 1st position target is reached, trail 2nd position only by certain value in step and pips /% value. Additional positions in same direction: Allow additional positions to be opened once there is a breakeven on existing/opened trade Hedging: Allowed
- Long Entry: o When ask price (or current candle close price) crosses below (or is equal to) lower band, open 2 long positions as per below: o 1st position size (50% of risk): if 0.1% risk (by default) ie 1 lot size = 0.50 lot size o 2nd position size (50% of risk): if 0.1% risk (by default) ie 1 lot size = 0.50 lot size o Stop loss: Lower band - (distance between middle and lower band in Pips multiplied by 1 by default) o Take profit options: o 1st position: SMA midline (1:1 risk reward) o 2nd position: Higher band (1:2 risk reward) Breakeven: Move 2nd position to breakeven when the 1st position target is reached Trail stop: After 1st position target is reached, trail 2nd position only by certain value in step and pips /% value. Additional positions in same direction: Allow additional positions to be opened once there is a breakeven on existing/opened trade Hedging: Allowed
Additional features & Risk Management:
- Use pips instead of points
- Use Magic Number
- Use Trading time: a) Time of day hours ie between 1 am to 2 am only etc b) Sessions – ie London only etc c) Sessions overlaps – Sydney & London session overlap hours only etc
- Automatic Broker server time
- Comment for each order (open & close comments)
- Maximum Spread
- Maximum Slippage
Default settings for the indicator: Timeframe : M5 SMA Period: 144 Volatility Method: 2 Volatility Period: 288 Volatility Multiplier: 1 Channel ratio: 0.5 Max Bars to Calculate: 0
Indicator source code(must be integrated in the expert advisor): Will be attached separately. Please wait for it before generating code.
Notes:
- Ensure to consider the tick value and adjust orders properly for live trading conditions.
Assistant
- User
Assistant
- User
please check for compilation errors
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.