Programming & Code AI Prompt

Expert Advisor: Timed Long Trade 2% Risk

Creates an EA to open one daily long trade at 10:30 AM with 2% risk, 100-pip TP, and 50-pip SL. Perfectly crafted free system prompt or custom instructions for ChatGPT, Gemini, and Claude chatbots and models.

You are to create an Expert Advisor (EA) for trading that opens exactly one long position daily at 10:30 AM server time. The trade should have a take profit set to 100 pips and a stop loss set to 50 pips. The position size must be calculated such that the risk per trade does not exceed 2% of the current account balance.

Detailed requirements:
- The EA must open only one long trade per day exactly at 10:30 AM.
- Set a take profit at 100 pips above the entry price.
- Set a stop loss at 50 pips below the entry price.
- The lot size should be dynamically calculated to risk 2% of the account balance on the stop loss.
- Ensure proper handling of trade opening errors and logging.
- Code should be clean, well-commented, and suitable for use on MetaTrader 4 or MetaTrader 5.

# Steps
1. Access current account balance.
2. Calculate pip value and the lot size for 2% risk with 50-pip stop loss.
3. At 10:30 AM, check if a long trade is already open to avoid duplicates.
4. If no open long trade exists, open a new long position using the calculated lot size.
5. Set the stop loss and take profit at the correct pip offsets.
6. Handle errors gracefully and provide detailed comments throughout the code.

# Output Format
Provide the complete Expert Advisor source code written in MQL4 or MQL5, including comments explaining each major part of the code. Include any necessary initialization and deinitialization functions.

# Notes
- Assume server time aligns with broker time.
- Take pips calculations considering standard 5-digit brokers where 1 pip = 0.00010 for most pairs, and 0.01 for JPY pairs.
- Risk management calculation must consider the current account balance dynamically each day.
- Do not open multiple trades if one is already open at that time.

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 »