Persistent Breakout and Range Strategy Request MT4

If you need an Indicator or Signal developed or translated from other language, please post all Indicator development REQUESTS to this section here.

Moderator: admin

Persistent Breakout and Range Strategy Request MT4

Postby davidf515 » Fri May 03, 2019 11:53 pm

Hi everyone. I have a request for an MT4 Strategy. I’ve seen similar Strategies here, but they are a bit more complicated than what I’m after.

Basically, the Strategy sets a level X pips above and a level Y pips below the CURRENT market (X and Y usually being the same number). These will be Entry levels, Buy or Sell depending on the type of Strategy you want: Breakout or Range. Most importantly these levels will be PERSISTENT (will explain later).

If the Strategy is set to BREAKOUT, then the Upper Level will be a Buy Stop (Enter Long) and the Lower Level will be a Sell Stop (Enter Short). The Trade Size and the Take Profit amount in pips will be input by the user. The Stop Losses for each level will be the opposing level.

If the Strategy is set to RANGE, then the Upper Level will be a Sell Limit (Enter Short) and the Lower Level will be a Buy Limit (Enter Long). The Trade Size will again be user input, but here the Stop Loss will be input by the user, and the Take Profit for each level will be the opposing level.

The levels being PERSISTENT means that when one level is hit for either a gain (RANGE) or a loss (BREAKOUT), then that order is automatically RE-ENTERED by the Strategy. If the BREAKOUT Long position you’re in from the Upper Level being touched reverses and gets stopped at the Lower Level, the Strategy opens a Short position and RE-ENTERS the Buy Stop (Enter Long) at the Upper Level.

Conversely, if you’re executing a RANGE Strategy and the Short position you’re in from the Upper Level being touched moves down to the Lower Level, giving you your profit, the Strategy opens a Long position and RE-ENTERS another Sell Limit order at the Upper Level.

After a pre-determined number of wins or losses, as input by the user, the Strategy would stop, all positions closed and all pending orders cancelled, OR the Stop Strategy could also be determined by a Max / Min Account value.

I had something like this years ago (but not in MT4) that worked well. Crucially, it also moved the Take Profit point further out if I took a loss in Breakout mode, so my eventual profit would still be maintained. This was VERY helpful as it prevented a few losses from wiping out my eventual gain. It could do the same thing in RANGE mode by moving the Stop Loss further out, but that wasn’t as useful.

I was also able to optionally start the Strategy at a later time, but this was rarely used. Didn’t need alarms or e-mail notifications.

If this seems doable, I think it would make a great addition to people’s Trading Tools.

Thanks for your help.
davidf515
 
Posts: 41
Joined: Wed Feb 09, 2011 2:31 am

Re: Persistent Breakout and Range Strategy Request MT4

Postby Apprentice » Mon May 06, 2019 5:00 am

Your request is added to the development list under Id Number 4640
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 23231
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia


Re: Persistent Breakout and Range Strategy Request MT4

Postby davidf515 » Wed May 15, 2019 8:32 pm

Sorry about the delay in responding. Thank you Apprentice.

I've been testing this for a couple of days. Had a bit of an issue with the Strategy not replacing the Entry Orders when they get stopped out. I think it was due to the Slippage Points input not being large enough. I started inputting 100 points and haven't had that problem since. Hopefully that was it.

More importantly, the Strategy needs to know when to STOP. Ideally, there would be an input for Max and Min Account Balance. The Strategy would work until one of those was reached, then it would close all positions, cancel all Pending Orders and end. This would make it PERFECT.

As it is, I've already used it successfully. Breakout works well just AFTER a High impact news announcement, when spreads reduce back to normal but the market continues on or retraces. Range is good during the post-rollover Asian session for US, CAD and European pairs (usually GBP/USD and EUR/CAD), but not so much for JPY and AUD pairs.

If you could manage to include the STOP STRATEGY inputs at MIN and MAX Balances, that would be great!

Thanks again Apprentice.
davidf515
 
Posts: 41
Joined: Wed Feb 09, 2011 2:31 am


Re: Persistent Breakout and Range Strategy Request MT4

Postby davidf515 » Thu May 30, 2019 10:08 pm

Thanks Apprentice!

Still testing. Works well most of the time but occasionally doesn't re-enter orders still, even with 100 slippage entered. Doesn't happen often so hard to pin down a reason. Trying to figure out if there's a market condition that affects this.

Will update if I find anything. Thanks again for everything.
davidf515
 
Posts: 41
Joined: Wed Feb 09, 2011 2:31 am

Re: Persistent Breakout and Range Strategy Request MT4

Postby davidf515 » Wed Aug 14, 2019 10:52 pm

Hello Apprentice.

Can you take another look at this? It's still breaking down occasionally.

About a third of the time the Strategy just stops working and I can't figure out why. Most of the time it works fine - when an order gets stopped out, the opposite order gets entered and the stopped order gets re-placed at its original level.

Sometimes, however, the stopped out order does NOT get replaced by the Strategy. Then, if the last order gets stopped out, the Strategy has effectively ended. If I'm not in front of the computer when that happens, then I'm out of the market. This happened to me recently and resulted in me missing a huge move.

I've tried inputting a large number for "slippage points" to no avail. Also, it happens even in slow moving price action, so it's not like the market is running away too quickly.

If you could take a look at this, it would be much appreciated.

Thank you very much.
davidf515
 
Posts: 41
Joined: Wed Feb 09, 2011 2:31 am


Re: Persistent Breakout and Range Strategy Request MT4

Postby davidf515 » Wed Aug 21, 2019 4:36 pm

Here's one from this morning. Not sure how to attach a log so I'll copy/paste:

2019.08.21 01:32:13.958 Automated trading disabled
2019.08.21 01:29:37.012 Persistent Breakout and Range Strategy XAUUSD,M5: invalid pointer access in 'Persistent Breakout and Range Strategy.mq4' (459,7)
2019.08.21 01:17:52.438 Persistent Breakout and Range Strategy XAUUSD,M5: initialized
2019.08.21 01:17:52.435 Persistent Breakout and Range Strategy XAUUSD,M15: uninit reason 3
2019.08.21 01:17:36.953 Persistent Breakout and Range Strategy XAUUSD,M15: initialized
2019.08.21 01:17:36.748 Persistent Breakout and Range Strategy XAUUSD,M5: uninit reason 3
2019.08.21 01:09:00.343 Persistent Breakout and Range Strategy XAUUSD,M5: open #13428375 sell stop 0.05 XAUUSD at 1497.98 sl: 1498.98 tp: 1467.98 ok
2019.08.21 01:09:00.053 Persistent Breakout and Range Strategy XAUUSD,M5: open #13428374 buy stop 0.05 XAUUSD at 1498.98 sl: 1497.98 tp: 1528.98 ok
2019.08.21 01:08:56.882 Automated trading enabled

Note that after I enabled the Strategy on the 5M chart, I changed the view to 15M for a few seconds, then back to the 5M. I don't think I did that in the past when I had a problem.

Thanks again for your help.
davidf515
 
Posts: 41
Joined: Wed Feb 09, 2011 2:31 am


Next

Return to Indicator and Signal Requests

Who is online

Users browsing this forum: No registered users and 10 guests