작업 종료됨
명시
I will share the source code with you when the contract is agreed upon.
I would like to add a new feature to my EA that will make the EA to close the initial open position whenever the stop order is triggered
Currently, the EA, robot trades hedging strategy is described below.
When the market price reaches a specified price level, this robot will open either buy or sell trade (as specified) at a specified lot size, and at the same time it would hedge it by placing a sell stop order or buy stop simultaneously at a specified lot size (this can be fixed or in increasing steps) and at specified pips or point away from the first buy trade. It will hedge buy position with sell stop and sell position with buy stop order.
For example, if I specify that when the price gets to 1.3500 for GBPUSD the robot should open buy position/trade. Then when the price touches the price level of 1.3500, the robot would open a buy trade at this specified 1.3500 price line and at the same time places a sell stop order at the specified pips away from this first buy position/trade on the current timeframe. If price then turns and activates the sell stop order before total take profit or take profit price level is reached, then the robot would simultaneously open another buy stop order at the specified lot size and at the specified pips distance away from the trade that have just been activated in order to hedge the newly activated order and the cycle continues until the total take profit or take profit price level is reached when the robot would close all opened trades and delete un-activated pending stop order.
For the sell scenario, the robot will open the first sell trade if the price reaches the specified price level and would at the same time also opens a buy stop order at a specified lot size (this can be fixed or in increasing steps) and at a specified pips or points distance away from the first sell trade. if the price then turns and activates the buy stop order before total take profit or take profit price level is reached, the robot will automatically open another sell stop order at the same specified lot size (this can be fixed or in increasing steps) and at a specified pips or points distance away from the buy trade and the cycle continues until total take profit or take profit price level is reached when the robot would close all the trades and deletes un-activated stop pending order. The robot has the following filters:
1. Time filter
2. Days of the week filter
3. Spread filter
4. Buy or sell only option or both
5. Date filter
The present input dialogue is like this:
S/N | Variable | Value |
| Entry Price | 0.0000 |
| First Lot size | 0 |
| Total Take profit | 0 |
| Take Profit price | 0.0000 |
| Total stop loss | 0.0000 |
| Hedge Distance in points | 0 |
| Hedge Lot size | 0 |
| Hedge Lot size increase type | Fixed or Increasing or Multiplier |
| Increasing step | 0 |
| Increasing multiplier | 0 |
| Max spread points | 0 OR Disabled |
| Trading start time | 0:00 |
| Trading End Time | 0:00 |
| Days To Trade | Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday OR Disabled (that the filter is able and therefore the EA can trade anytime) |
| Open Buys | True/False |
| Open Sell | True/False |
THE EXTRA FUNCTION I WANT TO ADD TO THIS ROBOT NOW.
I need additional functionality to be able to instruct the EA to close initial open position whenever the stop order is activated. For example, if I specify that when the price gets to 1.3500 for GBPUSD the robot should open a buy position/trade. Then when the price touches the price level of 1.3500, the robot would place a buy trade at this specified 1.3500 price line and at the same time places a sell stop order at specified pips away from this first buy position/trade on the current timeframe. If price then turns and activates the sell stop order before the Total profit/price level is reached, then the robot will close the open first buy position (which is now in loss) and simultaneously open a buy stop order at the specified lot size and at the specified pips distance away from the trade that has just been activated and the cycle continues until a total take profit or take profit price level is reached when the robot would close all opened trades.
It should also display the total loss of closed trades so far and the current profit on one side of the screen.
The new input dialogue box will look like this:
S/N | Variable | Value |
| Entry Price | 0.0000 |
| First Lot size | 0 |
| Total Take profit | 0 |
| Take Profit price Buy side | 0.0000 |
| Take Profit price Sell side | 0.0000 |
| Hedge Distance in points | 0 |
| Hedge Lot size | 0 |
| Hedge Lot size increase type | Fixed or Increasing or Multiplier |
| Increasing step | 0 |
| Increasing multiplier | 0 |
| Hedging Type | Leave previous Trade open when new order is activated or close previous trade when new order is activated |
| Max spread points | 0 |
| Trading start time | 0:00 or Disabled |
| Trading End Time | 0:00 or Disabled |
|
|
|
|
|
|