Lavoro terminato
Specifiche
EA Programming Request
This EA aims to manage user-opened trades by adding a pending order based on specific conditions. This pending order has a configurable size and Take Profit (TP) level, depending on the original trade opened by the user.
EA Components
-
Original Position
-
This is the trade manually opened by the user.
-
The trade has a user-defined Stop Loss (SL) and Take Profit (TP).
-
-
Stop Loss Percentage - Entry
-
Defines the distance from the Stop Loss to the pending order, expressed as a percentage.
Example:
-
Long entry at price 100.
-
Stop Loss at 90 (10 points distance).
-
Stop Loss Percentage - Entry of 30%.
-
Pending order placed at price 93. (30% of 10 points = 3 points, so it will be placed 3 points above the SL for a long entry).
-
-
Position Multiplier
-
A multiplier for the size of the pending order compared to the original position.
Example:
-
Initial entry with 1 lot.
-
Multiplier of 3.
-
The pending order will have a size of 3 lots.
-
-
Modes of TP Placement for the Pending Order
-
Mode 1: Set the TP at the entry price of the original position.
-
Mode 2: Set the TP at the TP price of the original position.
-
Mode 3: Set 50% of the TP at the entry price of the original position and the other 50% at the TP of the original position.
-
-
System Scope Modes
-
Mode 1: Only valid for the current symbol (applies only to the asset with the open position).
-
Mode 2: Valid for all trades in the account (applies to all open positions in the account).
-
EA Operation
-
The user manually opens an original position, with a defined Stop Loss and Take Profit.
-
The EA automatically places a pending order based on the Stop Loss Percentage - Entry defined by the user.
-
Stop Loss Percentage - Entry determines the distance from the Stop Loss where the pending order is placed.
-
-
The pending order will have:
-
Size defined by the Position Multiplier (i.e., a larger or smaller size compared to the original position).
-
Take Profit based on the selected mode (Mode 1, Mode 2, or Mode 3).
-
Stop Loss will always be the same as the Stop Loss of the original position.
-
Examples of TP Placement Modes
Mode 1: Set the TP at the entry price of the original position
Example:
-
User opens a long position at price 100.
-
Stop Loss at 90 (10 points distance).
-
Take Profit at 110.
-
-
Stop Loss Percentage - Entry: 30%.
-
Pending order placed at 93 (30% of 10 points = 3 points, so the pending order price will be 90 + 3).
-
-
Position Multiplier: 2.
-
The pending order will be 2 lots.
-
-
TP Placement Mode: Mode 1.
-
The TP of the pending order is set at the entry price of the original position, i.e., 100.
-
Mode 2: Set the TP at the TP price of the original position
Example:
-
User opens a long position at price 100.
-
Stop Loss at 90 (10 points distance).
-
Take Profit at 110.
-
-
Stop Loss Percentage - Entry: 30%.
-
Pending order placed at 93.
-
-
Position Multiplier: 2.
-
The pending order will be 2 lots.
-
-
TP Placement Mode: Mode 2.
-
The TP of the pending order is set at the Take Profit price of the original position, i.e., 110.
-
Mode 3: Set 50% of the TP at the entry price of the original position and the other 50% at the TP of the original position
Example:
-
User opens a long position at price 100.
-
Stop Loss at 90 (10 points distance).
-
Take Profit at 110.
-
-
Stop Loss Percentage - Entry: 30%.
-
Pending order placed at 93.
-
-
Position Multiplier: 2.
-
The pending order will be 2 lots.
-
-
TP Placement Mode: Mode 3.
-
The TP of the pending order is divided into two parts:
-
50% of the position size has TP at the entry price of the original position, i.e., 100.
-
The remaining 50% has TP at the Take Profit price of the original position, i.e., 110.
-
-
Complete Example
Example:
-
User opens a long position at price 100.
-
Stop Loss at 90 (10 points distance).
-
Take Profit at 110.
-
-
Stop Loss Percentage - Entry: 30%.
-
Pending order placed at 93 (30% of 10 points = 3 points, so the pending order price will be 90 + 3).
-
-
Position Multiplier: 2.
-
The pending order will be 2 lots.
-
-
TP Placement Mode: Mode 1.
-
The TP of the pending order is set at the entry price of the original position, i.e., 100.
-
With this logic, the EA helps manage user-opened trades automatically, allowing for hedging strategies and increasing exposure under specific conditions.
Note: The Stop Loss will always be the same as the original position opened by the user.