DYNAMIC GRID EA - SIMPLE FUNCTION BREAKDOWN
FUNCTION 1 - BUY STOP GRID
Place buy stop orders above current market price with 30 pips initial gap and 5 pips grid spacing. One pip equals 0.1 price unit.
Example with market price at 5000. First buy stop places at 5003. Second buy stop places at 5003.5. Third buy stop places at 5004. Continue placing orders with 0.5 price unit spacing. Minimum 100 orders maximum 1000 orders.
FUNCTION 2 - SELL STOP GRID
Place sell stop orders below current market price with 30 pips initial gap and 5 pips grid spacing. One pip equals 0.1 price unit.
Example with market price at 5000. First sell stop places at 4997. Second sell stop places at 4996.5. Third sell stop places at 4996. Continue placing orders with 0.5 price unit spacing. Minimum 100 orders maximum 1000 orders.
FUNCTION 3 - UPSIDE HEDGE AUTOMATION
When market price moves upward and executes buy orders, automatically place new sell stops. Calculate placement from current market price plus 30 pips gap. Maintain 5 pips grid spacing between new sell orders.
Example buy fills at 5003. Current market now 5003. Place new sell stop at 5000. Next sell stop at 4999.5 Continue with 0.5 spacing. When next buy fills at 5003.5 and market is 5003.5, place sell stop at 5000.5. Continue this process for every filled buy order.
FUNCTION 4 - DOWNSIDE HEDGE AUTOMATION
When market price moves downward and executes sell orders, automatically place new buy stops. Calculate placement from current market price minus 30 pips gap. Maintain 5 pips grid spacing between new buy orders.
Example sell fills at 4997. Current market now 4997. Place new buy stop at 5000. Next buy stop at 5000.5. Continue with 0.5 spacing. When next sell fills at 4996.5 and market is 4996.5, place buy stop at 4999.5. Continue this process for every filled sell order.
FUNCTION 5 - ORDER MANAGEMENT SETTINGS
Stop loss for every order is 20 pips equal to 2.0 price units. Take profit for every order is 20 pips equal to 2.0 price units. Trailing stop activates when profit reaches 5 pips equal to 0.5 price units. Trailing stop moves in steps of 5 pips equal to 0.5 price units.
Example buy order at 5003 has stop loss at 5001 and take profit at 5005. When price reaches 5003.5 , trailing stop activates at 5003.5 When price reaches 5004, trailing stop moves to 5003.8 When price reaches 5004.5, trailing stop moves to 5004.2 Continue stepping every 5 pips profit.
Example sell order at 4997 has stop loss at 4499 and take profit at 4995. When price reaches 4996, trailing stop activates and start start trailing....,. previous same as buy logic
SYSTEM OPERATION FLOW
Start with market price at 5000. Function 1 activates placing 100 buy stops from 5003 to 5052.5. Function 2 activates placing 100 sell stops from 4997 to 4947.5. All orders have 20 pips stop loss and 20 pips take profit with trailing start at 5 pips and step at 5 pips.
Price moves up to 5003. Buy order fills. Function 3 activates placing sell stop at 5033. Price continues to 5003.5. Next buy fills. Function 3 places sell stop at 5033.5. Price reaches 5023. First buy take profit hits. Order closes. Corresponding sell stop at 5033 remains pending.
Price reverses down to 4997. Sell order fills. Function 4 activates placing buy stop at 4967. Price continues to 4996.5. Next sell fills. Function 4 places buy stop at 4966.5. Price reaches 4977. First sell take profit hits. Order closes. Corresponding buy stop at 4967 remains pending.
GRID MAINTENANCE RULES
Always maintain minimum 100 pending orders per side. When order count drops below 100, add new orders at grid edge with proper spacing. Never exceed 1000 orders per side. When limit approaches, stop adding new orders and send alert.
Replace closed orders immediately. When take profit hits on buy order, add new sell stop at downside of grid. When stop loss hits on buy order, add new buy stop at topside of grid. Apply same logic to sell side.
RISK CONTROLS
Maximum total orders 2000. Maximum drawdown 5 percent. Maximum spread 2 pips for order placement. Maximum slippage 1 pip. If any limit breached, pause new orders and alert.
This system creates continuous grid trading with automatic hedge generation following price movement in both directions.