tbiktag

Moving Regression Band Breakout strategy

Following the introduction of the Moving Regression Prediction Bands indicator (see link below), I'd like to propose how to utilize it in a simple band breakout strategy:

  • Go long after the candle closes above the upper band. The lower band (alternatively, the lower band minus the 14-period ATR or the central line) will serve as a support line.
  • Exit as soon as the candle closes below the support line.
  • To manage the risk of false breakouts, a fixed stop loss is set to the value of the support line at the time of opening a position. When the support line moves above the position opening price, shift the stop loss to breakeven.
The same logic but in reverse applies to short positions.

As an option, it is possible to allow long entries only when the slope of the Moving Regression curve is positive (and short entries when the slope is negative).

Model parameters:
  • Length and Polynomial Order define the lag and smoothness of the model.
  • Multiplier specifies the width of the channel.

As the default model parameter values, I set those that I found to provide optimal risk / reward ratio on the daily timeframe (for both trending and range-bound market). However, the settings are very flexible and can be well-adjusted to particular market conditions. Feel free to play around and leave feedback in the comments!


Here's the original Moving Regression Prediction Bands script:
Versionshinweise: corrected the way of how the user-defined backtest period is handled
Versionshinweise:
Open-source Skript

Ganz im Sinne von TradingView hat der Autor dieses Skripts es als Open-Source veröffentlicht, damit Trader es verstehen und überprüfen können. Ein Hoch auf den Autor! Sie können es kostenlos verwenden, aber die Wiederverwendung dieses Codes in einer Publikation unterliegt den Hausregeln. Sie können das Skript den Favoriten hinzufügen, um es auf dem Chart zu verwenden.

Möchten Sie dieses Skript auf einem Chart verwenden?

Kommentare

Hello, thanks for sharing this script. Is the stop loss hard coded in? Some of my orders don't stop out until a ridiculous amount is reached. Would you add a user input for stop loss? Thanks.
+4 Antworten
tbiktag rlone9440
@rlone9440, that's a fair point. The current implementation allows setting a stop loss only at one of the bands. But it will certainly be useful to make it flexible. Let's see if I can incorporate this in a non-invasive way.
+3 Antworten
Hello, many thanks for sharing the strategy. I have one question, what modifications in the input parameters should I do if I want to trade with the strategy at 15 mins or 10 mins intervals. Thanks in advance..
+2 Antworten
Do you have a version of this script with Alerts ?
+2 Antworten
tbiktag gmeneguzzo
@gmeneguzzo, as far as I know, it's not possible to use an alertcondition in a Pine Strategies. You might want to consider using the original indicator (I just added alerts to it):
+1 Antworten
cryptolinx tbiktag
@tbiktag, now it is possible. ;) TV has deployed a brand new alert() function, which works with both, strategies and studies.
On strategies, you can choose between 3 diverend calls:

- Order fills only
- Order fills and alert() function calls
- alert() function calls only

TV Blog: https://www.tradingview.com/blog/en/our-new-alerts-allow-for-dynamic-messages-22588/
+2 Antworten
tbiktag cryptolinx
@cryptolinx, I guess I overlooked this, thanks for the link! I gotta check this
Antworten
@tbiktag, when I add alerts to this script it gives me an error about the "repainting" wondering if it's something that I'm doing wrong that I can fix? This strategy is great! Thanks for your contribution.
Antworten
tbiktag lawrenceleong
@lawrenceleong, Thanks for the feedback! I think the message that you're talking about is more of a warning than an error. But if you'll be having trouble with setting the alerts, you can always send me a message.
Antworten
@tbiktag, I would also like the version with alerts. Can you provide it for us?
Antworten
Startseite Aktien-Screener Forex-Screener Krypto-Screener Wirtschaftskalender Über Chartmerkmale Preise Einen Freund empfehlen Hausregeln Hilfe Center Webseite & Brokerlösungen Widgets Charting Lösungen Lightweight Charting Library Blog & News Twitter
Profil Profileinstellungen Konto und Abrechnung Angeworbene Freunde Coins Meine Support Tickets Hilfe Center Private Nachrichten Chat Abmelden