BEST Supertrend Strategy

Hello traders

Sharing a sample Supertrend strategy to illustrate how to calculate a convergence and using it in a strategy

I based the setup as follow:

- Entries on Supertrend MTF breakout + moving average cross. Entering whenever there is a convergence
- exit whenever a Simple Moving Averages cross in the opposite direction happen
- possibility to filter only Longs/Shorts or both

All the best
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?
💰 Results/Blogs: https://bit.ly/2ULUtjo

⏩ Signals/Pricing: https://best-trading-indicator.com/pages/pricing

🐦 Twitter: https://twitter.com/bti_trading

👉 Get a $30 discount on TradingView: https://bit.ly/2UM5OA0

📺 Youtube: https://bit.ly/3bKvnZu


Coolbeans !
+4 Antworten
great! Is it possible to configure surendrend in hours or minutes timeframes?
+3 Antworten
Daveatt zorak2d
@zorak2d, you mean having an hourly supertrend on a different chart timeframe?
hi @Daveatt, I tried to change the code to insert supertrend in 30, 60 and 120 minutes, however I failed. Do you have any clue or even give a hand on that try?
Daveatt leonardoabad
@leonardoabad, probably too many things to change for that
Better to start from a strategy template from scratch, and implement the supertrend function without the security function AND just adding resolution="" in the strategy(....) function
Tried this script and the entries on real time got repainted after refreshing and moved to an earlier time. This is because of presence of "lookahead=true" argument in the security function. To get realistic results during back testing, one should change the specific arguments to " lookahead =false". However this script has good educational value. Thanks
+1 Antworten
Daveatt bandy99
@bandy99, excellent comment
this is an old script
To avoid repainting with live data, we can use security functions as explained here:

// ————— SILVER (BEST): Uses only one `security()` call but allows repainting control.
//          - Cannot be used when the source is a tuple-returning function (use the following method then).
//          The first three parameters are the same as those of `security()`. 
//          The last one: `_rep`, must be a boolean (true/false) value. It indicates if you want repainting (true) or not (false).
f_security(_sym, _res, _src, _rep) => security(_sym, _res, _src[not _rep and barstate.isrealtime ? 1 : 0])[_rep or barstate.isrealtime ? 0 : 1]
c1 = f_security(ticker, i_timeframe, i_source, i_repaint)
plot(c1, "c1: 👍 `f_security()`", color.silver, 14)

// ————— SILVER (BEST for tuples): Technique providing the functional equivalent of `f_security()` for use with functions returning a tuple.
f_oc(_offset) => 
    // int _offset: the first half of the offset calcs required to achieve repainting/non-repainting.
    //              The second half will be handled post `security()` call, by indexing the received tuple values in a variable reassignment.
    _o = open[_offset]
    _c = close[_offset]
    [_o, _c]
[o_, c_] = security(ticker, i_timeframe, f_oc(not i_repaint and barstate.isrealtime ? 1 : 0))
o = o_[i_repaint or barstate.isrealtime ? 0 : 1]
c = c_[i_repaint or barstate.isrealtime ? 0 : 1]
c2 = c
plot(c2, "c2: 👍 Tuple form", color.fuchsia, 8)
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