GridDancer / GridMaster

Rene's trading Expert Advisors
User avatar
renexxxx
Trader
Posts: 860
Joined: Sat Dec 31, 2011 3:48 am

GridDancer / GridMaster

Post by renexxxx »

acostafulano » Wed Nov 23, 2016 4:52 am wrote:Even though my demos are running great, I would still understand exactly how the closure logic works in order to be more comfortable when going live eventually.
Hi Diego,

The exit logic in GridMaster 1.8 has already been explained twice in this thread, but judging from your post, it is still not understood, so I will attempt a third and last time.

GridMaster has three distinct exit rules:

1. Send an RnR-message to all the Dancers if current equity has fallen below EquitySL or current equity has risen above EquityTP.
2. Send an RnR-message to all the Dancers if the total floating unrealised profit of all the open trades combined exceeds the given BasketProfit.

1. and 2. are easy to understand. The third rule is what people are struggling with. Let's go back to GridMaster 1.3 to see what the problem was with that version. Take your list of open trades: these are nicely sorted in descending order of PIPs, for convenience. GM 1.3 would take the bottom trade, ( BUY 0.01 GBPUSD at 1.24259, currently -$0.56 ) as it is the biggest loser. It would subsequently offset that trade with winners, starting from the top (i.e. the biggest winners), such that the total profit would exceed MinProfit (let's say, for example, $5.00). So, GM 1.3 would close (BUY 0.01 GBPUSD at 1.24259), together with the top 4 winners (BUY EURJPY, SELL AUDUSD, BUY CHFJPY, BUY USDJPY) for a total profit of $6.30. Check!
There is nothing wrong with this strategy except that always, over time, one or more pairs got into a situation like this:
PerfectHedge.PNG
I am not going to present a mathematical or logical explanation for this phenomenon, but this is purely empirical, based on doing lots of forward testing with GM 1.3. This is a nail in the coffin for GM 1.3, as the band of BUYs above the market price and band of SELLs below the market price seemed to get wider and wider, resulting in a drawdown from which version 1.3 could not recover.

GM 1.8 is attempting to resolve these hedges. How? If and when one or more pairs do have hedges, GM 1.8 picks up the biggest losing hedge (from all the pairs and from all the hedges for a pair). Typically, that would be the highest BUY and the lowest SELL of a particular pair. To close this selected hedge will become the target and main focus of GM 1.8, and it will succeed if it can find winning trades of other pairs, such that the total profit exceeds MinProfit. This is in essence how the third exit rule works in GM 1.8. So, each time GM 1.8 manages to close a few trades according to this exit rule 3, there is one hedge less to worry about.

To come back to your list of open trades: In that list, none of the pairs is in a hedge situation. So, GM 1.8 has no opportunity to close trades based on rule 3.

You might ask: How is it possible that a pair has both BUYs and SELLs open at the same time? Answer: The Dancers are opening trades in the direction of the most recent HGI signal and it is possible that HGI 'changes it's mind' about the direction.

I believe that GM/GD has the potential to become a reliable bot. However, when I see a weakness, I try to 'plug that hole'. The hedge-closing mechanism was a response to the widening hedges. The Max Currency Exposure filter was a response to the problem created by the Dancers opening a gazillion of trades in a falling market. Let's see what's next.

Anyway, I hope that this clarifies the closing mechanism in GM 1.8 foregood.
You do not have the required permissions to view the files attached to this post.
deadman
Posts: 8
Joined: Fri Feb 05, 2016 5:07 pm

GridDancer / GridMaster

Post by deadman »

Hi Rene,

first of all I would like to say thank you for the great EA.

I wondering if it would be possible to implement a news filter. If high impact news come up my idea would be to simply close or hedge the open position to reduce the impact due to the news, Of course, I'm open for other opinions. Theoretical high impact news are not a big deal, because markets always recover at some point, but due to the massively increased spreads, order execution delay and slippage there is a high risk to run into a high draw down.

Please let me know what you think.

Thanks!
acostafulano
Trader
Posts: 243
Joined: Tue Dec 06, 2011 3:40 pm

GridDancer / GridMaster

Post by acostafulano »

Thanks for the explanation Rene!
falanca
Trader
Posts: 31
Joined: Tue Mar 04, 2014 2:23 pm

GridDancer / GridMaster

Post by falanca »

İ have some questions for this very useful topic.

1-Cant we use more pratical ındi such for example slope indi in order to HGİ indi which is certainly more complex and has no extra advantage to open orders on grids

2-Put the grid orders according to ranges of predicted bars.For example İf there was 200 pip movement on past 100 bars,then grid steps will be 40 pips,if there were 400 pips grid steps will be 80 pips.And we shall put SL values as 200 pips.Becouse profit will exist whenever volality comes and range is broken.Gridmaster will work on the other hand

Sorry for english.İ just wanted to give you an opinion.Best wishes
falanca
Trader
Posts: 31
Joined: Tue Mar 04, 2014 2:23 pm

GridDancer / GridMaster

Post by falanca »

But perhaps you may say that this was a different logic also.
Timmy
Posts: 7
Joined: Wed Oct 17, 2012 2:11 pm

GridDancer / GridMaster

Post by Timmy »

Hi Rene,

Some discussion points to consider:

Just looking at the way the GD's run the trades and the resulting "natural" exposure of each currency. I am concerned about your Maximum Currency Exposure (MCE) tool.

My thinking is that the Dancers automatically move the exposure into a weighted direction as a trend in one or more currencies (not pairs) forms. So by default a high exposure occurs as the Basket Profits are reached - this must happen. And as the price action momentum dies off and moves into a range across the currencies then the Dancers (slowly - or quickly depending on time frame used) move the exposure naturally into a neutral balance (multi pair natural hedge).

Of course in the process of this hedged exposure position you will always end up in a drawdown - but this is when the MiniProfit tool slowly takes care of the hedges as movements of one or another of the pairs gives it a chance to close out hedged losses. This works pretty well since it is based solely on price action.

I am concerned by limiting the exposure you will cause possible risks:

1/ You may disrupt the completion of BasketProfits as MCE cuts out any more trade entries for one or more pairs as a currency reaches its exposure level.

2/ You may disrupt the natural hedging process & the MinProfit closers.

3/ You could disrupt the rebalance of the Dancers as the market moves into a new trend period. This could also create undue risk since your net exposure may take you in the wrong direction without the capability of swinging the trades back the other way if the MCE sees a currency at its max exposure.

Your thoughts here ...

Tim
User avatar
renexxxx
Trader
Posts: 860
Joined: Sat Dec 31, 2011 3:48 am

GridDancer / GridMaster

Post by renexxxx »

Timmy » Fri Nov 25, 2016 7:27 am wrote: Your thoughts here ...
It is good you bring this up, and yes, indeed, the MCE can also reduce the profitability of this bot, by limiting the amount of trades in the "good" direction. But consider the following scenario, whilst the MCE filter is off:
1. HGI has given the UP signal for a certain pair.
2. A news item comes out and the pair falls 400 PIPs. Every 4 pips during this fall, the Dancer opens a new BUY and you end up with 100 BUYs in the wrong direction.

With the MCE filter on, you would have had only 3 or 4 BUYs open (also, in a massive drawdown, but much better than with the MCE filter off).

To answer your questions:
Timmy wrote:1/ You may disrupt the completion of BasketProfits as MCE cuts out any more trade entries for one or more pairs as a currency reaches its exposure level.
True, as MCE could cut out profitable trades that we need to get to a BasketProfit
Timmy wrote:2/ You may disrupt the natural hedging process & the MinProfit closers.
Untrue. The MCE filter only stops too many trades for a currency into a single direction, either BUY or SELL. If, eg. the current USD exposure level = +0.20 and the limit is 0.20, it can not open another pair where the USD is bought, (such as BUY USDCAD), but it can open another pair where the USD is sold (such as SELL USDCAD, or BUY GBPUSD).
Timmy wrote:3/ You could disrupt the rebalance of the Dancers as the market moves into a new trend period.
Also untrue. See answer above.

In any case, you have the flexibility to either (1) completely switch off the MCE filter (by setting UseCurrencyExposureFilter to false), or (2) leave the MCE filter on, but set the limit to a very high number (with the "Maximum Currency Exposure / Equity" setting). However, bear in mind that this functionality has been added to make the bot safer, so if you opt not to use it, you are taking higher risks.

Cheers.
Timmy
Posts: 7
Joined: Wed Oct 17, 2012 2:11 pm

GridDancer / GridMaster

Post by Timmy »

Hi Rene,
I appreciate I can switch it off - but just thought it would be good to debate the value of the tools applied to the EA's. I actually like the MCE tool but feel it could cause some issues if applied in the wrong way.

Firstly - I think that I will be safe from opening positions with in a black swan situation as Spread always moves within milliseconds as liquidity dries up- in milliseconds. So with a spread filter on I am safe (granted this can vary a little depending on your broker quality). So the MCE can act as a back up protection in this instance (or when there is just a general sudden move) - but as you mention I would have the ratio well out to ensure enough wiggle room.

I am not sure I agree with your position regarding my point 2 & 3- since you may already be at a hedge position across a number of open pairs by the time the MCE limit is hit and then using your example - "eg. the current USD exposure level = +0.20 and the limit is 0.20, it can not open another pair where the USD is bought, (such as BUY USDCAD), but it can open another pair where the USD is sold (such as SELL USDCAD, or BUY GBPUSD)" - BUT what if the market goes into USD strength from here then it cannot break out of the ranging situation with any USD pairs.... so this will impact on the price action and the natural exposure process of the Dancers.

I run PZ Risk Management software that allows me to track exposure and trader side leverage easily. It is very interesting to track it as the Dancers and the Master do there thing. My leverage goes rapidly out to 1:3 - 1:5 when a trend is on and baskets are being closed as exposure blows out in the trend direction. And my leverage comes back to 1:1 when price action forces the dancers (by default) to naturally hedge the market with whatever currencies. The breakout from here can be in either direction of course and the Dancers will go with the money flow if uninhibited. i do not want to limit this process.

This said I will use the MCE but maybe at 0.5 or something like that. Also can the MCE be made currency specific? (the reason being that we may want to run skewed baskets of instruments - such as all pairs with USD in them. In this case the MCE will definitely cause it an issue).

Really appreciate your work Rene:)

Cheers
Tim
kwchau
Trader
Posts: 305
Joined: Tue Jan 03, 2012 3:37 pm

GridDancer / GridMaster

Post by kwchau »

Just like to learn the reason of the following error. For some pairs, the following error message will appear when Dancer is first attached to a chart or when the Platform restarts. The problem goes away when the Dancer EA is attached a second time.

2016.11.25 16:28:16.789 HGIDancerv1.4 GBPCHF,H4: Alert: Invalid parameter(s) specified for DistanceBetweenTrades
2016.11.25 16:28:16.789 HGIDancerv1.4 GBPCHF,H4: ExpertRemove function called

Appreciate any reply,

Cheers,
kwchau
User avatar
renexxxx
Trader
Posts: 860
Joined: Sat Dec 31, 2011 3:48 am

GridDancer / GridMaster

Post by renexxxx »

kwchau » Fri Nov 25, 2016 6:58 pm wrote:Just like to learn the reason of the following error. For some pairs, the following error message will appear when Dancer is first attached to a chart or when the Platform restarts. The problem goes away when the Dancer EA is attached a second time.

2016.11.25 16:28:16.789 HGIDancerv1.4 GBPCHF,H4: Alert: Invalid parameter(s) specified for DistanceBetweenTrades
2016.11.25 16:28:16.789 HGIDancerv1.4 GBPCHF,H4: ExpertRemove function called

Appreciate any reply,

Cheers,
kwchau
kwchau,

The Dancer needs to have a (positive) value for gridSize (or DistanceBetweenTrades) in order to operate. When it first starts, or when there are no trades open, it will obtain this value either from the DistanceBetweenTradesPips parameter, or from the DistanceBetweenTradesATRRatio parameter, with the latter one taking precedence. If, at the end of this calculation, gridSize has still no positive value, the Alert message is sent and the Expert is removed.

In your case, you would have set a non-negative value for DistanceBetweenTradesATRRatio, so it would try to calculate the gridSize via the ATR. The iATR() function often returns a zero-value, if it is run just after the platform is started and the chart is just loaded. That's why the calculated value for gridSize is zero and that's why you get the error message.

Cheers.
Post Reply

Return to “Auto-trading EA's and EA monitors”