TPD - Take Profit Dynamic
Concept diagram
The concept diagram provided below depicts the function block associated with this page.
Enabling of take profit dynamic
The Take Profit Dynamic function block introduced by the Expert Advisor Builder revolutionizes automated trading. Typically, a take profit is a predetermined price at which an active trade will close to secure profits. Once set, the take profit level is usually not adjusted, except in certain circumstances, such as when the stop loss level is modified to maintain the initial risk ratio.
An alternative, less conservative approach involves adjusting the stop loss level when the price rapidly moves in favor of the trade. For instance, during news events trading, the price can change quickly, potentially causing an early trade closure due to a preset take profit. To mitigate this, detecting a swift and favorable price change and adjusting the stop loss level to maximize profits can be beneficial. This function operates as the inverse of a trailing stop loss, allowing the price to push the take profit level within certain limits. This strategy is based on past price movements, particularly in shorter timeframes. Manual management of such a strategy can be challenging and stressful. However, trading modules created with the Expert Advisor Builder can respond almost instantly to market volatility, making implementing dynamic take profit adjustments easier.
To set up a dynamic take profit, you can choose from three types of take profit adjustments using the > (TPD) Type input parameters.
Input variable within MetaTrader (Identifier in SET file) | Default value | Comment |
---|---|---|
> (TPD) Type (IN_enmTpdType) | OFF | Numeric values usable in SET files: 0 - OFF 1 - LINEAR 2 - MARKET |
> (TPD) Type = OFF
This default setting keeps the take profit level constant at the initially configured value throughout the entire trade lifespan. This option is illustrated in the image below.
To reproduce the chart from above, you can download and use the SET file package um_eab_ctpd_2_v_2_0.zip.
> (TPD) Type = LINEAR
This method adjusts the take profit level after each bar in the active timeframe, resulting in a strictly linear increase or decrease. The effect of this is illustrated in the image below.
To reproduce the chart from above, you can download and use the SET file package um_eab_ctpd_3_v_2_0.zip.
> (TPD) Type = MARKET
This option allows the take profit level to move under certain conditions, particularly in response to rapid price changes within a short period. This movement is minimal and can slightly increase the profit of a trade. The illustration below shows a dynamic adaptation of the take profit level, which increases the profit by about 10% compared to a static take profit.
To reproduce the chart from above, you can download and use the SET file package um_eab_ctpd_4_v_2_0.zip.
Parameters for linear steps based take profit dynamic
The linear steps stop loss trailing method increases or decreases the take profit after each bar in the currently active timeframe, resulting in a strictly linear increase or decrease of the take profit level.
Input variable within MetaTrader (Identifier in SET file) | Default value | Comment |
---|---|---|
> (TPD) Linear step (IN_nTpdLinearStep) | 5 | The input parameter can be positive or negative. |
As is customary, the initial take profit distance is determined by the difference between the opening price and the initial take profit. This value represents 100. The only input parameter for this dynamic method is the step size, defined by > (TPD) Linear step. The default value is 50, meaning the take profit will increase by 0.5% x the initial take profit difference after each bar. For instance, if the initial take profit difference was 1000 pips, the take profit level will increase by five pips after every closed bar. The increment for the dynamic take profit adjustment might be tiny in some cases, potentially resulting in the next step being smaller than the smallest possible increment for changing the take profit. The dynamic take profit adjustment increment can be either positive or negative.
This dynamic take profit option is handy during iterative optimization to determine optimal trade exit timings with a maxed-out diagram. If you plan to use this feature in live trading systems, using it with a trailing stop loss is strongly recommended. This ensures a balanced and effective trading strategy.
The following examples illustrate how to increase or decrease the take profit level linearly. Please note that these examples are for illustrative purposes, and the actual implementation may vary based on your specific trading strategy and market conditions.
To reproduce the chart from above, you can download and use the SET file package um_eab_ctpd_5_v_2_0.zip.
Parameters for market based take profit dynamic
The input parameters for configuring the final Take Profit Dynamic option are detailed below. This algorithm allows you to instruct a trading module to adjust the take profit level in response to rapidly fluctuating prices, potentially increasing the profit per trade.
Input variable within MetaTrader (Identifier in SET file) | Default value | Comment |
---|---|---|
> (TPD) Market bars max (IN_nTpdMarketBarsMax) | 4 | The input value cannot be smaller or equal to 0. |
> (TPD) Market M1 (Market M1 < Market M2) (IN_nTpdMarketM1) | 40 | The input value has to be between 0 and 100. |
> (TPD) Market M2 (Market M1 < Market M2) (IN_nTpdMarketM2) | 80 | The input value has to be between 0 and 100. The input value cannot be smaller or equal to IN_nTpdMarketM1. |
> (TPD) Market end (min -> '100 - Market M2') (IN_nTpdMarketEnd) | 25 | The input value has to be between 0 and 100. The input value cannot be smaller or equal to 100 - IN_nTpdMarketM2. |
The Take Profit Dynamic algorithm can be configured using four input parameters. While the default parameters provide a robust and responsive configuration for dynamic take profit adjustment, you can customize the algorithm using the following parameters:
- > (TPD) Market bars max: This parameter defines the time range to detect a rapid price movement. A smaller value means the price must change more quickly to trigger dynamic take profit modification.
- > (TPD) Market M1 (Market M1 < Market M2): This parameter sets the upper threshold that must be exceeded to activate dynamic movement. Dynamic movement is only unlocked when the Market M1 and Market M2 levels are surpassed within the defined period measured by bars.
- > (TPD) Market M2 (Market M1 < Market M2): This parameter sets the lower threshold that must be exceeded to activate dynamic movement. As with Market M1, dynamic movement is only unlocked when both thresholds are surpassed.
- > (TPD) Market end (min -> '100 - Market M2'): This parameter sets the threshold that the price must pass to turn off dynamic movement.
All input parameters use the initial take profit difference as the 100% reference price difference. Please refer to the following function principle and example charts for further clarification.
To reproduce the chart from above, you can download and use the SET file package um_eab_ctpd_6_v_2_0.zip.