Here it is,
Completely rewritten code and also bug free now.
Additional parameters were added:
1. Trend following option:
You have now option for trades to follow higher trend. You can chose up to 3 higher time frames in parameters.
For example: 60min, 240min and 1440min, This means, trades will be only opened, when price will be above all 3 higher candles open lines.
When price will be in between, it is considered as ranging market and Ea will not take additional trades. You can also set all 3 open lines to the same time frame.
For example: 60min, 60min, 60min....this means Ea will open buys only above 60min and sell trades only below 60min. You can set open lines up to weekly time frame.
Here are 2 pictures of explanation of trend following parameter, for better understanding:
2. Hedging option:
There is also an option to hedge trades now. How this works is, is that you can chose after how many losing trades, a hedge option should be activated.
For example: Let's say you trade with 0,1 lots and you set in hedge parameter 4, that means that after 4 losing trades with 0,1 lots EA will open an opposite hedge order
with lot 0.5 (0.1 * 4 + 0.1). It will not open any additional trades, until hedge order and all the losing trades are closed. You have an option to set this parameter on or off.
There is also trailing stop option and trading hours option.
These are currently new bells and whistles regarding this Hedging EA.
While writing this, I just had another brain fart, to have the opposite option. Instead of EA following the trend logic, it could be used to trade only in ranging market and not trade, when trending. But for now, I'll leave it here for you guys and testing purposes, and maybe add that later. I am open for new ideas and suggestions, and further testing.
I have also added one experimental SET file, for you to start playing and testing with. Ea can be also backtested, so feel free to abuse that mt4 backtester
Keep us posted and best regards.