Sure! I'd be happy to help you create your trading robot using FXDreema. Since you're new to FXDreema, I'll provide detailed, step-by-step instructions to guide you through the entire process.
Overview of FXDreema:
FXDreema is a visual programming platform that allows you to create Expert Advisors (EAs) for MetaTrader 4 (MT4) and MetaTrader 5 (MT5) without any coding knowledge. It uses a block-based system where you can drag and drop blocks to define the logic of your trading strategy.
Getting Started with FXDreema
-
Create an Account:
- Go to FXDreema's website.
- Click on "Register" in the top-right corner.
- Fill out the registration form with your email and password.
- Verify your email if prompted.
-
Log In:
- After registering, log in to your account.
-
Create a New Project:
- Once logged in, you'll be taken to the main workspace.
- Click on "Create a new project".
- Enter Project Details:
- Project Name: Give a name to your project, e.g., "Three Pips Reversal EA".
- MetaTrader Version: Select MT5 since you want to create an EA for MT5.
- Click "OK" to create the project.
Understanding the FXDreema Workspace
- Blocks Workspace: The main area where you'll drag and drop blocks to build your EA.
- Blocks Toolbox: Located on the left side, it contains all the blocks you can use, categorized by their functions.
- Project Tree: Shows the structure of your EA, including variables, constants, and blocks used.
Creating the EA Logic
We'll break down your requirements into smaller steps and implement them one by one.
1. Open a Buy Trade when the Price Moves Up by Three Pips
Step 1: Set Up the Initial Conditions
-
Add a "No Trade" Block:
- In the Blocks Toolbox, under "Trade Events", find and drag the "No trade" block onto the workspace.
- This block ensures that we only check for new trade conditions when there are no open trades (optional, depending on your requirements).
-
Add a "Condition" Block:
- Under "Conditions", drag a "Condition" block and connect it below the "No trade" block.
- This block will check if the price has moved up by three pips.
Step 2: Configure the Condition for Price Movement Upwards
- Double-click on the "Condition" block to configure it.
- Set Up the Condition:
- Operand A:
- Click on "Price" and select "Bid".
- Function: Leave it as ">" (greater than).
- Operand B:
- We'll store the price level from three pips ago.
- Since FXDreema doesn't have a built-in way to check for a specific pip movement, we'll calculate this using variables.
Step 3: Store the Previous Price
- Define a Variable:
- In the Project Tree, right-click on "Variables" and select "Add Variable".
- Name:
Previous_Price
- Type: Double
- Initial Value:
Ask (for buy operations)
- Update the Variable Every Tick:
- Add a "Modify Variables" block at the very top of your blocks sequence.
- Double-click to configure:
- Variable to Modify:
Previous_Price
- New Value:
Previous_Price (we'll update this based on conditions)
Note: Since we need to detect a movement of three pips from the previous price, we'll need to store the price at a specific time and compare the current price to it.
However, FXDreema works primarily on time-based conditions rather than price movement over pips. To achieve this, we'll need to get a bit creative.
Calculating Price Movement
Since we need to detect when the price has moved up by three pips from a certain point, we'll:
- Store the price at the time when no trade is open.
- Continuously check if the current price is greater than or equal to the stored price plus three pips.
Step 4: Implement the Logic
-
Modify the "No Trade" Block:
- Connect a "Once per Bar" block right after the "No Trade" block to ensure the initial price is stored once per bar (or you can choose "Once per Tick" if you prefer real-time checking).
-
Add a "Modify Variables" Block:
- Under "Conditions", drag "Modify Variables" block below the "Once per Bar" block.
- Set Variable:
Previous_Price
- New Value:
Ask (current ask price)
-
Add a "Condition" Block to Check Price Movement:
- Under "Conditions", drag a "Condition" block and connect it below the "Modify Variables" block.
- Configure the Condition:
- Operand A:
Ask
- Function:
>=
- Operand B:
Previous_Price + (3 * Pip Value)
Calculating Pip Value:
Step 5: Place the Buy Order
- Add a "Buy Now" Block:
- Under "Buy & Sell", drag a "Buy now" block and connect it below the last "Condition" block.
- Configure the "Buy now" Block:
- Lot Size:
0.01
- Take Profit: Leave empty (as per initial trade, no TP)
- Stop Loss: Leave empty (no SL)
2. Open a Sell Trade when the Price Moves Down by Three Pips
- Repeat similar steps for the sell condition.
Step 1: Implement the Sell Logic
-
Add a Separate Chain for Sell Conditions:
- Go back to the "No Trade" block.
- Create a new connection from this block to a "Once per Bar" block (or "Once per Tick").
-
Add a "Modify Variables" Block for Sell:
- Drag another "Modify Variables" block and connect it.
- Variable:
Previous_Price_Sell (You'll need to add this variable similar to Previous_Price)
-
Add a "Condition" Block to Check Price Movement Downwards:
- Configure the Condition:
- Operand A:
Bid
- Function:
<=
- Operand B:
Previous_Price_Sell - (3 * Pip_Value)
Step 2: Place the Sell Order
- Add a "Sell Now" Block:
- Under "Buy & Sell", drag a "Sell now" block and connect it below the last "Condition" block.
- Configure the "Sell now" Block:
- Lot Size:
0.01
- Take Profit: Leave empty
- Stop Loss: Leave empty
3. Open Opposite Trade if Price Reverses by Six Pips
When a buy trade is open, and the price drops by six pips from the entry price, open a sell trade with a take profit of three pips. Similarly for sell trades.
Step 1: Check for Open Buy Trades
- Add a "For Each Position" Block:
- Under "Loops", drag "For each Position" block and connect it at the top (outside of the initial "No Trade" block to ensure it runs even when trades are open).
- Filter: Set to Trade Type: Buy
Step 2: Check if Price Has Dropped by Six Pips
-
Add a "Condition" Block:
- Connect a "Condition" block below the "For each Position" block.
- Configure the Condition:
- Operand A:
Bid
- Function:
<=
- Operand B:
Position Open Price (from the buy trade) - (6 * Pip_Value)
-
Add a "Sell Now" Block:
- Under "Buy & Sell", drag a "Sell now" block and connect it below the "Condition" block.
- Configure the "Sell now" Block:
- Lot Size:
0.01
- Take Profit:
3 * Pip_Value (set TP to 3 pips)
- Stop Loss: Leave empty
Step 3: Repeat for Open Sell Trades
Final Touches
Ensure Only One Trade Per Signal
To make sure only one trade is opened per signal:
- Use the "Once per Trade" block:
- Place a "Once per Trade" block before the "Buy now" and "Sell now" blocks.
- This block ensures that the action that follows only occurs once per detected condition.
Variable and Constant Summary
-
Variables:
Previous_Price (for buy condition)
Previous_Price_Sell (for sell condition)
-
Constants:
Pip_Value (set to 0.0001 or 0.01 depending on the currency pair)
Testing the EA
Before using the EA on a live account, it's crucial to test it thoroughly.
-
Export the EA:
- Click on the "Build" button at the top to generate the EA file.
- Download the
.ex5 file for MT5.
-
Install the EA in MetaTrader 5:
- Open MT5.
- Go to File > Open Data Folder > MQL5 > Experts.
- Copy the downloaded
.ex5 file into this folder.
- Restart MT5 or refresh the "Navigator" window.
-
Backtesting:
- Open the Strategy Tester in MT5.
- Select your EA from the list.
- Choose the symbol (currency pair) and time frame.
- Run the test to see how the EA performs.
-
Optimization:
- Adjust parameters if needed.
- Test with different values to see how it affects performance.
Important Notes
-
Pip Value Adjustment:
- The pip value (
Pip_Value) may need to be adjusted based on the currency pair you're trading.
- For most currency pairs:
0.0001
- For pairs like USDJPY:
0.01
-
Risk Management:
- Even though the EA doesn't use stop losses, be cautious with trading without them.
- Consider implementing a maximum drawdown or equity stop to protect your account.
-
Legal Considerations:
- Ensure that you comply with your broker's terms and conditions regarding automated trading.
- Be aware of the risks involved in trading, and consider consulting with a financial advisor.
Summary
You've now created an EA in FXDreema that:
- Opens a buy trade when the price moves up by three pips from a stored price.
- Opens a sell trade when the price moves down by three pips from a stored price.
- If a buy trade is open and the price drops by six pips from the entry price, it opens a sell trade with a take profit of three pips.
- Similarly, if a sell trade is open and the price rises by six pips from the entry price, it opens a buy trade with a take profit of three pips.
- Ensures only one trade is opened per signal.
Further Learning
- Explore FXDreema Tutorials:
- FXDreema offers tutorials and forums where you can learn more advanced techniques.
- Experiment with Blocks:
- Try adding additional conditions or features to your EA to improve its performance.
Feel free to ask if you have any questions or need further assistance with any of the steps!