Make Grid193BE Long
This Old Kings expert advisor (trading robot) for MetaTrader 4 is called Make Grid193BE Long. In the code it works with MACD and moving averages. It works with a grid of orders, places pending orders and moves the stop behind price. It has 37 settings, for example unique Grid Magic (default 11111), Lots (default 0.1) and Grid Size (default 6). Watch it on a demo account for a while — robots can behave differently with each broker. Inside: 1 EA file with source code (.mq4) you can open and edit in MetaEditor. Old Kings are classic community tools shared as-is. Not tested by PolyMaria. Try it on a demo account first. Are you the author of this tool? Message us on Telegram (@abumarket_support) and we will credit you or take it down.
Expert advisor · MT4 · v1.0 · Free
About Make Grid193BE Long
Make Grid193BE Long is an expert advisor (trading robot) for MetaTrader 4 based on MACD and Moving Average. It opens a grid of orders at fixed price steps, places pending buy/sell stop or limit orders and moves the stop loss behind price (trailing stop / break-even). It has 37 settings, such as Unique grid magic, Lots and Grid size. MQL source code included.
It also trades breakouts.
Files in the download: MakeGrid193BE Long.mq4.
Trading robots can lose money. Check every setting and test on a demo account before using real funds.
Settings
| Setting | Default | What it does |
|---|---|---|
| Unique grid magic | 11111 | Magic number of the trades. must be unique to identify |
| Lots | 0.1 | Trade size in lots |
| Grid size | 6 | pips between orders - grid or mesh size |
| Grid steps | 10 | total number of orders to place |
| Take profit | 10 | number of ticks to take profit. normally is = grid size but u can override |
| Stop loss | 0 | if u want to add a stop loss. normal grids dont use stop losses |
| Trail stop | 0 | will trail if > 0 |
| Be pips | 0 | will move the stoploss to BE after x pips of movement |
| Update interval | 1 | update orders every x minutes |
| Want longs | true | do we want long positions |
| Want shorts | false | do we want short positions |
| Want breakout | true | do we want longs above price, shorts below price |
| Want counter | true | do we want longs below price, shorts above price |
| Limit ema | true | do we want longs above ema only, shorts below ema only |
| Em aperiod | 34 | the length of the EMA.. was previously fixed at 34 |
| Grid max open | 0 | maximum number of open positions : implemented in v1.92 |
| Use macd | true | if true, will use macd >0 for longs only, macd <0 for shorts only |
| Use os ma | false | if true, will use OSMA > 0 for longs only, OSMA <0 for shorts only. used in same way as MACD. |
| Close open positions | false | if UseMACD, do we also close open positions with a loss? |
| Do house keeping | true | this will remove long orders below the 34 ema and vv if limitEMA flag is true |
| Keep open time limit | 0 | in hours - if > 0, all open orders or positions will be closed after this period. fractions are perm |
| Ema fast | 12 | parameters for MACD and OSMA |
| Ema slow | 26 | parameters for MACD and OSMA |
| Signal period | 9 | parameters for MACD and OSMA |
| Time frame | 0 | parameters for MACD and OSMA |
| Min from price | 0 | minimum distance from price to place trades. |
| Trade for minutes | 0 | will trade for this number of minutes after being initialised. |
| Grid offset | 0 | positions are opened at price modulo GridSize and offset with this parameter. |
| Long grid center | 0 | defines the center point of a fixed width long grid |
| Short grid center | 0 | defines the center point of a fixed width short grid |
| Long grid low | 0 | defines the bottom of a fixed width long grid |
| Long grid high | 0 | defines the top of a fixed width long grid |
| Short grid low | 0 | defines the bottom of a fixed width short grid |
| Short grid high | 0 | defines the top of a fixed width short grid |
| Profit target | 15000 | if > 0, will close out all positions once the $ target has been met |
| Suspend grid | false | if set to true, will close all unfilled Orders |
| Shutdown grid | false | if set to true, will close all orders and positions. |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Experts.
- Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
- Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the expert advisor from the Navigator onto a chart, check the settings, allow Algo/Auto Trading and press OK.
- Test it first on a demo account or in the Strategy Tester.
Tags: Grid · Pending Orders · Trailing Stop & Break-even · Breakout · MACD · Moving Average · MT4 Expert Advisor · MQL4 Source Code