• Overview
  • Reviews (1)
  • Comments (63)
  • What's new

Exp Swing

Swinger Expert Advisor

It uses the model of a famous strategy called Swinger - alternate placing of pending orders with increased lot. 

Two pending opposite orders are opened and when one of them is activated, the second one is replaced till the entire basket is closed by take profit.  

The algorithm of a partial position closure Exp TralPartionClose has also been added.

At the start, the Expert Advisor places two orders - Buy Stop and Sell Stop on the distance StopOrderDeltaifUSE from the current price. If Buy Stop triggers, Sell Stop will be deleted and a Sell Stop order with the volume BuyStop * Martin will be placed instead. If Sell Stop triggers, Buy Stop will be deleted and a Buy Stop order with the volume Sell Stop * Martin will be placed instead.

When take profit is reached, all the orders are deleted, and everything is repeated from the start!

To have the swing effect, the parameters StopOrderDeltaifUSE and StopLoss should be equal.

Note: there can be a situation when a broker opens an order and then closes it by a stop loss. In this case, every order will wait to be closed by take profit, and only after that the algorithm will start working from the beginning!

Do not test the EA by Open prices! Test it only on each tick. 


Default values are indicated in brackets.

  • trade_ - Trade Settings section.
  • StopOrderDeltaifUSE - distance for pending orders (100).
  • Magic - magic number (777).
  • StopLoss - stop loss, not used by default (0).
  • ModifyStopLossAtOrdersopen - change a deal's stop loss to a pending order Open level 
  • TakeProfit - take profit, not used by default (0).
  • StopDayTradingEaAfterTP - if the last position is closed by take profit, the EA stops working till the next day
  • Slippage - slippage (0).
  • MarketWatch - trading mode (false). If true, the EA will open orders/positions without stop levels, and then it will modify them. It suits when working with some brokers.
  • Lots - fixed lot (0.1).
  • Martin - martingale coefficient for the next deal opened after a losing one (2).
  • timetrade_ - Trade Time section.
  • OpenHour - trade open hour (0).
  • OpenMinute - trade open minute (0).
  • CloseHour - trade close hour (23).
  • CloseMinute - trade close minute (59).
  • Trailing_ - Trailing Stop Settings section.
  • TrailingStopUSE - use trailing stop (false).
  • IfProfTrail - breakeven mode, use for profitable positions only (false).
  • TrailingStop - trailing stop distance, minimum distance is used on default (0).
  • TrailingStep - trailing step (1).
  • StartPointToTral - level in points to start using trailing.
  • OtkatPoint - number of roll-back points to close a part of the position.
  • PercentLotToClose - percent of the initial volume to close a position.
  • StepPointToFixLevel - number of points to fix the next level.
  • MovingInWLUSE - set the position to breakeven with the first level of the trailing stop.
2017.01.15 11:41 

Перспективный алгоритм, прост и надежен как автомат калашникова! Во время выхода новостей очень быстро наращивает депозит. Автор отвечает на все вопросы, и обещал добавить много разных плюшек для повышения стабильности результатов. В общем, ждем обещанных доработок )

Version 17.730 - 2017.08.02
Fixed an error in the algorithm when using more than 3 currency pairs simultaneously.
Version 17.331 - 2017.04.06
- Increased the algorithm processing speed towards performance and receiving signals.

- Added the SecondsToRefresh parameter to the EAPADPRO block - refresh rate of the information on the chart (default is 10 seconds). This is done to reduce the CPU load.
Version 17.208 - 2017.02.14
Version 17.118 - 2017.01.27
- All external parameters are grouped for ease of use.
- Modified the logic of opening pending orders.
- Fixed the error when opening opposite order in certain cases.
- Parameter Z was renamed to MaxOrders - The maximum number of opened pending orders.
- Fixed error of accounting the current position in the series when restarting the terminal \ Expert.

- Added parameter
DeleteOppositeOrder - Delete the opposite order when triggered.
This function allows to accumulate orders without resetting the lot.
It should be noted that positions will be closed by stop loss. It is also possible to disable closing trades by stop loss: ModifyStopLossAtOrdersopen = false
This will make the grid accumulate lots and close by take profit.

- Added parameter
MaxSpreadToNotTrade and MinSpreadToNotTrade
MaxSpreadToNotTrade - Maximum spread, at which the EA can open a grid
MinSpreadToNotTrade - Minimum spread, at which the EA can open a grid
Attention: This filter is used only! for opening the First 2 pending orders.
All other functions operate as usual, including the order reversal and maintenance of orders to take profit!

- Added parameter
LotFix - lots for opening reversal, separated by commas, for example: "0.1,0.2,0.3,0.6,0.8,1"
then a custom lot size will be used for each reversal: 0.1, 0.2, 0.3, 0.6, 0.8, 1, 1, 1.....
Attention: The first lot for the first 2 pending orders is set in the Lotes parameter

- Added parameter
MartinFix - Martingale coefficient for opening reversal, separated by commas, for example: "2,3,1.5,2,1"
then martingale will be considered in each reversal, which corresponds the number of trade.
If the initial lot is 0.1, the next will be 0.2(2), 0,6(3), 0.9(1.5), 0.18(2), 0.18(1), 0.18.....

- Added parameter
CloseOppositePositionsAfterTP - Close opposite orders/positions if the current ones closed by take profit.
For example, you can disable modification ModifyStopLossAtOrdersopen = false and enable CloseOppositePositionsAfterTP =true
then, if SELL positions close by take profit, then all BUY positions and orders will be closed forcibly.

The difference between CloseOppositePositionsAfterTP and ModifyStopLossAtOrdersopen is that
in the first case, there is a LOCK until all series is closed by take profit and closure of the opposite grid. But in this case, there may not be enough margin for opening the next leg.
In the second case, the position is immediately closed by stop loss, and only 1 position with an increased lot is kept in the market.

- Added block for accounting volatility of the currency pair for opening trades
Volatility LIMIT Sets
TradebyVolatility - Consider volatility when opening the initial grid of orders.
TFVolatility - Timeframe to calculate the volatility.
BarVolatility - The number of bars to determine volatility.
PointVolatility - The number of points to determine volatility.

- Added the EAPADPRO information panel
Details on the panel in our blog: https://www.mql5.com/en/blogs/post/687140

- The Trail Partion Close algorithm has been updated
Version 16.831 - 2016.09.01
Fixed the conflict between the ModifyStopLossAtOrdersopen and the Trailing stop function.
Version 16.211 - 2016.02.16
Added the AdjustTP parameter - correction of take profit during the opening of pending orders.
Added the AdjustAfter parameter - the number of the section after which the adjustment will take place.
Once the EA places AdjustAfter number of orders, the take profit of the next trade will be increased by AdjustTP * (NumberOfSections-AdjustAfter) points.

When a position is closed by the stop loss, we not only lose the stop loss level, but also the spread, especially if it is floating.
In order to earn a take profit, which will cover our last stop losses, we need to increase the take profit after each new pending order.
This functionality allows you to do this.