Binario (Moving Average band breakout EA)
EA that places buy stop and sell stop orders outside an MA band built on High and Low prices
EA that trades the crossover of two moving averages, with adjustable method, period and price
Open source, Apache License 2.0, by EarnForex.com. See licences
First release on this site.
Drag the EA onto the chart of the symbol and timeframe you want, then enable Algo Trading. The EA checks signals on closed bars, once when a new bar opens, while the trailing stop runs on every tick.
Set Period_1 and Period_2 to different values, and set StopLoss and TakeProfit yourself if you want them (in points, not pips). The EA manages only orders of the chart symbol with the configured Magic number. On brokers with market execution it applies SL/TP in a separate step after the order is opened.
| Name | Default | Description |
|---|---|---|
| Period_1 | 20 | Period of the first MA. The smaller of Period_1 and Period_2 is used as the fast MA and the larger as the slow MA. |
| Period_2 | 22 | Period of the second MA. If it equals Period_1 the EA refuses to start. |
| MA_Method_Fast | MODE_EMA | Method of the fast MA (SMA, EMA, SMMA or LWMA). |
| MA_Method_Slow | MODE_EMA | Method of the slow MA (SMA, EMA, SMMA or LWMA). |
| MA_Price_Fast | PRICE_CLOSE | Applied price for the fast MA, for example close. |
| MA_Price_Slow | PRICE_CLOSE | Applied price for the slow MA, for example close. |
| MinDiff | 3 | Minimum distance between the two MAs, in points, for a cross to count. Filters out marginal crosses. |
| StopLoss | 0 | Stop-loss in points from the entry price. 0 means none. |
| TakeProfit | 0 | Take-profit in points from the entry price. 0 means none. |
| TrailingStop | 0 | Trailing stop distance in points. 0 disables trailing. |
| TrailingStopTriggerProfit | 0 | Profit in points needed before trailing starts. With 0, trailing starts once the profit reaches the TrailingStop distance. |
| TradeDirection | TRADE_DIRECTION_BOTH | Direction allowed for new orders: long only, short only, both, or none (closing and trailing only). |
| StartHour | 0 | Hour (server time) when opening new orders starts, inclusive, 0-23. |
| StartMinute | 0 | Minute when opening new orders starts, 0-59. |
| EndHour | 23 | Hour (server time) when opening new orders ends, inclusive, 0-23. If earlier than the start time, the window crosses midnight. |
| EndMinute | 59 | Minute when opening new orders ends, 0-59. |
| TradeOnMonday | true | Allow new orders on Monday. |
| TradeOnTuesday | true | Allow new orders on Tuesday. |
| TradeOnWednesday | true | Allow new orders on Wednesday. |
| TradeOnThursday | true | Allow new orders on Thursday. |
| TradeOnFriday | true | Allow new orders on Friday. |
| TradeOnSaturday | true | Allow new orders on Saturday. |
| TradeOnSunday | true | Allow new orders on Sunday. |
| CloseTradesOutsideTradingTime | true | If on, the EA still closes the existing position on an opposite signal outside the trading window (it will not open a new one). |
| DoTrailingOutsideTradingTime | true | If on, trailing continues outside the trading window. |
| Lots | 0.1 | Fixed lot size, used when UseMM is false. It must fit the broker min, max and step or the EA will not start. |
| UseMM | false | Calculate the lot size from free margin instead of using the fixed Lots. |
| LotsPer10000 | 1 | Lots per 10,000 units of free margin in account currency. Used when UseMM is true. |
| Slippage | 3 | Maximum accepted slippage in points. |
| OrderCommentary | Adjustable MA | Comment text put on the orders the EA opens. |
| DisplayStatusComment | false | Show the EA status as a text comment on the chart. |
| Magic | 19472394 | Magic number that separates this EA's orders from other orders. |
Defaults are the values shipped with the EA, not a recommendation. Results depend on the market and on each account. Past results do not guarantee future results. Trading carries a high risk of loss.
This EA uses two moving averages, a fast one and a slow one. When the fast MA crosses above the slow MA and the gap is at least MinDiff points it opens a buy; when it crosses below it opens a sell. The method (SMA, EMA and so on) and the applied price can be chosen separately for each line.
On an opposite crossover the EA closes the current position and opens one in the other direction, so it is in the market almost all the time, unless TradeDirection limits it to one side or to no new orders. By default no stop-loss or take-profit is set (both 0), so a position only exits when the lines cross back.
Optional extras are stop-loss, take-profit, trailing stop, limits on the days and hours for new orders, and lot sizing from free margin. It suits trying out different MA crossover set-ups in the Strategy Tester.
Banners from the Exness partner programme

FXIDTH is an independent IB partner of Exness. This channel is not owned or operated by Exness.*Spreads may fluctuate and widen due to factors including market volatility, news events, market open/close, and others.*Processing times may vary depending on the chosen payment method.
EA that places buy stop and sell stop orders outside an MA band built on High and Low prices
EA that opens trend-following Buy/Sell when the EMA slopes the same way, ADX is strong enough and +DI/-DI agree, with SL and TP.
Has alerts
EMA crossover EA with ADX/RSI/session/spread filters, ATR-based SL/TP and a trailing stop