Expanding Grid EG104:
EG104 EA, originally ExpandGrid, is a collection of grid styles/modes that have been optimized by intense tests, results from demos and real accounts and results from studies and parameter variations. It is delivered with the default parameters selected for the best EA results, so the trader does not need to change them to use the EA, just drop it to the chart, and let it play.
It has been found, during demoing EG and by users of forexfactory.com forum that a management of modes during news releases may increase profitability, decrease risk and salvage small accounts.
The idea behind EG is to create a grid above and below the price at an optimal pips increments, open a cycle and target it at one grid level. That it is. If the start lot quantity is 0.10 on EURUSD and grid level is 10 pips, then grid target is $10.00. If the trade goes south, EG will use different styles/modes to accumulate positions and average down or reverse the breakeven point and then target its original goal of $10.00. If at a preset level, the target is not reached, EG will set the cycle to a closure mode targeting the breakeven point. After a cycle is closed, EG will start a new cycle.
This EA works with its default values out of the box, but flexibility has always been a priority in developing it. It means the trader may change default values and use different grid modes simultaneously. By using start/end times the EA may run one grid mode during active sessions and a different grid mode during sleeping sessions, it may run modes in parallel or interlaced and with its own set of parameters. The trader is able, by combining these modes, to create a well complex algorithm no one created before. Its flexibility creates its unlimited potential by itself or by the trader’s imagination.
As a summary, there are two types of grid modes, stop order mode and limit order mode. It has been found that when the market is trading normally or in a range environment, limit orders style works better in a grid (buy below price, sell above price) and when the market is trending or moving fast and far up and down away of regular movements, stop orders work better. (Buy above price, sell below price).
Stop order mode reverse the breakeven point multiplying the opposite quantity by a factor (multiplier), limit order mode accumulates at the original trade direction averaging down the breakeven point by multiplying the last order quantity by a factor (multiplier). There are modes that use a static grid and others use a floating grid where the center moves as new orders are executed. Combining a stop order style with a limit order style, with a moving grid, creates a very interesting scenario. I challenge you to test it.
Please post your results,
Download files below to following locations:
Current Release: EG104 v038 (11/11/2017)
thanks for posing the ea here.
i just have started using it. there is two things. one there is no panding orders and second no t/p and s/l.
The design of many grids excludes TP and SL, the grid program takes care of theose at each level.
ExpandGrid main idea. Note this is version 103 and accumulating levels is zero. (v103-A0)
you may see an A8 version results here: http://www.forexfactory.com/bauta#69
Note that setting stop is not a good idea, you may try the parameters Max_Money_Loss or MoneyTakeProfit. I did test Max_Money_Loss of $500, $1000, $10,000 and the grid failed. in a test from 2000 to 2014 the maximum drawdown was $80,000. that is the number I do want to reduce.
The same - very interesting - concept has been discussed on 50 pages in the following thread:
"MGH EA" even had an "inside grid" functionality for extended periods while the market was ranging between the highest buy and lowest sell entry levels.
Unfortunately the DD was intolerable with all the experimental settings used for backtests, so the concept was eventually abandoned.
Very interesting stuff here. I will follow this thread.
Thank you bauta. I have also posted it on my website, so I hope that you do not mind.
By the way, when I try to increase the number of lots, the system keep using 0,01 lots. I biefly checked the code and I do not see any problem there, so I am slightly confused, if it is just my Metatrader or something.
Nice effort Mr. bauta.
Both of you ideas are very well.
I am getting a little problem, I don't know this problem is with my MT4 platform or in EA
EA are opening just 5 trades in back test.
6th and more trades are not opening. In result account going empty.
please recheck them. If you set just 5 trades in the EA please code them for open more trades.
I am waiting for your reply
Really excellent work bauta, just some little adjustment needed in my opinion:
- expose as Extern bool Verbose variable (and put under this condition all objects and comments) ; this speedup testing
- add one variable to multiply grid increment every new order (to increase "cost" of any new order) ; in my experience with grids this help to have more safe trade sequece
Thank you far your share work ?
I did found that using smaller grid increments the drawdown vs. profit factor is better. Off course, this is scalping.
When I did test the grid, I did use 10 pips spread to cover commissions and swap costs. Please do not ask me for a way to save in commissions, I am not looking for a way to save in commission and take all the money myself, I am looking for a way to make money at the end of the day.
Now I am calculating the grid increments using daily ATR averages on every order as [maurineri ] recommended it on post 12. Because grid is calculated, now ExpanGrid may be used in different pairs, I like EUSUSD, GBPUSD, AUDUSD, USDCHF and NZDUSD. I am not in any of JPY yet. It must be tested.
ExpanGrid starts with the minimum lot quantity; in the future I will open the Start_Lot_Qty parameter. Ignore it for now.
Also I did add one more lot to the quantity, the formula to buy now is:
lastSellQty * gridSize+1 in levels + (minimunLot*2) - opened buy quantity.
Example: Buy 0.01, sell 0.04, buy 0.14-0.01, sell 0.58-0.04 and so on.
The quantity is bigger and the grid size is smaller, this combination speed up the grid.
I do recommend you to test it a least 10 years and demo for more than one month. When demo it, duplicate it using two charts with different magic numbers.
I am working now in the optimal accumulation levels, this version accumulates only one level. (See post 1)
Note that ExpandGrid will not open new positions on the second haft of Fridays.
After I completed testing, I will supply the source code.
PLEASE DO NOT TRADE IN LIVE ACCOUNT. this is a working in progress EA. Use it at your own risk.
I did linked my Explorer ExpandGrid103A1 to track performance. I did open an $50,000, 1:100 leverage demo account and I trading 4 charts of EURUSD, 4 charts of GBPUSD, 2 charts of AUDUS and 2 charts of NZDUSD. using different magic numbers to separate them. Lets play this for longer to see what's happens.
I think that it not really sustainable to make more thna 7-8 levels.. in my opinion obviously..
To fit risk adversion of different people I suggest you to "open" LotSize parameters as extern , related to trade level:
extern double LotSize_1 = 0.01;
extern double LotSize_2 = 0.02;
extern double LotSize_3 = 0.04;
extern double LotSize_4 = 0.08;
extern double LotSize_5 = 0.16;
extern double LotSize_6 = 0.32;
extern double LotSize_7 = 0.64;
extern double LotSize_8 = 1.28;
and assign related size to next order with switch structure.
If you share your last code I can contribute a little, just my two cents
also I started testing on Monday 07-13, on 7 pairs with different levels of grind: 12pps for pairs like AUD / USD 24pps for pairs like EUR / USD. We will see.
But I have a few suggestions
1. To reduce the risk and set the levels as maurineri written (as earlier I thought) transactions could be carried out on 2 levels. The first entry level and second on the grid away (down if we started from buying or up if we started sales) and of course the TP lvl well worth grid. example
(Prices are exemplary, grid 50pps)
a) buy 0.01lot at 1.0000 - TP: 1.0050
then if the price falls
b) sell 0.02lot set at 0.9950 and 1.0000 TP
then if the price rises
c) buy 0.04lot at 1.0000 - 1.0050 TP
and so on
when one of the directions reaches TP lvl it close the remaining transactions at a loss. always we earn 50pps with 0.01lot
in such an arrangement, nine transaction is at the level of 2,56lot (for the current system already the fifth transaction is at this level).
2. Can it be possible to introduce something like that: if we are already such transactions lvl 4th or 5th or 6th This was summed to profit from all open positions and if it reaches the level we are interested in $ (set in the parameters of the strategy) can be positive or negative (you can put up with a small loss at high risk). Then all trades are closed and start over again from the level of 0.01. This makes sense because a few times I've seen it lacked 2-3pps on the graph to close. but then it turn back and did the next transaction for 13lots and DD was huge. even if the whole came to a small plus its not worth it.
(Text translated by google translate)
Example: buy 0.01 and if market goes down to grid then buy 0.02, if continues buy 0.04, then buy 0.08, 0.16, 0.32, 0.64 and so on. (Doubling the last qty).
I and testing now 10 levels accumulating with grid size of daily ATR divided by 8. What I am trying to do is accumulate at least 120% of daily ATR move, then start expanding.
I am testing 15 years, from 2000 to 2014, it will take some time. I am increasing grid size and decreasing accumulating levels and retesting again. At the end I will choose the best drawdown vs profit factor.
can you share setting of yours trials, please ?
I am searching in my old grid/hedge works some expedient for yourEA , to gain time is better to have your settings.
© Forex Factory