MQL Programming logo and header image

Multi Grid EA

multi grid ea
Summary

The Multi Grid EA is an EA that can run on any chart and time frame. It uses no indicators. It just trades with price action at certain grid levels. The idea behind this EA is that it places subsequent trades as the market continues to move against the last trade. Each new trade will be on a grid level. And with each new trade, it will be entering at a better price since with each new trade it is even more likely that the market will reverse. The EA has the ability to trade a single set grid or multiple flexible grids. The inputs are in condensed format to save space, which is helpful if using multiple grids. It can run in a fully automatic way or in a semi-automatic way, too. It depends on the inputs that are set. This EA hedges by default so it should not be used on a broker that prohibits hedging.




Inputs
  • Last Cycle
    If true, the EA will run only one cycle, and whenever that cycle is closed, new trading will be suspended. If the EA is currently in a cycle when this input is set on true, the EA will finish the current cycle as it normally would and then suspend itself. Setting this input to true is how you can use the EA in a semi-automatic way, too. For example, let's say you are a manual trader and see that the market is oversold and are expecting a reversal upwards soon. You could start the EA and set this input to true. The EA will then set the grid(s). Later the market reverses upwards and whenever the cycle closes, then the EA will suspend trading. If this input is false, the EA will run non-stop.
  • Initial Lots
    This controls the initial lot size for the first trades in the grid. Future lot sizes in the grid will be based off this initial lot size.
  • Max Lots
    This sets the maximum allowed lot size of any order. The lot sizes of the grid orders will never increase past this amount. A '0' does NOT disable this input.
  • Group TP
    This sets the TP for the entire cycle of trades. It is based in the actual profit amount in the denominated account currency and not in pips or points. Whenever the total profit of all trades is greater than or equal to this amount then the cycle will close. To calculate total profit, the EA also considers order commissions and order swaps, if any. Setting this input to 0 will disable the TP.
  • Group SL
    This sets the SL for the entire cycle of trades. It is based in the actual loss amount in the denominated account currency and not in pips or points. Whenever the total loss of all trades is less than or equal to this amount, then the cycle will close. To calculate total loss, the EA also considers order commissions and order swaps, if any. Setting this input to 0 will disable the SL.
  • Trade Numbers
    This is a string input that controls the number of trades that each grid will have. If using multiple grids, then each grid will have its own value separated by a comma (","). See the default setting as an example of how to set this input. For example, if the input is set to "5", then this means that there will only be 1 grid and that grid will have a total of 5 trades. If the input is set to "5,10", then this means that the first grid will have 5 trades and then the subsequent grid will have 10 trades. And so on.
  • Trade Pip Distances
    This is a string input that controls the number of Points that each grid will have. If using multiple grids, then each grid will have its own value separated by a comma (","). See the default setting as an example of how to set this input. For example, if the input is set to "10", then this means that there will only be 1 grid and that there will be 10 points in between each grid level. If the input is set to "10,15", then this means there will be 2 grids and that the first grid will have levels of 10 Points for each grid level and then the subsequent grid will have 15 Points for each grid level. And so on.
  • Trade Lot Multiplier
    This is a string input that controls the lot multiplier for each trade of each grid. Each number should be set to 1 or greater. If using multiple grids, then each grid will have its own value separated by a comma (","). See the default setting as an example of how to set this input. For example, if the input is set to "1.5", then this means that there will only be 1 grid and that the lot multiplier for each trade in that grid will be 1.5. If the input is set to "1.5,2" then this means that there will be 2 grids and the first grid will have a lot multiplier of 1.5 applied to each trade in that grid and the subsequent grid will have a lot multiplier of 2 applied to each trade in that grid. And so on. All lot multipliers are applied to the last trade opened. For example, if the last trade opened has a lot size of 1.00 lots and the lot multiplier is 2, then the new trade will have a lot size of 2.00 lots.
  • Grid Distances Scaler
    This input allows you to scale all grid distances up or down at the same time. It applies to all enabled grids, no matter if only one grid is used or 3+ are used. The input must be greater than 0. Setting a '1' will have no affect on the grid distances. Greater than 1 and the distances will increase. Lower than 1 and the distances will decrease. For example, let's say a grid has a distance of 50 and 'Grid Distances Scaler' is set to 1.5. The new grid distance used will be 75. Or let's say the 'Grid Distances Scaler' is set to 0.5. Then the new grid distance will be 25. And so on for each enabled grid. This input is optimizable. The user can set low steps too like 0.1 and it will still optimize.
  • Max Slippage
    This input controls the maximum amount of slippage that will be allowed for ordering execution. It is based in Points.
  • Magic Number
    This is a standard Magic Number input.
  • Use Time Restrictions?
    If true, new cycles may be limited to a certain time of the day and/or certain days of the week. If true, the below inputs are used. If false, the EA will run non-stop with the below inputs ignored.
  • Times Allowed
    This is a string input that controls the allowable time frame that new cycles of trades can open. See the default setting as an example on how to set this input. Do not include extra spaces, any strange characters, or any letters. For example, "08.00-16.00" and "08 00-16 00" and "08,00-16,00" are incorrect settings. The correct format is "08:00-16:00". Both hours and minutes can be set. Leave the input blank to disable.
  • Sunday
    If true, new cycles can open on Sundays. If false, new cycles cannot open on Sundays.
  • Monday
    If true, new cycles can open on Mondays. If false, new cycles cannot open on Mondays.
  • Tuesday
    If true, new cycles can open on Tuesdays. If false, new cycles cannot open on Tuesdays.
  • Wednesday
    If true, new cycles can open on Wednesdays. If false, new cycles cannot open on Wednesdays.
  • Thursday
    If true, new cycles can open on Thursdays. If false, new cycles cannot open on Thursdays.
  • Friday
    If true, new cycles can open on Fridays. If false, new cycles cannot open on Fridays.



Notes
  • For the 3 inputs called 'Trade Numbers', 'Trade Pip Distances', and 'Trade Lot Multiplier', the format is exactly the same and they are also related to each other. For example, if one of the inputs has 1 number (meaning 1 grid) then the other 2 inputs should also have 1 number to match this. Each grid setting will go in order from left to right.
  • If a cycle is currently open and one of the above time or day settings comes into effect, that cycle will still close as normal. Only new cycles will not open.
  • DLL imports should be enabled for this EA to work.



Forum

  • The official forum to post your comments, questions, concerns, or bug reports about the Multi Grid EA can be found at Forex Zone Forum.



Example

Multi Grid EA EURUSD H1 backtest 2023 Graph
Multi Grid EA EURUSD H1 backtest 2023 Statistics
Default Settings Used



Download
  • The current version is v1.40 released on February 22, 2024. Updates will be made based on customer feedback.
  • This EA is FREE with no restrictions! Just use the link below to download instantly.
  • Post your questions or feedback on the official Multi Grid EA forum page.
  • Please SHARE this EA to support our work!



Instant Download


EagleFX


Copyright © 2010-2024 EA CODERS LLC