The Hedge MT4
This script searches for all positions for the current currency pair and calculates the sum of all lots for those positions with negative profit and offers to open a hedge (opposite) position with a lot size equal to the calculated sum of lots multiplied by LotCoeff.
You just need to drop this script on the chart with a desired currency pair.
Before placing opposite orders, the input window is opened allowing you to modify all the input parameters:
- LotCoeff = 1.5;
- BuySearch = true;
- SellSearch = false;
- Slippage = 2;
- MagicNum = 12345;
You have to allow automated trading on the Expert Advisors tab (Tools->Options).
You have to allow auto trading in the input window.