Free Grid Trading, The New Grid EA

 

Hello Everyone,

I have seen lately that many people have become interested in commercial grid trading systems, such as robominer. Since we seem to lack a general alternative free grid trading EA I decided to program a very short and efficient code that could be used to grid trade any range on any currency pair.The version right now works on four digit brokers only. Of course, this can also be used for long term ranges such as the EUR/CHF and the AUD/NZD. The expert has the following variables :

Lots = 0.1 ; Lot size Traded (advice is to use 0.01 for each 1000 USD traded)

max_trades = 10 ; maximum number of trades

grid_lines = 30 ; Number of lines on the grid

RangeMid = 1.5465 ; Median price of the grid (example for EUR/CHF)

grid_separation = 0.0100 ; Separation between grid lines (in currency points)

TP = 50 ; Take profit

The EA will open a trade on each grid line towards the median price but will only open one trade per grid line until a trade on a separate grid line is opened. That is, if grid line x is touched a trade is opened, if it is touched again, no trade is opened, however, if grid line x+1 is touched and then grid line x is touched again another trade is opened.

... etc, until the number equals grid_lines

+3*gridseparation (open short)

+2*gridseparation (open short)

+1*gridseparation (open short)

median price

-1*gridseparation (open long)

-2*gridseparation (open long)

-3*gridseparation (open long)

... etc, until the number equals grid_lines

This strategy gives good results in wide ranges on several currency pairs like the EUR/CHF or the AUD/NZD. However, this strategy must be used with great care. I attach an image of the 10 year backtest on the EUR/CHF as well as a picture of the trades made. Remember that this EA is NOT meant to be traded in a "set and forget way" but it is more meant to be used as a trading tool to help a trader gather profit from a range. The parameters can be modified to trade any range on any currency pair. The EA is not subject to one minute interpolation errors (due to the 50 pip TP) so backtesting should be reliable.

I hope you like it and modify it to fit all of your needs

Best Regards,

Daniel

Files:
 

Thanks for sharing your EA.

I'll try on next week.....

 

Looks Good,thanks

 

great EA ,thank you!

 

Thank you !

I am glad you have liked it

I will certainly add ECN support, 5 digit broker support and some good error handling if there is enough interest. Certainly this EA should not be used by novice traders, range trading with grid systems can be very risky because of the absence of a SL, the safest would be to trade the EUR/CHF and AUD/NZD long term ranges, as robominer does, although this is still something that should be done with great care.

Again, I provide this as a tool for traders who want to exploit ranges. The EA's terribly simple code is lightning efficient, very easy to backtest and optimize !

 

grid EA

Hi Daniel.

Thank you for this post and grid EA.

Our team are currently working on our own grid based EA.

I have checked RoboMiner (they give it for free to test) and I have 2 questions in this regards:

1. Median always stays around 1.5465 ? If it is so then in 2002 - 2003 EA "knows" that positions should be long. If not, then I do not know where EA in 2002 got value 1.5465 or so.

2. Some positions are opened and stay for 1 or even 2 years long. What would be a swap for this period of time? Does EA deal with this somehow?

Daniel, you mentioned about adding ECN support for EA. Could you please explain what do you mean?

Thank you very much,

Rost

 

Hello Rost,

You are very right. The EA knows the median price since the start of the backtesting period in 2000 and therefore the EA is designed with the benefit of hindsight. It is the same for the robominer system, the EA has the median price preprogrammed so it "knew" it had to trade long or short before the range actually established itself in late 2007. This is one of the dangers of grid trading, if you had to define a range in 2002 you would have probably wiped your account in 2006-08 due to the range extension. Therefore, the backtesting results actually depend on the fact that we are using a range we know is effective "in advance". The system will work as long as this range is kept, however, if it is not, an account wipeout is imminent. Risk can be diminished by only trading when price is near the ends of the grid, that would mean only trading 1 or 2 out of every 10 years.

Of course, if positions are open during 1 or 2 years with negative swap this will strongly affect the profits with some positions even closing with loses in the long term. I would advice to only trade this on swap free accounts in which such long holding of positions won't matter. The EA (my EA) does not deal with swap in any way, again, trading with a swap free, also called "muslim friendly account" would be best (these are offered by several brokers). Robominer does claim to deal with swap but my ten year backtests still show significant loses from swap accumulation which suggests that the code to deal with this is inefficient.

However I must stress that my EA can be used for general range trading, not only in long term ranges on the EUR/CHF and AUD/NZD but on sporadic smaller ranges that may develop on other currency pairs.

Regarding ECN support, you must remember that ECN brokers do not accept the submission of the takeprofit with the actual order but orders need to be modified after being placed to include the TP. ECN support can be effectively incorporated by order modifications after placement or by using an internal mechanism that handles the TP. The first is the safest choice. I will however only do this if there is enough interest for this trading tool.

Again, I do NOT support grid trading as a "set and forget" trading methodology. Grid trading seriously exposes people's equity and must be done with great care in order to avoid excessive draw downs with possible account wipeouts. Such risks are taken with every grid system, including the robominer and other commercial experts.

I hope this answers all your questions. Feel free to ask any more questions or post any additional comments/suggestions,

Best Regards,

Daniel

 

Thank you

thank you Daniel for detailed explanations.

Grid trading is very interesting approach, it should be very "smart" to profit heavily on trending moves and not to lose much on sideway market.

I am thinking to find most appropriate method to define different state of the market: trend, flat and pull back in time of trend. Each mode triggers different behavior of the Grid EA.

Rost

 

What you want to do is very hard. It is extremely difficult to use different trading techniques depending on market conditions. Most of the time the wisest approach to long term profits is to build a trend following system that stops loses quickly and lets profits run. Like most successful traders have advised for a few decades.

However, the approach you want to do with grid trading plus other techniques has been implemented in a few commercial experts, the most popular being pointbreak and the dreambuilder FX which use grid trading, pyramiding and averaging to tackle different faces of the market. Its approach is somewhat successful although draw downs are still pretty significant.

I hope you have good luck with your approach, you are free to use my newgrid code as you see fit.

 

we appreciate your goodwillness...thanks for expert.

i trade forex for 7 yrs....grid trading is very useful IF it used with technical analysis...and risk mgmt.

so...keep good work....good luck.

 

hi Thanks for this new EA i will test and post my settings here.

Regards

Reason: