A few days ago I received a PM to code an EA with the following parameters:
-User decides initial trade direction (let's say long) and starting lot size (say .1 lot)
-New position would be added every time the market moves x pips (say 10 pips) up or down away from the most recent position taken. If market moves up from the original position 10 pips a new long is added. If the market moves down 10 pips from the last position a short is added (basically following the market looking to catch a trend in either direction).
-Each new position size increased by x (ex: .1 lot)
-Take profit based on account %
-Stop loss based on account %
-Max number of standard lots before EA can't taken any new positions (at this point the T/P or S/L will need to be hit when max is reached)
-Re-enter mode would start a new progression again once the prior progression has ended do to T/P or S/L being hit
-Magic number to run on multiple pairs
I did my best to code such an EA.
The expert I made uses a .mqh file that must be saved in your include folder.
The expert WILL NOT function without it.
All are welcome to critique or improve the code I wrote. PLEASE read ALL the comments in the code to understand the external variables. Default settings are just a guess, testing and optimization needs to be performed.
I'm not sure if this strategy is viable, these type of experts can get you into trouble quick! So use for testing only!
The EA starts by using a EMA for initial long or short starting direction. Just an idea. Maybe someone has a better idea?
Enjoy.
