İş tamamlandı
İş Gereklilikleri
i need to repair the existing EA that has been wrongly written.
Here is a summary of the requirements for the EA and how they must been implemented in the code:
On every new bar, the EA needs to analyze the chart to see if there are any open positions. If there are no positions, the EA will enter a trade based on the candle: bullish candles will result in a buy trade, bearish candles will result in a sell trade. This must be implemented in the OnTick() function.
If the chart already has positions entered by the EA, the EA will only enter a new trade if the last position is at a loss. The lot size for the new position must be calculated using the martingale method. This must be implemented in the MartingalePosition() function.
The EA name and the number of positions of the same direction should be added to the comment section for each trade. This must be implemented in the FirstPosition() and MartingalePosition() functions.
If Hedging is set to false, the EA will only enter trades in one direction at a time. If the first position is a buy trade, all subsequent martingale positions must also be buy trades. If the first position is a sell trade, all subsequent martingale positions must also be sell trades. If Hedging is set to true, the EA will enter trades in both directions. This must be implemented in the MartingalePosition() function.
After every trade, the EA will modify the take profit of all positions in the same direction to a single break even point plus a take profit level. This must be implemented in the ModifyTakeProfit() function.
The global variables should include the lot size, take profit level, martingale multiplier, EA name, expiry date, magicnumber, and Hedging flag. These global variables must be defined at the beginning of the code.
The code should be sorted into blocks for each part of the EA's functionality, such as entering the first position, entering martingale positions, and modifying the take profit level. The code must be organized into separate functions for each of these parts.