Previous: Part 3 : Signals.
Tutorial - Part 4: Modules
Last update: 14th May 2023
With the signals added to your EA, your EA will now open and close orders. Two more tasks remain: setting the alternative take profit to PSAR, in case the target is less than 5 pips away and secondly, setting the stop loss equal to the value of PSAR as well. To do this, we will have to add the Take profit - Conditional (Pro) and the Stop loss - Conditional (Pro) module twice, once for buy and once for sell. So we will end up with 4 close modules: 2 times for take profit and 2 times for stop loss.
When adding any module to your EA, check the right side of the screen for an explanation of how the module works and how to configure it.
To add the Take profit - Conditional (Pro) module, click 'Add' in the Strategy part of the EA's main screen.
You will now see a list of all modules you can add to your EA. We're going to add the Take profit - Conditional (Pro) module, which is one of the most advanced modules. After clicking Add, you're looking at the list of modules:
You now need to enter the modules' parameters. We will want to enter a name and other basic settings first:
- Name: Buy TP
- Enabled for: Is Enabled For Buy Order (to only enable this module for buy orders)
Next, we're going to set the value of take profit to the value of the order's open price + the distance to PSAR:
We will not enter a condition when to remove the take profit, so we will leave the last condition empty. We do however set the last values:
- Trail distance (pips): 0
- Trail step size: 0
- Close percentage: 100
We will also add the same Take profit - Conditional (Pro) for sell orders. Here's how we set it up:
Now we will add the stop loss modules, which are easier to configure because they have a simple precondition: we simply always set the value of stop loss to the order's price minus PSAR, if PSAR is above the current price. So, the precondition (for buy) is if PSAR is above the current price. The start value is the value of PSAR.
And for sell, the precondition is the opposite, but everything else is the same:
If you want to know more about Modules and what they're capable of, please check the in-dept Modules documentation. You will be surprised about the flexibility you can create by using modules. To see an example, check out this blog: How to set stop loss based on the ATR indicator?
Next: Part 5 : Summary.