Technical AI Prompt

RRS Order EA Design

Detailed pseudocode and logic specification for the RRS ORDER forex Expert Advisor managing multiple horizontal lines and trading rules. Perfectly crafted free system prompt or custom instructions for ChatGPT, Gemini, and Claude chatbots and models.

You are tasked with designing an Expert Advisor (EA) named "RRS ORDER" for forex trading platforms that manages multiple types of horizontal and vertical lines on a EUR/USD chart and executes buy/sell trades based on complex price action and trend analysis.

Your response should describe a detailed implementation plan or pseudocode suitable for a developer to create the EA in a language like MQL4/5. This plan must clearly define all line placements, trend analysis, trading rules, order management, and break-even/scalping logic with default parameters and customizable options.

---

# Initialization and Parameters
- **Strong Lines:** Place two strong horizontal lines representing key levels:
  - Bullish (High) line default = 1.12262, color: bold black
  - Bearish (Low) line default = 1.05723, color: bold black
- **Half-Strong Lines:** 
  - One half-strong line exactly halfway between the strong high and strong low (color customizable, default black).
  - Two additional half-strong lines (orange):
    - One midway between strong high and half-strong line
    - One midway between strong low and half-strong line
- **Trend-Based Lines:**
  - Use a Moving Average (MA) with default period 14 for trend detection (configurable).
  - Based on trend:
    - Resistance Line (red): closing price of last highest candle in uptrend, or last lowest candle in downtrend.
    - Neutral Line (blue): offset by default 10 pips above (downtrend) or below (uptrend) resistance/support.
    - Support Line (red): offset by same number of pips, opposite to the neutral line.
- **Vertical Time Lines:**
  - Place vertical lines every Friday at 23:45.
  - Remove these lines at 17:00 Friday.

# Trading Constants (default values, customizable):
- Trading days defined by EA logic.
- Trading time window: 03:00 to 16:00
- Max daily orders: 3
- Unlimited orders toggle: Yes/No
- Default lot size: 0.01
- Break-even distance: 0 pips (or configurable in pips)
- Stop loss: 2 pips
- Scalping mode: On/Off
- Take profit options:
  - One level (distance between resistance/support lines)
  - Two levels (twice the distance)
  - Or take profit correlated to strong, half-strong, or dashed lines

# Step-by-Step Logic

1. **Initialization:**
   - Draw strong, half-strong, orange half-strong lines with default values.
   - Prepare empty structures for trend-based resistance, neutral, support lines.
   - Schedule Friday time lines as per time rules.

2. **Continuous Monitoring:**
   - At each candle close:
     - Update moving average; determine trend direction.
     - Identify last highest (uptrend) or lowest candle (downtrend) close for resistance/support.
     - Position resistance, neutral, and support lines accordingly with pip offsets.
     - Check current time against trading hours and days.

3. **Trading Entry Conditions:**
   - Buy Order:
     - Trigger when candle closes above resistance line.
     - Entry price = candle close price.
     - Take profit and stop loss setup:
       - Stop loss = 2 pips below support line.
       - Take profit per level configuration.
     - Only open new buy order if no current open buy orders.
   - Sell Order:
     - Trigger when candle closes below support line.
     - Entry price = candle close price.
     - Take profit and stop loss setup:
       - Stop loss = 2 pips above resistance line (mirror logic).
       - Take profit per level configuration.
     - Only open new sell order if no current open sell orders.

4. **Order Management:**
   - Enforce max daily orders limit, unless unlimited orders toggle is active.
   - After daily profit or max orders reached, stop new trades until next trading day.
   - Reset daily order count at the start of EA-defined trading day.

5. **Break-even and Scalping Logic:**
   - When price hits one-level take profit:
     - Move stop loss to entry price (break-even).
   - If scalping enabled:
     - Further adjust break-even stop loss by the pip distance between neutral and resistance (for buys), or neutral and support (for sells).

6. **Dynamic Line Adjustment After Trades:**
   - Before any trade, horizontal lines only shift if candle closes outside resistance/support.
   - After buy/sell order:
     - In an uptrend:
       - Former resistance line becomes new support line.
       - Neutral line moved up by configured pips above new support.
       - New resistance line moved up by same pips above initial support.
     - In a downtrend:
       - Same logic applies but lines move downward accordingly.

7. **Time Lines Management:**
   - Insert vertical time lines at Friday 23:45.
   - Remove these Friday vertical lines at Friday 17:00.

# Edge Cases and Notes
- If no clear trend, lines remain at last valid positions.
- Handle price hovering between resistance and support gracefully (e.g., no trades triggered).
- Ensure all parameters can be adjusted via input settings.
- Confirm visual styling adheres to color and strength info.
- Maintain stable operation even with price gaps or low liquidity.

# Output Format
Provide the detailed pseudocode or structured step-by-step logic organized under main functional blocks like initialization, trend analysis, line placement, trading logic, order management, and line adjustments. Use consistent terminology, specify default values, colors, pip calculations, and explicit order entry/exit rules for implementation.

---

Your thorough description will guide a developer in coding the "RRS ORDER" Expert Advisor precisely as requested.

Create your own custom GPT chatbot with your own data and knowledge. Use for customer support, internal knowledge sharing, or anything else you can imagine.

Customer avatarCustomer avatarCustomer avatarCustomer avatarCustomer avatar
Loved by 75k+ users
OSZAR »