This is the first successful EA I coded while working my way out of past mistakes. It is completely working EA. Named it V 0.1 because I have more ideas to develop and I may build them upon this code later.
It is one of the ideas I came up while observing the behavior of other grid systems in the market. In short.
- Grid system. You open new positions every XX pips.
- Low (-ish) risk, with small profitability.
- Moderate draw-down.
- Non NFA compliant (Hedges)
- ECN compliant (no SL and TP is ever set, so it runs on ECN brokers, just fine)
- TP is not set, but a fixed amount of money for total profit is used.
- No stop loss, everything is hedged, so it’s not necessary.
- Works better in more volatile pairs.
—> You can download the code here. <—
Or get the results from the picture above –> Right from here.
I have used the following settings for those results:
- AggresiveHedge=1;
- GrabAndRunTarget=5;
- InitialLots=0.01;
- PipsPerStep=50;
Theory behind the EA.
In a trendy market or in market with large swings, you can run automated trader (like this one) to capture moves, regardless where they go.
You open both long and short positions and start adding up to shorts or longs depending on where the market goes.
If the market swings back against your already open positions, you add positions in the same direction as market, until the winners overwhelm the losers.
If too many positions are open in one direction and market swings back, you have the choice to wait until the EA balances it, or use aggressive mode 1 or 2 (1 = mild, 2 = worse than Martingale)
Provided you have $300-500 buffer for a bundle starting at 0.01 lots, this system is quite safe.
Here are 2 examples of how this looks like in live account:
If you don’t set too much profit to take, the EA usually takes the profit after opening 3 positions.
If you aim higher, you need to wait, until the EA opens enough winners to collect the targeted profit.
It is a Slow and steady EA, so you need to be patient.
PROs.
- Set and forget. Provided you have enough buffer in the account – this system will work for you, while you sleep.
- You can start working with $500 account.
- Profit is guaranteed. Sooner or later.
- Low or No risk on grid sizes >30 pips.
CONs.
- You depend on trendy markets. If the market ranges – you can see the system locked between losers, waiting for a trend.
- It is really slow system when locked with too many open positions. You may wait a week until it unlocks or use aggressive mode.
- Quite high risk on grid sizes <25 pips due to more frequent lockouts.
- I have written the code for 5-digit brokers. Will change it later, when I have more time to write 🙂
When the system goes locked badly?
It does not happen often, but you may stumble on a square formation when market is ranging, then goes wild for few quick swings and then ranges again. Like this:
When something like this happens, the EA will have 6 losers and you will need plenty of patience, until the market swings further up or down, so the EA covers the losers with winners and closes into profit.
Unfortunately, if you have a grid of 20 pips, you will need to wait for a 100-PIP swing from the EA pivot point, to cover everything.
With 3 long losers and 3 short winners, you have:
- Position 1 (furthest long) @ -120 PIPs.
- Position 2 (further long) @ -100 PIPs.
- Position 3 (nearest long) @ -80 PIPs.
- Position 4 (furthest short) @ +60 PIPs.
- Position 5 (closer short) @ +40 PIPs.
- Position 6 (closest short @ +20 PIPs.
Total losers 3, with -300 PIPs loss.
Total winners 3, with 120 PIPs profit.
To balance this, you need another short (or few shorts) which will cover all 3 losers.
Normally it will take 3+ more short winners to cover all losers (Another 60 pips move down) or one big short which will cover all losers in the next swing down.
I have coded 2 kinds of aggressive approach to this issue.
First method will open 3 x initial_lots short (in the above case). This covers most cases where the market exits from the range, but will not cover the cases where the market swings back (and opens 2 more long positions) and then returns to ranging. For this, I developed method 2.
Second method will open next position with the lot-size equal to the sum of lots on all already opened positions on the other side of the EA’s pivot.
e.g. If you have initial lots = 0.01 and turn out locked with 0.05 lots short and 0.03 lots long – next Long position opened will be with size 0.05 to cover those nasty 5 shorts opened to balance the 3 long in the example above.
If this is not right for you, feel free to change this part of the code with whatever suits you:
orders_Total = CountOrders(); if( orders_Total > 0) { longDelta = (currentPrice - order_maximal); shortDelta = (order_minimal - currentPrice); longPipDistance = longDelta * Normalizator; shortPipDistance = shortDelta * Normalizator; if (longPipDistance > PipsPerStep) { if (AggresiveHedge == 1) {lots = orders_Short * InitialLots;} if (AggresiveHedge == 2) {lots = lots_Short;} check = CreatePendingOrders(LONG, OP_BUY, Ask, lots, 0, 0, ""); } if (shortPipDistance > PipsPerStep) { if (AggresiveHedge == 1) {lots = orders_Long * InitialLots;} if (AggresiveHedge == 2) {lots = lots_Long;} check = CreatePendingOrders(SHORT, OP_SELL, Bid, lots, 0, 0, ""); } }
**DISCLAIMER**
This blog post is for research and entertainment purposes only. ForEx trading carries the potential for substantial gains and substantial losses. Any potential losses suffered through ForEx using the information in this blog post is unfortunate, but cannot in any way, shape or form be used against me. I cannot be held liable for any losses suffered on your part in the market.
Thank you in advance.
Happy PIPping and if you have any ideas to get this system better – drop me a line 🙂
15 Responses to “Mordor’s gridder v 0.1”
Sorry, the comment form is closed at this time.
Hello,
thank you for your wonderful fantastic Mordor-Grid EA!!!
Is it possible that you can input this things in the EA:
– a TimeFilter: only trade from 08:00 – 10:00 (but the EA have to Close all open Orders first)
– a DayProfit-Filter: if the EA has the DayProfit arrived then he should not trade again this Day
Thanks in Advance!
Many Greetings,
Edwin
I replied you via mail.
If I find myself with more time next days, I can code it down but I don’t promise anything.
It’s 20+ lines of simple code, but I can’t do it while I am at work.
Ask in MQL forum, someone may be available to help you with this.
Great ea mordor-Grid EA
just a question ea works well on pairs /jpy but wont trade on any other pairs if not /jpy like euro/usd etc
regards
sean
It is possible.
I am sorry about this.
Are you on a 5-digit broker? I optimised the code for 5-digits and never tested it on 4 or 6 digit brokers.
im trading with etx capital if that helps
regards
sean
they are a 5 digit broker
Sent you an Email, please have a look at the attached files.
Dear Sir,
First, thank you very much for this great EA, i only have one comment when putting the EA on USDJPY 5 digit broker, the EA open a lot of trades regardless of the distance pip setting.
My broker is XM.
Is there any updated version for the EA?
Again thank you.
Kind Regards
I am sorry about this. I have not optimised it for all currency pairs.
Try the following for the JPY pairs on 5-digit broker: Set the PIPs per step to 500 and run it on tester. If you are satisfied – try on demo account for a month. I think it should work.
I rarely trade eastern crosses, sorry. I am sleeping at this time.
HI m0rd0r
Im still using ur gridder ea
Still the best
u dont by any chance have plans and time to do some mods to it ?
like time filter and profit trailing
That would be the best
REGARDS
Hi Sean.
I was planning to do some modifications, but unfortunately my new job is quite demanding. If you have any idea how you want the EA to act on time filtering, you may share them.
For example: Close all positions on 9 am in the morning?
Do not open new position after 9 AM?
Complete the current grid, but don’t start new after 9 am?
etc.
thanks for response
What will work well is just trading time say from 9:00 to 17:00 or what ever time input
if orders still open in non trading time then close on success and only start basket again within set time
on profit trailing start trail at say at 2% profit then trailing step 1% (adjustable %)
thanks
sean
The profit trailing is going to be tricky. But the time could be done. I will see when I can afford the time.
just the time option would be nice
profit trailing no problem there r some good trailing robots out there like (simple basket trailing ea)
If this ea can compound the profit…! Must be powerfull