工作已完成
![](https://c.mql5.com/i/avatar/avatar_na2.png)
![](https://c.mql5.com/i/avatar/avatar_na2.png)
指定
Martingale EA
Starting Lot size : 0.01 ( user can enter initial lot size )
Order Type : BUY and SELL ( possible values are “BUY”,”SELL” and “ BUY and SELL”
Multiplier : 2 ( User entered value to multiply lot size on each trade )
TP : 25 pips ( User entered )
Gap for each Trade : 25 pips ( User entered)
Increment TP for every step : 1 pip ( User entered , whenever trades gets multiplied then this value should be incremented with this value)
Close earlier lots : 2 level ( Let’s say if BUY opens 0.01,0.02 lots are opened and whenever it opens 0.04 lot it should close 0.01 lot based on user input (“level 2”) ( if user enters Level 1 then previous lot should be closed - example : BUY 0.01 opened and whenever 0.02 lot opened the previous 0.01 lot should be closed if user enters level 1 )
EA should have a option to select place BUY and SELL order option or only BUY or only SELL.Based on Lot size it should place orders.”Gap for each trade” specifies where to open trade after opening initial orders.
For example : As soon as EA starts it should open BUY and SELL order ( let’s say lot size entered is 0.01)
BUY @ 110.00 and SELL @ 110.00 ( I am aware that based on spread the price will gets changed , I’m just giving an example ).”Gap for each trade” entered is “25 pips” and Multiplier as “2”.TP is “25”
it should open BUY next trade at 109.75 ,lot size is 0.02.By the time it opens BUY , SELL would have reached to 25 pips profit then it should be closed and then open new SELL order with 0.01 lot(initial size) .
BUY 0.01 110.00 TP = 25 SELL 0.01 110.00 TP for SELL “25”
BUY 0.02 109.75 TP=25+1 Book profit above SELL order and open SELL 0.01 @109.75 ( initial lot size ) TP for SELL is “25”
BUY 0.04 109.50 TP=25+1+1 Book profit above SELL order and open SELL 0.01 @ 109.50 TP for SELL is “25”
For every level TP should be increased by “1” pip entered by user .
At this point based on “Close earlier lots” it should close BUY 0.01 lot and keep 0.02 and 0.04 lots.
Let’s say if market goes back to 109.77 then it should book profit for BUY 0.04 lot and close all BUY lots ,immideaitely open BUY 0.01 at current level .
By this time SELL must be running on 25 pips loss ,based on requirement it should open 0.02 lots.
This looks like below.
BUY 0.01 109.77 TP_BUY 25 SELL 0.01 109.50 TP 25
SELL 0.02 109.75 TP 25+1
In a short , this works like below ..
Open BUY and SELL order at the starting .
if price is going down BUY lots will be executed with multiplier and close earlier lots based on user entered levels.SELL 0.01 lot will be booked profit and goes on with 0.01 lots till it gets reverse turn.
if price is going up SELL lots will be executed with multipier. BUY 0.01 lot will be booked profit and goes on with 0.01 lots till it takes reverse turn.
This requirement looks bit confusing ,let me know if anyone needs clear explanation.
Thanks,
Balaji G.