AutoTrailingandSLTP
- 实用工具
- Kimitaka Yoshikawa
- 版本: 1.3
- 更新: 7 二月 2025
1. Overview
This EA is a discretionary trading support tool for MT4 that enables batch SL/TP operations for open positions and pending orders, as well as trailing stops based on unrealized profit amounts. To use it, attach the EA to a chart while MT4's "Auto Trading" is enabled.
2. Trailing Stop Function
2.1. Basic Specifications
The standard MT4 trailing stop is set in points, but this EA allows you to set the trailing stop based on unrealized profit amounts (in USD or JPY), making it more intuitive and easier to use.
- The trailing stop is automatically applied to all positions, including filled pending orders.
- If an invalid stop-loss value is specified due to stop-loss restrictions, the trailing stop will not be executed.
- Spreads are not considered, so they must be factored into the settings.
- The trailing stop is determined on each tick, meaning there may be slight discrepancies during sudden market movements.
- The profit amount used for trailing can be switched between JPY and USD.
- Since the EA processes data on each tick, the reaction speed of the trailing stop does not depend on the chart’s timeframe. However, some brokers update OnTick faster on shorter timeframes, so in such cases, setting the EA on a shorter timeframe is recommended.
2.2. Trailing Stop Mechanism
Trailing starts when the specified unrealized profit amount is reached. The initial stop-loss (SL) is set as follows:
[Trailing Start Amount] - [Trailing Step] = Initial SL Position
As profits increase, SL is updated by the trailing step amount.
Example (JPY):
-
Start Amount: 10,000 JPY, Step: 5,000 JPY
- When unrealized profit reaches 10,000 JPY, trailing begins, and SL is set at 5,000 JPY.
- If unrealized profit increases to 15,000 JPY, SL is updated to 10,000 JPY.
-
Start Amount: 100,000 JPY, Step: 20,000 JPY
- When unrealized profit reaches 100,000 JPY, trailing begins, and SL is set at 80,000 JPY.
- If unrealized profit increases to 120,000 JPY, SL is updated to 100,000 JPY.
Example (USD):
- Start Amount: 100 USD, Step: 50 USD
- When unrealized profit reaches 100 USD, trailing begins, and SL is set at 50 USD.
- If unrealized profit increases to 150 USD, SL is updated to 100 USD.
3. Batch SL/TP Operation Function
3.1. Basic Specifications
This function allows you to set SL/TP values for open positions and pending orders in bulk, as well as close orders in bulk.
- SL/TP can be applied to open positions and/or pending orders.
- Pending orders can be canceled in bulk.
- Open positions can be closed in bulk.
- When used with the included EA "MultiCloser," bulk closing operations can be executed at high speed.
3.2. Button Descriptions
- SL: Enter SL price in the input box and click the "SL" label to apply it.
- TP: Enter TP price in the input box and click the "TP" label to apply it.
- Pending (True/False): When set to "True," SL/TP will be applied to pending orders as well.
- Open (True/False): When set to "True," SL/TP will be applied to open positions as well.
- ClosePending: Click "Apply" to cancel all pending orders.
- CloseOpen: Click "Apply" to close all open positions.
3.3. Additional Notes
- To cancel an SL/TP, enter "0" in the respective SL or TP input box and click the corresponding label.
- If you want new manual trades to inherit existing SL/TP values, click the SL or TP label to apply the settings.
4. Disclaimer
The developer is not responsible for any trading results when using this EA. Please use it at your own discretion and ensure you fully understand the risks involved.