Expert Advisor (EA) Modification & Bug Fix

Job ID: 40168686

Budget: ₹600 – ₹1,500 INR

1. EA Overview & Restoration
The existing EA includes custom code for Lot Size, Pip Gap, Stop Loss (SL), and Take Profit (TP) for each trade. It utilizes three internal indicators (Ind4, Ind5, and Ind6) and has the functionality to connect to external custom indicators.
• Issue: The code for Ind6 was accidentally deleted and needs to be restored/re-added.
• Task: Please fix Ind6 and test the EA using a default lot size of 0.01.
2. Partial Close on Reverse Signal
Currently, the EA closes all open trades when a reverse signal occurs. I want to add additional to this behavior to target only profitable positions. I require separate inputs for Buy and Sell orders:
• Input: Close Buy Profitable Trades (True/False)
• Input: Close Sell Profitable Trades (True/False)
3. Hedging Logic & Lot Calculation
When a reverse signal occurs, after closing the profitable trades, the EA should calculate the total volume (lots) of the remaining losing trades and open a hedge position with that exact total.
• Input: Buy Hedge (True/False)
• Input: Sell Hedge (True/False)
Example Scenario (Silver):
• Open Buy Trades:
o 0.01 @ 95.0 (Loss)
o 0.02 @ 93.0 (Loss)
o 0.03 @ 92.0 (Loss)
o 0.04 @ 90.0 (Profit)
• Current Price: 91.0
• Action: A Sell Signal arrives. The EA should close only the 0.04 lot position (the profitable one).
• Hedge Calculation: Sum of remaining lots ($0.01 + 0.02 + 0.03 = 0.06$).
• Result: Open a new Sell Order with a lot size of 0.06.