Modules are the building blocks of your EA and are defined under the Trading Strategy part of the system. The modules are divided into 3 categories:
Modules for opening take input from Signals and Modules which prevent opening and can open orders as a result.
The Open order - Open module, will allow one or multiple orders/ positions to be opened at the same time. It will only open a consecutive order when the signal's conditions have evaluated from not true to true.
SettingsEvery time an Open Signal evaluates true, from being false on the previous quote, it will try to open an order, unless the Prevent Open modules are preventing it or when a Close(Buy/ Sell) Signal evaluated to true, from being false on the previous quote, at the same time.
Changes compared to the V2 module:
Open module V2 waits to close orders as long as the current open signal (with its conditions) are active. The general thought behind this is that closing an order, while an open signal is active, would cause a new order (of the same type) to be opened directly after closing the current order, causing the account to waste balance on commissions and spreads. This logic caused some confusing amongst traders when a signal would be active till the end of a bar and thus SL/ TP not being executed by the EA. The current remedy is either wait for the cross to expire (on the next new bar), or to block the open signal after opening an order, by adding the 'Time gap between orders' module.
Open module V3 will only activate on the very first processed quote which results in an active signal and decides on opening/ closing only at that moment. On the next quote, if SL/ TP is hit, the order will be closed, even if all the conditions of the signal are still true. So with V3, if an order closes after the conditions of a signal are met, a new order won't be opened. Instead, it will wait until at least the signal is not active for one quote and then becomes active again.
Please note there's a new and improved version of this module which contains changes to trading behavior: Open order V3.
The Open order - Open module, will allow one or multiple orders/ positions to be opened at the same time, but won’t hedge. It will only open a consecutive order when the Signal's condition(s) have evaluated from being not true to being true.
SettingsWhen an Open Signal is evaluated to be true, it will try to open an order, unless the Prevent Open modules are preventing it, or when a Close(Buy/ Sell) Signal is evaluated to be true at the same time.
Modules for closing take orders as input and close orders when one or more condition, based on the settings, are met. There are currently 10 modules for closing:
The Stop loss - Close module, will set a stop loss (SL) directly after opening an order (see '1' in image below). The module will then wait for the SL to be hit (see '2' in image below) and then close the order/ order scope.
SettingsThe Stop loss - Trailing – Close module, will not set a stop loss (SL) directly after opening an order (see '1' in image below), but will wait for the price to hit the threshold (see '2' in image below). Only then the stop loss (SL) is set (see '3' in image below). If the price hits the SL, the module closes the order. The module sets the SL of a buy order below the current price, not necessarily below the buy order's open price. Because the SL is set below the current price, it's possible that when the SL gets hit, the order is in profit; it's also possible because of trailing. Many traders use this module to capture profits the moment the price retraces. For a sell order, everything is in reverse, so the module sets the SL of a sell order above the current price.
SettingsThe Stop loss - Catching up trail - Close module, allows a trader to set a trailing stop loss, which decreases the distance between the current price and the SL after Gain 0 (in pips) was gained. From the moment the final gain of Gain 1 has been reached, the SL will trail the current price with a distance of 1 pip. The module also allows the trader to use a gradually increasing gain by setting gain1 to a value bigger than Gain 0.
SettingsThe Stop loss - Conditional – Close module, will evaluate if open orders have hit their SL. After an order has been opened (see '1' in image below), the module will set the stop loss (SL) when a (complex) condition has become true (see '2' in image below). When the price hits the SL (see '3' in image below), the order will be closed. The module sets the SL of a buy order below the current price, not necessarily below the buy order's open price. Because the SL is set below the current price, it's possible that when the SL gets hit, the order is in profit, it's also possible because of trailing. Many traders use this module to capture profits the moment the price retraces. For a sell order, everything is in reverse, so the module sets the SL of a sell order above the current price.
SettingsIf you want to create a fixed SL line you can set Trail step size to 0. Now it's not trailing, but instead you've created a fixed SL line based on a condition.
The Stop loss - Conditional (Pro) – Close module, will evaluate if open orders have hit their SL. After an order has been opened (see '1' in image below), the module will set the stop loss (SL) when a (complex) condition has become true (see '2' in image below). When the price hits the SL (see '3' in image below), the order will be closed. The module sets the SL of a buy order anywhere you want below the current price, not necessarily below the buy order's open price. Because the SL is set anywhere below the current price, it's possible that when the SL gets hit, the order is in profit; it's also possible because of trailing. Many traders use this module to capture profits the moment the price retraces. For a sell order, everything is in reverse, so the module sets the SL of a sell order anywhere you want above the current price.
SettingsIf you want to create a fixed SL line you can set Trail step size to 0. Now it's not trailing, but instead you've created a fixed SL line based on a precondition.
The Take profit - Close module, will set a take profit (TP) directly after opening an order (see '1' in image below). The module will then wait for the TP to be hit (see '2' in image below) and then close the order/ order scope.
SettingsUse this module if you want to close the order when the order is recovering from drawdown. This is an uncommon scenario for most users. Most users want the trail to be on the bottom side of the price (stop loss), allowing new highs, but stopping out when the price retraces. If that's the case for you, use the Stop loss - Trailing Module.
The Take profit - Trailing – Close module, will not set a take profit (TP) directly after opening an order (see '1' in image below), but will wait for the price to hit the threshold (see '2' in image below). Only then the take profit (TP) is set (see '3' in image below). If the price hits the TP, the module closes the order. The module sets the TP of a buy order above the current price, not necessarily above the buy order's open price. Because the TP is set above the current price, it's possible that when the TP gets hit, the order is in loss; it's also possible because of trailing.
SettingsUse this module if you want to close the order when the order is recovering from drawdown or if you want to reduce the target TP when the price is moving against you. This is an uncommon scenario for most users. Most users want the trail to be on the bottom side of the price (stop loss), allowing new highs, but stopping out when the price retraces. If that's the case for you, use the Stop loss - Conditional Module.
Take profit - Condition – Close module, will set the take profit (TP) when a (complex) condition has become true (see '2' in image below). When the price hits the TP (see '3' in image below), the order will be closed. The module sets the TP of a buy order above the current price, not necessarily above the buy order's open price. Because the TP is set above the current price, it's possible that when the TP gets hit, the order is in loss, it's also possible because of trailing. Many traders use this module to reduce losses the moment the price retraces back in their favour. For a sell order, everything is in reverse, so the module sets the TP of a sell order below the current price.
SettingsTip: If you want to create a fixed TP line you can set Trail step size to 0. Now it's not trailing, but instead you've created a fixed TP line.
The Take profit - Conditional (Pro) – Close module, will evaluate if open orders have hit their TP. After an order has been opened (see '1' in image below), the module will set the take profit (TP) when a (complex) condition has become true (see '2' in image below). When the price hits the TP (see '3' in image below), the order will be closed. The module sets the TP of a buy order anywhere you want above the current price, not necessarily above the buy order's open price. Because the TP is set anywhere above the current price, it's possible that when the TP gets hit, the order is in loww; it's also possible because of trailing. Many traders use this module to reduce losses the moment the price retraces back in their favour. For a sell order, everything is in reverse, so the module sets the TP of a sell order anywhere you want below the current price.
SettingsIf you want to create a fixed TP line you can set Trail step size to 0. Now it's not trailing, but instead you've created a fixed TP line based on a precondition.
The Maximum lifespan - Close module, will wait for an amount of time and then close an order, if the order wasn't closed yet.
SettingsModules which prevent opening prevents opening any new orders.
The Margin requirements – Prevent open module, will prevent opening new orders based on your available margin, to protect your account to some degree from margin calls. We advise all live traders to use this module with defensive settings.
SettingsThe percentages used in the settings above are not referring to the Margin Level percentage. Let's say you want to at least stay above 400% of Margin Level. Here's an example on how to use this module: you have an account of 10.021 USD, which means you now have 10.021 USD of free margin, which is 100% of 'free margin' and 0% of margin used. If I open an order of 0.05 BTC, I'll use 743 USD of margin. That's about 7.4% of margin used by this particular EA. So my 'free margin' is now 92.6%. If I had set the 'Maximum EA margin' to 7.4%, or the minimum free margin to 92.6%, the EA could now no longer open a second order, because the next order would use 7.4% as well. 14.8% (7.4% + 7.4%) would exceed the maximum of margin 7.4% and also the minimum of free margin of 92.6% would be violated. Had I put a maximum of 5% from the start, then the first 0.05 BTC order wouldn't have opened either, because before opening an order the amount of required margin is calculated and evaluated.
Now about the Margin Level percentage. Let's say you want a Margin Level minimum of 400%:
Minimum free margin (%) = 100 - 100 x (100 / Margin Level)
Minimum free margin (%) = 100 - 100 x (100 / 400)
Minimum free margin (%) = 75
So your 'Minimum free margin (%)' setting should be set to 75. Alternatively, you could set your EA to only use 25% of your margin, by setting the 'Maximum EA margin (%)' to 25.
The Max Spread – Prevent open module, will prevent your Open Buy/ Open Sell signals from opening an order if the spread (difference between bid and ask) is bigger than a set amount. If this is the case and the spread decreases below the maximum at a later time, the Open Buy/ Open Sell signal needs to activate again before an order is opened; old activations do not cause an order to be opened.
SettingsThe Trading session – Prevent open module, will prevent opening orders outside opening and close times.
Example: we set the module to only open orders between 09:00 and 15:00. The module prevents opening orders from 15:00 afternoon till the next morning 09:00. So, if you set the trading session to between 09:00 and 15:00, then you allow an order to be opened at 9:30 or 10:00, but not at 18:00 or 06:00 (outside of the session). In this example, if the Open signal (Open buy/ Open sell) activates at 09:10 then the module won't prevent the order from opening.
You will have to make sure the times are set based on your broker's server time correctly.
You can find your current broker's server time at the top of the Market Watch in MetaTrader, or in the top left corner of the chart after adding your EA.
Orders will be closed by Close- Signals and Modules within or outside of these times; this module will not automatically close orders. Neither will it prevent the order(s) from being closed. Only 1 modules of this type can be added. This module can be used in collaboration with the Trading session exclusion module.
When backtesting on our online backtesting servers, the time on MT4 and MT5 is set to GMT+3 while US daylight savings is in place, and GMT+2 when the US is not under daylight savings.
SettingsThe Trading session exclusion – Prevent open module, will prevent trading during set times.
Example: we set the module not to open orders between 15:00 and 09:00. The module prevents opening orders from 15:00 afternoon till the next morning 09:00. So, if you set the trading session exclusion to between 15:00 and 09:00, then you allow an order to be opened at 9:30 or 10:00, but not at 18:00 or 06:00 (wihtin the exclusion). In this example, if the Open signal (Open buy/ Open sell) activates at 09:10 then the module won't prevent the order from opening.
You will have to make sure the correct times are set based on your broker's server time.
Orders will still be closed by Close- Signals and Modules within or outside these times.
This module will not automatically close orders. Multiple modules of this type can be added. This module can be used in collaboration with the Trading session module.
When backtesting on our online backtesting servers, the time on MT4 and MT5 is set to GMT+3 while US daylight savings is in place, and GMT+2 when the US is not under daylight savings.
SettingsThe Time gap between orders – Prevent open module, will wait a set amount of time between the last (open or closed) order and a new open order.
SettingsThe Time gap after loss – Prevent open module, will prevent opening a new order for a set amount of time when an order is in loss or a closed order resulted in a loss.
SettingsThe Pip gap between orders – Prevent open module will prevent the opening of an additional order until there's a certain amount of price between the Open prices of orders.
SettingsBoth the 'Apply to orders in profit' and 'Apply to orders in loss' can be enabled at the same time.
Important considerations
This module only prevents opening orders and does not open a new order when the gap has been formed. If you need an order to open automatically once the gap has been formed, please check out our 'Grid Trend' and 'Grid Trend reversal' EA templates and study the Open Buy and Open Sell signals.
The Maximum Loss – Prevent open module, will prevent opening new trades when an amount of loss has been reached within a window of time (timeframe), including the profit/loss of the currently opened orders.
SettingsAfterthought from the team
We could've built a module which closes all current orders when the maximum loss has been reached, but we decided not to and instead only prevent opening new orders. Why? We believe when an EA opens an order it should allow for the order to run its normal course, instead of potentially being cut off premature. We believe that maximum loss shouldn't be an afterthought, but should be a well thought out part of the EA. Therefore we recommend the following approach: when you want a maximum of 5% of loss a day without passing that percentage, then please make sure that the sum of your maximum loss (of this module) and your Stop Loss percentage (from the Stop Loss module) will never pass 5%. So if your Stop Loss module has a SL of 1% of equity, then you would be wise to set this module to 3.5 % of equity.
The Maximum Profit – Prevent open module, will prevent opening new trades when an amount of profit has been reached, withing a window of time (timeframe), including the profit/loss of the currently opened orders.
SettingsAfterthought from the team
We could've built a module which closes all current orders when the maximum profit has been reached, but we decided not to and instead only prevent opening new orders. Why? We believe when an EA opens an order it should allow the order to run its normal course, instead of potentially being cut off premature. We believe that maximum profit shouldn't be an afterthought, but should be a well thought out part of the EA. Therefore we recommend the following approach: when you want a maximum of 5% of profit a day without passing that percentage, then please make sure that the sum of your maximum profit (of this module) and your Take profit percentage (from the Take Profit module) will never pass 5%. So if your Take profit module has a TP of 1% of equity, then you would be wise to set this module to 3.5 % of equity.
Next: Money manager