Euro Grid by Dietmar

Post Reply
User avatar
gaheitman
Trader
Posts: 655
Joined: Tue Nov 15, 2011 10:55 pm
Location: Richmond, VA, US

Re: Euro Grid by Dietmar

Post by gaheitman »

ironrick wrote:Hello All!

I originally posted this in Dietmar's original manual method thread before I realized there was an EA thread here. My post really belongs here...

It has some thoughts on RISK MANAGEMENT, which seems to be the biggest worry, and using this method in the USA.

I am super interested in this method -- I hope the guys figure out a way to program a bot for it (and that will be able to make use of this method for us in the USA.)

I am also very interested in seeing if this works (or works even better) on more pairs.
Question and thoughts to George and Gary and the other coders:

Is there a way to have a single EA control 2 different accounts to get around the US hedging rules? Alternatively, is there a way to have 2 EA's "talk" to each other from 2 different accounts so that each account would know at which long or short trap level the other was at and could open the appropriate amount of orders? Seems like there are trade copiers out there that can control another account... Seems like it could work in principle.
Thoughts on RISK
Also, in order to keep losses from spiraling out of control on a particular day,
1) since this method seems to be profitable MOST days,
2) we are then concerned with limiting losses on the REALLY BAD days
3) What if you could put an overall pip loss limit PER DAY. An aggressive or conservative amount could be used (and testing could get us to a good, reasonable number.)
4) This could affect overall profitability of the system because it could stop you out of some trades that would eventually turn profitable. BUT, this also means you live on long enough to make it to the next "high probability day" to trade again.

Another thought. The Bot(s) could be limited in the NUMBER OF TRADES it is allowed to take per day. An EA that could be built to use this system could be used in backtester to help count how MANY trades are taken per day 1) on average and 2) median/ percentile. The 2 measurements are important so that you could get an overall average but also a potential statistical distribution that could show, for example, that one could hit 85% of all trades if limited to say 20 trades per day. (Stated another way, a day that requires over 20 trades has a greater chance of ending in the negative.)

Hope these are some helpful ideas. Let's keep the fire burning here!
Some further thoughts:

Trap Level Distances (Larger vs Smaller traps)
Would there be a statistical advantage by making the trap slightly smaller -- say 10 pips instead of 15 between levels? If this method is taking advantage of high(er) volatility periods, it would seem to me that it is less likely to get range bound in a smaller trap than a larger one.

Dynamic Trap Sizes
Similarly, what about an ADR based dynamic trap size. Example: take 50% of ADR(20) and divide it into the 6 equally sized trap zones. (Please note, I am not trying to curve fit so much as add higher probability of success IF my comments about trap size above prove a statistical advantage.)

This could also be a huge advantage as we try this method on different pairs that have different ADR characteristics.

Filter for Calculating Max levels deep to breakeven based on TP and Spread?
This may seem an extreme case but most of my thoughts regarding risk for this system have to do with higher probabilities at the start, OR knowing when to quit on any given day.

It seems that there could be times when the Spread costs could remove all gains -- even if you where to hit TP -- once you surpass a certain number of trades deep. (Although if automatically/arbitrarily limiting the trap to one day, this may be rare.)

I THINK it is possible to figure a rough estimate of how many levels deep you could go before this occurs (or at least as a filter to check if it is worthwhile before taking any new trade ) -- if we know the distance between levels, the ultimate TP level, and the total spread accrued for all the trades so far (could be based on some average of the spread during that period of trading).

This could further reduce risk by having another bug-out clause (end the trap for the day) -- the system can know when another trade level would cause us to go past breakeven, even if the TP level was reached. Or have I missed something? I need help figuring the logic on this one... :) Maybe I over-thought it :)


I know some of the issues have been sorta brought up before but I thought I would add my 2 cents.

I hope it is helpful!

Cheers,
Rick
Rick,

Here's a slightly updated indicator. It allows you to change the step width as well as the start time down to the minute. It should allow you to manually investigate some of your ideas.

It also tries to keep track of the max number of open trades and worst draw down/loss and displays it in the comments. I'm not counting that as fully debugged, so it's more directional. :>

George
You do not have the required permissions to view the files attached to this post.
garyfritz

Re: Euro Grid by Dietmar

Post by garyfritz »

I agree you would probably benefit from calculating dynamic band sizes for the trap.

Some analysis & thoughts on how this thing behaves...

If I understand this beastie correctly, it always exits the TP with an equal number of positions on the winning side. That is you will have N longs from long1, N from long2, N from long3. The number on the losing side depends on how many times you've gone back & forth, and how deeply you went into the losing bands. So you might have M shorts from short1 and none from short2/3.

The first direction you start out doesn't matter, just the direction you hit the TP. So e.g. if you go to long1-short1-longTP, you end up with 2 long positions from long1/2/3 and 1 short from short1. If you go short1-longTP, you have the same.

I think, by definition, you will always end up with larger positions on the winning side (the side that hits the TP) than on the losing side. Unfortunately the loser-to-TP/SL distance is greater than the winner-to-TP distance, which gets worse for the deeper loser levels. If you go only 1 level deep on the losing side, you have 1 more long set than you have shorts, e.g. the 2 longs / 1 short example above. The deeper you get into the losing side, the worse off you are on the losers, because it increases the size of your losers. But each losing band you hit adds to the size of the winners. So e.g. if you to go short3-longTP, you have 1 set of shorts (total loss = 45+60 + 30+60 + 15+60 = 270) and 4 sets of longs (total gain = 4*45+4*30+4*15 = 360).

I think the worst case is if you go back & forth multiple times, hitting a deep level on the losing side with large position sizes. Then the large losers outweigh the winners.

Even the worst case of going back and forth, back and forth, really has reasonably limited risk. Let's say you went back & forth to long3/short3 10 times. Each time you get to long3, you've added 3 sets of shorts, and vice versa. So you'd end up with something like 30 shorts and 30 longs.

But it's not as bad as it sounds because they all offset. Instead of hedging all these longs and shorts, you could instead hold a *net* position. Place a "+1" on each long level, "-1" on each short. Hit long1, change your position by "+1" -- add a long and decrement the short values. Hit short1, the value there is -2, so you add -2 to the position -- now you're short 1 (basically closed out your 1 long and added a short at short1), and you add +1 to the long levels. Hit short2, add -2 to position, now you're short 3 (1 at short1, 2 at short2), add +1 to the long levels. Now say you turn up and go to long TP. When you hit long1 you add +2 to your position, now you're short 1. (You basically just closed out your short1 short and added a long at long1, still have your 2 short2 shorts.) Hit long2, add +3, now you're long 2 (closed the short2 short positions and added 1 long at long2), then add 3 longs at long3, etc. This avoids hedging entirely. Your worst DD was just before you hit long2, when you had 2*60=120 loss from the short2 shorts, plus 15 from your long1. You end up with 45 (1 * long1) + 30 (1 * long2) + 45 (3 * long3) = 120 wins, minus 60 (2*short1-to-long1 losses), minus 120 (2*short2-to-long2 losses), for a net of -60.

Did that make any sense to anyone?? :lol:

So your maximum risk is determined by how many times you go back and forth. Say you bang back & forth between long1/short1 5 times. If you then go straight to long TP, you have 5 short1 shorts that get canceled out at long1 for 5 * 30 = 150 loss, plus 1 long at short1 and 7 longs at long2/3 for a nice profit. But it's very different if you go to short3 before you head to long TP. The long1/short1 positions cancel out. You have 6 shorts at short2 and 6 at short3, so you have 6 * 60 = 360pip exposure until you get to long2, when the long2 longs effectively close the 6 shorts at a 360pip loss. The 6 shorts at short3 get closed for a 6*90 = 540pip loss. Ouch. And you'll only have about 100 pips of wins to offset those.

SO: I believe the more times you bang back & forth, the bigger your winning-side gains become -- but the bigger potential losses become, and those are bigger. If you never went deeper than level 1 on the losing side, the big position sizes benefit you. If you go deeper, the big position sizes hurt you. But you don't know if they'll help or hurt until you finally hit the TP, because until then you don't know which side is the winner. You could mitigate the risk by saying "I give up and close the position the Nth time I try to increase size" or something like that. Or refuse to increase the position size beyond N. Or something similar to that.

Just some thoughts...
User avatar
ironrick
Trader
Posts: 85
Joined: Wed Nov 16, 2011 7:04 pm
Location: North Idaho Boy, USA

Re: Euro Grid by Dietmar

Post by ironrick »

gaheitman wrote: Rick,

Here's a slightly updated indicator. It allows you to change the step width as well as the start time down to the minute. It should allow you to manually investigate some of your ideas.

It also tries to keep track of the max number of open trades and worst draw down/loss and displays it in the comments. I'm not counting that as fully debugged, so it's more directional. :>

George

George,

Thanks for the updates to your PRICETRAP indi! Unfortunately I can't get it to actually draw anything on screen except for the comments at the top of the screen. The old indi from Dietmar's original thread works fine though.

I am just getting into Empty4 code though so I don't know if it is me or a bug. Maybe it has to do with allowing the custom step width?

Couple of questions as well:
1) Are the trade stats in the comments section for the last day's trade only? Or is it showing a total or an average or the max stats/numbers for all the days in the chart's history (ie the worst day on the charts)? Not sure I am getting what is displayed in the comments section?

2) Is there a way to print the vital statistics of each day's trade above each trade (say above the imaginary TP line) rather than just in the comments section?

3) I have read the original thread that Dietmar references as the genisis of this system. That original author recommends trying step width settings based on ATR -- which is something Khalid also suggested. My idea was to try some using some ADR based scenarios. Is it possible to use either of these within the indicator? I have some ideas of the settings logic that could be used if it is possible. But I don't want to impose on you either! I will wait to hear from you.


Gary

I am working through the logic of your post. I may need sleep before I can totally understand. :)

I like the thinking though -- and you and I have already said that a max trades limit could help on the "bad days".

I have a few other ideas of limits or filters as well. Those are coming as I mull on them some more.

I am waiting for George's excellent indi to help me with some basic ideas.

Thanks again, All!

Cheers,
Rick
"A problem well put is half solved."
User avatar
gaheitman
Trader
Posts: 655
Joined: Tue Nov 15, 2011 10:55 pm
Location: Richmond, VA, US

Re: Euro Grid by Dietmar

Post by gaheitman »

ironrick wrote: George,

Thanks for the updates to your PRICETRAP indi! Unfortunately I can't get it to actually draw anything on screen except for the comments at the top of the screen. The old indi from Dietmar's original thread works fine though.
Hmm, not much of an improvement, is it. :D Check the Start_Minute, it's set to 11 (no particular reason, just the last thing I looked at in testing). Set at 11, it won't work unless you are on a minute chart.
ironrick wrote: Couple of questions as well:
1) Are the trade stats in the comments section for the last day's trade only? Or is it showing a total or an average or the max stats/numbers for all the days in the chart's history (ie the worst day on the charts)? Not sure I am getting what is displayed in the comments section?
The stats are cumulative for whatever history you have loaded in the chart.
ironrick wrote: 2) Is there a way to print the vital statistics of each day's trade above each trade (say above the imaginary TP line) rather than just in the comments section?
It currently prints the net pips calculated at the close of each bar along with the daily result. What else would you like to see?
ironrick wrote: 3) I have read the original thread that Dietmar references as the genisis of this system. That original author recommends trying step width settings based on ATR -- which is something Khalid also suggested. My idea was to try some using some ADR based scenarios. Is it possible to use either of these within the indicator? I have some ideas of the settings logic that could be used if it is possible. But I don't want to impose on you either! I will wait to hear from you.
Let me know what you have in mind and I'll give it a go.

George
User avatar
lhDT
Trader
Posts: 198
Joined: Tue Nov 15, 2011 9:52 pm
Location: Brussels/Belgium

Re: Euro Grid by Dietmar

Post by lhDT »

Today is a hard day for EuroGrid.
Currently -42pips and 15 trades still running ...
User avatar
forextrader-radioman
Trader
Posts: 156
Joined: Sun Nov 27, 2011 11:11 am
Location: Hamburg/Germany

EA still not working here, now with error messages

Post by forextrader-radioman »

Dragos, today I tested the EA again on my VPS ... one in EURUSD M5 Chart, Grid start should be at 08:00 B_roker time ... Screenshot of settings below ... EA did not set one single pending order ... nothing ...

the second was running on GBPUSD M5 Chart, Grid start should be at 09:00 B_roker time ... Screenshot settings below, too ... EA tried to set pending orders, but at 11:03 B_roker time ...3 hours later?!? ... and there was no pending order set correctly but an endless flow of error messages (Screenshot below)...

Why starts it to generate pending orders so late, 3 hours after the Grid-set-time in the EA?

All of you a nice afternoon/evening,
Dietmar

first screenshot is EU settings
second screenshot is GU settings
third screenshot is GU error messages
You do not have the required permissions to view the files attached to this post.
„Reality is merely an illusion, albeit a very persistent one.” (Albert Einstein) "Realität ist lediglich eine Illusion, allerdings eine sehr hartnäckige."
User avatar
gaheitman
Trader
Posts: 655
Joined: Tue Nov 15, 2011 10:55 pm
Location: Richmond, VA, US

Re: EA still not working here, now with error messages

Post by gaheitman »

Dragos,

I believe the issue with not setting orders at all when the time passes is that the time tests in LookForTradingOpportunities() are looking for equality instead of being "greater than or equal to." An example of the code (there are multiple instances):

Code: Select all

TimeCurrent() == StrToTime(GridStartTime)
The function TimeCurrent() returns time with precision down to the second, so it may or may not match GridStartTime which has no seconds (it likely won't match). If you change the code to

Code: Select all

TimeCurrent() >= StrToTime(GridStartTime)
it will trigger correctly.

George

forextrader-radioman wrote:Dragos, today I tested the EA again on my VPS ... one in EURUSD M5 Chart, Grid start should be at 08:00 B_roker time ... Screenshot of settings below ... EA did not set one single pending order ... nothing ...

the second was running on GBPUSD M5 Chart, Grid start should be at 09:00 B_roker time ... Screenshot settings below, too ... EA tried to set pending orders, but at 11:03 B_roker time ...3 hours later?!? ... and there was no pending order set correctly but an endless flow of error messages (Screenshot below)...

Why starts it to generate pending orders so late, 3 hours after the Grid-set-time in the EA?

All of you a nice afternoon/evening,
Dietmar

first screenshot is EU settings
second screenshot is GU settings
third screenshot is GU error messages
DragosDanescu
Trader
Posts: 118
Joined: Wed Nov 16, 2011 5:18 pm
Location: Oradea, Western Romania

Re: EA still not working here, now with error messages

Post by DragosDanescu »

gaheitman wrote:Dragos,

I believe the issue with not setting orders at all when the time passes is that the time tests in LookForTradingOpportunities() are looking for equality instead of being "greater than or equal to." An example of the code (there are multiple instances):

Code: Select all

TimeCurrent() == StrToTime(GridStartTime)
The function TimeCurrent() returns time with precision down to the second, so it may or may not match GridStartTime which has no seconds (it likely won't match). If you change the code to

Code: Select all

TimeCurrent() >= StrToTime(GridStartTime)
it will trigger correctly.

George
Thanks, George,
but that generates another problem.If I use >=, it start shooting pendings all the way, not only 1 set, but a lot of them.Tried to stop it doing that by checking if Pendings !=0, but seems it doesn't work, no ideea why. Trying to find a solution....
Image
User avatar
dynel14
Trader
Posts: 37
Joined: Wed Nov 16, 2011 1:38 am
Location: Cologne/Germany

Re: EA still not working here, now with error messages

Post by dynel14 »

DragosDanescu wrote:
gaheitman wrote:Dragos,

I believe the issue with not setting orders at all when the time passes is that the time tests in LookForTradingOpportunities() are looking for equality instead of being "greater than or equal to." An example of the code (there are multiple instances):

Code: Select all

TimeCurrent() == StrToTime(GridStartTime)
The function TimeCurrent() returns time with precision down to the second, so it may or may not match GridStartTime which has no seconds (it likely won't match). If you change the code to

Code: Select all

TimeCurrent() >= StrToTime(GridStartTime)
it will trigger correctly.

George
Thanks, George,
but that generates another problem.If I use >=, it start shooting pendings all the way, not only 1 set, but a lot of them.Tried to stop it doing that by checking if Pendings !=0, but seems it doesn't work, no ideea why. Trying to find a solution....
Had the same problem after I changed all

Code: Select all

TimeCurrent() == StrToTime(GridStartTime)
to

Code: Select all

TimeCurrent() >= StrToTime(GridStartTime)
But after changing only under

Code: Select all

void LookForTradingOpportunities()
{
everything works.

Thank you George and Dragos,
dynel14
DragosDanescu
Trader
Posts: 118
Joined: Wed Nov 16, 2011 5:18 pm
Location: Oradea, Western Romania

Re: Euro Grid by Dietmar

Post by DragosDanescu »

Ok, guys, please check 1st post for updated version.I hope I solved all the problems for now.
Thanks George for your unvaluable help!

Strange thing is that in backtester, if I use 01.01.2010 as starting day, it keeps opening loads of grid orders, if I switch to the next day, everything works fine.Must be voodoo.... :lol:
Another problem was that void DefineLevels() was called too many times, accidentally...now solved.

Dinamically LevelsOffset is calculated by Previous day range*0.15 (just pure guess). If you check the fixed value (let's say default of 15 pips)and ALSO select AutoLevelsOffset as true, EA ill choose the greatest value between them . So, if Previous day range = 160*0.15 = 24, EA will use 24 pips as level offset. You can see that also in the user display.

Have fun

P.S. I'm having fun now with UseDiffLevelLots=true, multiplier 1.5....no martingale
Image
Post Reply

Return to “Automated trading systems”