工作已完成
![](https://c.mql5.com/i/avatar/avatar_na2.png)
指定
Hello, I would like to create a bot using the Martingale strategy. Can you help me?
Let me first outline the simplest conditions:
- No trades are opened at 23:00.
- Buy and Sell are managed separately.
- When there are no open trades, Buy and Sell are opened simultaneously.
This is the starting condition for the Martingale each time.
GRID:
I would like to choose the size of the Martingale by modifying a parameter called "drawdown pips."
If "Drawdown pips" = 20, the Martingale will continue every 20 pips of drawdown.
This parameter should be adjustable.
The Martingale (2 trades or more) is closed when the average price is in a profit of 4 pips.
This parameter should be adjustable.
IMPORTANT: If there is only one Sell (or only one Buy) open, it should be closed at the opening of the next Buy or Sell and NOT AT 4 PIPS TP (and a new one is opened).
If there are open Buy and Sell trades, and the price rises by 20 pips, when the second operation (Sell) is opened, the Buy in profit is closed, and a new one is opened.
We will reach a point where the Sell Martingale ends, and the Buy Martingale begins. The next Sell will be opened together with the next Buy.
For each new Buy opened in the following Martingale, a Sell is opened and closed at next buy.
So, every time the Martingale continues, the trade of the opposite sign is closed and reopened every 20 pips.
By doing this, there can never be 2 Buys and 2 Sells simultaneously.