SuperTrend Multiple Risk Management SystemThis is an improved SuperTrend strategy that makes use of multiple types of risk management options.
We have for example :
1. Take profit and stop loss levels based on support and resistence created with RSI and Pivot Lines(dynamic)
For example, if we have an oversold level and a pivot low , we can take that low point for support.(or resistence for short)
If instead we have an overbought level and a pivot high, we can take that high point for resistence.(orsupport for short)
2. Take profit and stop loss levels based on swing low and swing high points calculated with highest high and lowest low function(dynamic)
For example we take the lowest point in the last 100 candles. We calculate the distance from the current point to that one, and we apply this value as a take profit point. Same for stop loss
3. Take profit and stop loss levels based on % movements(fixed)
For example we have a tp or sl of 10%. If either of them make a movement of 10% from the entry point, they will get triggered.
4. Break even stop loss once the asset moves certain % in our direction.
For example we have a long breakeven of 5%. If the asset moves 5% in our direction, we move the stop loss on the entry point so if the trade pullback and crosses with this point it will exit from the trade.
Notes:
All the exits from the strategy are happening at the end of the candle close, since we are checking if inside the current candle we cross with either high or low of the candles parts the set prices from any of the above options.
At the same time we can combine multiple of them into one, and we can either exit based on which one was hit first, or use a quantity reduction of the trade and exit multiple times when we hit any of the levels.
This tool is for educational purpose only.
Its main purpose is to show the difference between having a risk management or without.
For example on this scenario of BTC USD 4h, I found out that the drawdawn was reduced by more than half when using different type of risk management, compared to not use one at all, while at the same time increasing the profits by a huge margin.
Strategytesting
eStrategyLibrary "eStrategy"
Library contains methods which can help build custom strategy for continuous investment plans and also compare it with systematic buy and hold.
sip(startYear, initialDeposit, depositFrequency, recurringDeposit, buyPrice) Depicts systematic buy and hold over period of time
Parameters:
startYear : Year on which SIP is started
initialDeposit : Initial one time investment at the start
depositFrequency : Frequency of recurring deposit - can be monthly or weekly
recurringDeposit : Recurring deposit amount
buyPrice : Indicatinve buy price. Use high to be conservative. low, close, open, hl2, hlc3, ohlc4, hlcc4 are other options.
Returns: totalInvestment - initial + recurring deposits
totalQty - Quantity of units held for given instrument
totalEquity - Present equity
customStrategy(startYear, initialDeposit, depositFrequency, recurringDeposit, buyPrice, sellPrice, initialInvestmentPercent, recurringInvestmentPercent, signal, tradePercent) Allows users to define custom strategy and enhance systematic buy and hold by adding take profit and reloads
Parameters:
startYear : Year on which SIP is started
initialDeposit : Initial one time investment at the start
depositFrequency : Frequency of recurring deposit - can be monthly or weekly
recurringDeposit : Recurring deposit amount
buyPrice : Indicatinve buy price. Use high to be conservative. low, close, open, hl2, hlc3, ohlc4, hlcc4 are other options.
sellPrice : Indicatinve sell price. Use low to be conservative. high, close, open, hl2, hlc3, ohlc4, hlcc4 are other options.
initialInvestmentPercent : percent of amount to invest from the initial depost. Keep rest of them as cash
recurringInvestmentPercent : percent of amount to invest from recurring deposit. Keep rest of them as cash
signal : can be 1, -1 or 0. 1 means buy/reload. -1 means take profit and 0 means neither.
tradePercent : percent of amount to trade when signal is not 0. If taking profit, it will sell the percent from existing position. If reloading, it will buy with percent from cash reserve
Returns: totalInvestment - initial + recurring deposits
totalQty - Quantity of units held for given instrument
totalCash = Amount of cash held
totalEquity - Overall equity = totalQty*close + totalCash
WhaleCrew VisionVision is an advanced momentum oscillator that visualizes momentum strength with overbought and oversold readings.
Features
Momentum Waves
Divergence Detection (regular and hidden divergences)
Detection for momentum shifts (detects higher lows/lower highs on the oscillator)
Detection for momentum stagnation
Moneyflow
Most important: Our Custom Strategy Builder
Custom Strategy Builder
The custom strategy builder is a framework that allows you to easily create custom strategies.
1. Configure long/short conditions
Pre-defined conditions for custom timeframes, under which you're looking to potentially enter a trade.
2. Configure trigger
Select a trigger (e.g. "Wave Cross" or "Wave Lower High") to generate labels/alerts for potential entries, whenever long/short conditions are met.
3. Configure Take Profit Conditions
Potential Take Profits are triggered by momentum stagnation.
4. Backtest your strategy
By using our open-source backtester script (published on our profile).
5. Trade responsibly
Manually review each signal/alert before taking any actions.
Note: The "Strategy Backtest" input section can also help you develop your strategy.
Usage
You can use this indicator to follow the trend, detect momentum shifts or memorize patterns.
Take a systematic approach by using our strategy builder.
Access to this indicator can be obtained through our website.
Dual MACD StrategyThis strategy Multi Time Frame Macd Indicator
We take the first long position when we have a buy signal in Weekly Macd (Macd line crosses above Signal line). This open a trading window, showed with green background color
We close the first position when either Weekly or Daily Macd give us a sell signal ((Macd line crosses below Signal line))
Enable Profit and Stop in strategy settings with different percentage to backtest the strategy. Also if it is better to use a Traditional Stop Loss or a Trailing Stop Loss based on a percentage from low prices
Change macd resolution in settings for other time frames to test the strategy
This Strategy was tested on Crypto Market with good results in assets as BTC, ETH, BNB, ADA, LTC, XLM, BCH, among others
Daily Dax Strategy
-----------------
Hey there!
There are a lot of reasons why this strategy has performed very well in recent years.
A very simple strategy in itself. The system basically follows the trend following approach. The focus is always on rising trends. No action takes place during falling trends. Both time filters and trend filters are used. There is only one position per day which is compulsorily closed again at the end of the time filter.
Only for CURRENCYCOM:DE30 !
The indicator is designed for the h1 hourly chart. In addition, the display can be adjusted using the options.
That's all. Due to the economic background, the strategy can be used without a large technical chart analysis.
Warning: Before contacting a position, it is always more important than having strong news. Better to play it safe in these same ones.
Caution: With this strategy, as an exception, no SL is allowed by default. Therefore always calculate the risk carefully.
Past results do not guarantee future profits!
Follow the link below to get access to this indicator or get us a PM to get access.
--------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------
-----------------
Willkommen!
Es gibt viele Gründe, warum sich diese Strategie in den letzten Jahren ganz gut bewährt hat.
Eine sehr einfache Strategie für sich. Grundsätzlich folgt das System dem Trendfolge Ansatz. Es wird immer nur auf steigende Trends gesetzt. Während fallenden Trends finden keine Aktionen statt. Es werden sowohl Zeitfilter als auch Trendfilter verwendet. Es gibt nur eine Position am Tag welche zwingend auch am Ende des Zeitfilters wieder geschlossen wird.
Only for CURRENCYCOM:DE30 !
Der Indikator ist für den h1 Stundechart ausgelegt. Zusätzlich kann die Anzeige über die Optionen angepasst werden.
Das ist alles. Aufgrund des wirtschaftlichen Hintergrunds kann die Strategie ohne umfangreiche technische Chartanalyse verwendet werden.
Achtung: Vor dem Öffnen einer Positionen immer zuerst prüfen ob starke News anstehen. In diesen Fällen lieber auf Nummer sicher gehen.
Achtung: Bei dieser Strategie ist standardmäßig ausnahmsweise kein SL vorgesehen. Daher das Risiko Immer gut kalkulieren.
Vergangene Ergebnisse garantieren keine zukünftigen Gewinne!
Verwenden Sie den folgenden Link, um Zugriff auf diesen Indikator zu erhalten oder schreibe uns eine PM um Zugriff zu erhalten.
Backtest Service Program (BASE) [FAF-Software-Solutions]{Deutsche Beschreibung folgt der englischen Beschreibung}
█ OVERVIEW
With BASE you can quick and easy create, test or optimize seasonal trading strategies. Seasonality is a strong, if not the strongest, trading approach to making money in the capital markets over the long term. Whether individually or in combination with other strategies, seasonality is a tool for your trading that should not be underestimated.
We have packed this script with everything you need for a meaningful seasonal analysis. Define entry and exit times according to day of the week, day of the month and the month itself, very easily via the settings window. Determine the period to be evaluated and, if desired, add a stop loss and / or a take profit to add a healthy risk and money management to your strategy. Since this is a pine strategy script, the usual trading view strategy parameters such as account size, commission, slippage, etc. are also available and you can set up your backtest even more realistically and therefore more truthfully.
Would you like to evaluate the behavior of a certain share over the turn of the year, would you like to find out which day of the week in gold has been the most profitable over the past 50 years or just check the "Sell in May" effect? This is exactly what we created this script for. With just a few clicks you can evaluate approaches such as the "Sell in May" effect or the "Santa Claus Rally", you can check which day of the week, which day of the month or which month is the strongest in an instrument and develop individual strategy systems from this.
█ FEATURES
The script input window has the following setting options:
• Backtest start / Backtest end: Set your Backtast Range here.
• Trade direction: Decide whether your strategy should open buy or sell positions.
• Pyramiding Indicates how many positions can be open at the same time (maximum 10 positions)
• Stop Loss / Take Profit: In order to optimize your strategy, you have the option of adding profit and loss levels (visible in the chart) to your open positions.
This enables you to adapt your trading system to your risk and money management. The stop and take profit levels are freely selectable.
• Entrys / Exits: Divided into days of the week, days of month and months itself, you can individually choose when you want to open and close a position.
• Advanced Filter: Seasonally, the 4-year election cycle of the US presidential election has a strong impact on the markets.
In order to be able to develop analyzes in connection with this cycle, there is an advanced filter to be able to filter the different election years.
█ HOW TO USE
After the script has been added to the chart, the input window opens immediately and you can easily select your strategy parameters. After confirming your selection, all trades will be added to the chart and you will find the key metrics for your system in the Tradingview Strategy Tester. If you have added a stop or profit level, you can also see this graphically in the chart and thus analyze every trade in the chart very precisely.
The entry and exit fields can be selected individually to be activated. If no selection is made, e.g. no selection for the weekday entry, then there is no longer any filtering and entry / exit is possible on any weekday. As soon as a selection is made under the entry / exit parameters, the system filters according to the criteria made during the selection. A position is always opened / closed at the closing price (close) of the candle, at which all selected criteria match.
█ LIMITATIONS
This script is just a tool for your trading. You dont receive any finished trading strategy or backtest, but a program with which you can create and optimize your own seasonal trading strategies without any programming knowledge.
This script was developed for seasonal back tests over a long history and therefore works best in a time resolution greater than or equal to the daily chart (1D).
█ IMPORTANT
The strategy results shown here were made with the default script settings in the SPX symbol. In order to test the pure seasonality, no slippage and commission are included in the default inputs. By default, 100% of the capital is used to open a position. These settings allow a quick check of seasonality without the distortion from commissions, slippage or margin calls, but to get a real strategy you need to add these things later. If you have identified a seasonal phase and want to build a trading strategy from it, you have to add realistic commission and slippage and adjust the positionsize. The backtesting results shown here are chosen randomly and are not a real strategy. The strategy key metrics are therefore not relevant and the chart is only used to illustrate the script design
Use the link below to get more information
═════════════════════════════════════════════════════════════════════════
█ ÜBERSICHT
Mit der BASE kannst Du schnell und unkompliziert saisonale Handelsstrategien erstellen, testen oder optimieren. Die Saisonalität ist ein starker, wenn nicht sogar der stärkste Handelsansatz, um langfristig Geld an den Kapitalmärkten zu verdienen. Ob nun einzeln oder in Kombination mit anderen Strategien, die Saisonalität ist ein nicht zu unterschätzendes Hilfsmittel für deinen Handel.
Dieses Skript haben wir mit allem vollgepackt was du für eine aussagekräftige saisonale Auswertung benötigst. Definiere Ein- und Ausstiegszeitpunkte nach Wochentag, Tag des Monats und dem Monat selbst, ganz einfach über das Einstellungsfenster. Bestimme den auszuwertenden Zeitraum und ergänze wenn gewünscht einen Stop Loss und/oder einen Take Profit um deiner Strategie ein gesundes Risiko- und Moneymanagement hinzuzufügen. Da es sich hierbei um ein Pine-Strategieskript handelt stehen Dir die üblichen Tradingview Strategieparameter wie Kontogröße, Kommission, Slippage usw. ebenfalls zur Verfügung und Du kannst deinen Backtest noch realistischer und damit auch wahrheitsgemäßer aufstellen.
Du möchtest das Verhalten einer bestimmten Aktie über den Jahreswechsel auswerten, möchtest herausfinden welcher Wochentag in Gold über die letzten 50 Jahre der profitabelste war oder einfach mal eben den "Sell in May" Ansatz überprüfen? Genau hierfür haben wir dieses Skript erstellt. Mit wenigen Klicks kannst Du Ansätze wie den "Sell in May" Effekt oder die "Santa Claus Rally" auswerten, kannst prüfen welcher Wochentag, welcher Tag des Monats oder welcher Monat der stärkste in einem Instrument ist und daraus ganz individuelle Strategie-Systeme entwickeln.
█ EIGENSCHAFTEN
Das Eingabefenster des Skripts hat folgende Einstellungsmöglichkeiten:
• Backtest start / Backtest end: Hier legst Du fest für welchen Zeitraum dein Backtest erstellt werden soll.
• Trade direction: In diesem Feld wird bestimmt ob die Positionen in Long- oder Short-Richtung eröffnet werden sollen.
• Pyramiding Gibt an wie viele Positionen zu selben Zeit offen stehen können (maximal 10 Positionen möglich)
• Stop Loss / Take Profit: Um deine Strategie optimieren zu können hast Du die Möglichkeit Gewinn- und Verlustlevel (sichtbar im Chart) zu deinen offenen Positionen hinzuzufügen.
Dadurch ist es Dir möglich dein Handelssystem an dein Risiko- und Moneymanagement anzupassen. Die Stop Loss und Take Profit Level sind frei wählbar.
• Entrys / Exits: Unterteilt in Wochentage, Kalendertage und Monate kannst Du hier ganz individuell auswählen zu welchem Zeitpunkt Du eine Position eröffnen und schließen möchtest.
• Advanced Filter: Saisonal betrachtet beeinflusst der 4-jährige Wahlzyklus der US-Präsidentschaftswahlen die Märkte stark.
Um Analysen im Zusammenhang mit diesem Zyklus entwickeln zu können gibt es hierfür einen erweiterten Filter um die verschiedenen Wahljahre filtern zu können.
█ ANWENDUNG
Nachdem das Skript auf den Chart aufgerufen wurde öffnet sich sofort das Eingabefenster in welchem Du deine Strategieparameter auswählen kannst. Nach dem Bestätigen der Auswahl kannst du sofort deine Trades auf dem Chart erkennen und hast über den Tradingview Strategie-Tester die Auswertung zu deinem System vorliegen. Wenn du ein Stop Loss oder Take Profit Level hinzugefügt hast kannst Du auch dieses grafisch auf dem Chart erkennen und so jeden Trade im Chart ganz genau analysieren.
Die Entry und Exit Felder können einzeln angewählt und somit aktiviert werden. Ist in einer Reihe wie beispielsweise den Wochentagen keiner der Tage ausgewählt so wird nicht mehr nach den Wochentagen gefiltert und ein Einstieg/ Ausstieg ist zu jedem Wochentag möglich. Sobald unter den Entry/ Exit Parametern eine Auswahl getroffen wird filtert das System nach den in der Auswahl getroffenen Kriterien. Es wird immer zum Schlusskurs (Close) der Kerze eingestiegen bei der alle ausgewählten Kriterien übereinstimmen.
█ EINSCHRÄNKUNGEN
Dieses Skript stellt ausschließlich ein Hilfsmittel für deinen Handel dar. Du erhältst keine fertigen Handelsstrategien oder Backtests sondern ein Tool mit welchem Du ohne Programmierkenntnisse in der Lage bist eigene saisonale Handelsstrategien zu erstellen und zu optimieren.
Das Skript wurde für saisonale Backtests über eine lange Historie entwickelt und arbeitet daher am besten in den Zeitfenstern größer oder gleich dem Tageschart (1D).
█ WICHTIG
Die hier gezeigten Strategieergebnisse wurden mit den Standard-Skripteinstellungen im SPX-Symbol erstellt. Um die reine Saisonalität zu testen, sind in den Standardeingaben keine Slippage und Provision enthalten. Standardmäßig wird 100% des Kapitals verwendet, um eine Position zu eröffnen. Diese Einstellungen ermöglichen eine schnelle Prüfung der Saisonalität ohne Verzerrungen durch Provisionen, Slippage oder Margin Calls. Um eine handelbare Strategie zu erhalten müssen die Angaben zu Slippage, Kommission und Positionsgröße aber später unbedingt ergänzt werden. Die hier gezeigten Backtesting-Ergebnisse wurden zufällig ausgewählt und sind keine echte Strategie. Die Strategiekennzahlen sind daher nicht relevant und das Chartbild dient nur zur Veranschaulichung des Skriptdesigns
Verwende den untenstehenden Link für mehr Informationen
Three moving average strategies
If the short term (Default 7) moving average cuts the medium term (default 25) moving average, BUY. Conversely, it generates the SELL signal. If the long term (Default 99) moving average cuts its short term moving average, Quick SELL. Conversely, it can be interpreted as Fast SELL. You can change the moving average and the number of days as you wish, and you can trade in the short or long term. I hope it was useful.
#JJ_Shares Trend Follower
-----------------
Hey there!
There are many reasons why this strategy has worked quite well over the past few years.
A very simple strategy in itself. The basis of this indicator is the trend following approach. "The trend is your friend." This strategy is based on individual separate indicators. A total of three EMA's (10.50 & 200) & the ATR are combined. The largest EMA shows the basic trend direction and thus also the preferred trade direction. The two smaller EMAs are used for the timing of the entrances at the intersection. The stop levels are placed with the help of the ATR and the large EMA. Profit areas are determined using a risk calculation.
Exact entry points can be identified using the indicator. In addition, a take profit is visualized based on a 3:1 CRV . The stop loss results from a long-term EMA .
Example for NASDAQ:GOOGL ! But can be used for all other trend following stocks!
The indicator can be used on all timeframes. However, the performance is significantly better in higher timeframes. In addition, the display can be adjusted using the options.
That's all. Due to the technical chart background, the strategy can be used without further chart analysis.
Attention: Before opening a position, always first check whether there is any strong news. In these cases it is better to be on the safe side.
Attention: With this strategy a SL is provided as standard. However, the risk must always be carefully calculated.
Past results do not guarantee future profits!
Use the link below to get access to this indicator or PM us to get access.
--------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------
-----------------
Willkommen!
Es gibt viele Gründe, warum sich diese Strategie in den letzten Jahren ganz gut bewährt hat.
Eine sehr einfache Strategie für sich. Grundlage dieses Indikators ist der Trendfolgeansatz. "The trend is your friend." Diese Strategie basiert auf einzelnen seperaten Indikatoren. Insgesamt werden drei EMA's (10,50 & 200) & die ATR kombiniert. Der größte EMA zeigt die grundsätzliche Trendrichtung und somit auch die bevorzugte Traderichtung. Die beiden kleineren EMA werden bei Kreuzung für das Timing der Einstiege verwendet. Mit Hilfe der ATR und des großen EMA werden die Stop Level platziert. Gewinnzonen werden über eine Risikoberechnung ermittelt.
Anhand des Indikators können genaue Einstiege erkannt werden. Zusätzlich wird aufgrund eines 3:1 CRV ein Take Profit visualisiert. Der Stop Loss ergibt sich über einen langfristigen EMA .
Beispiel für NASDAQ:GOOGL ! Kann aber für alle weiteren Trendfolge Aktien verwendet werden!
Der Indikator kann auf allen Timeframes angewendet werden. Allerdings ist der Performance in höheren Timeframes deutlich besser. Zusätzlich kann die Anzeige über die Optionen angepasst werden.
Das ist alles. Aufgrund des charttechnischen Hintergrunds kann die Strategie ohne weitere Chartanalyse verwendet werden.
Achtung: Vor dem Öffnen einer Position immer zuerst prüfen ob starke News anstehen. In diesen Fällen lieber auf Nummer sicher gehen.
Achtung: Bei dieser Strategie ist standardmäßig ein SL vorgesehen. Das Risiko muss aber immer gut kalkuliert werden.
Vergangene Ergebnisse garantieren keine zukünftigen Gewinne!
Verwenden Sie den folgenden Link, um Zugriff auf diesen Indikator zu erhalten oder schreibe uns eine PM um Zugriff zu erhalten.
Ultimate Strategy TemplateHello Traders
As most of you know, I'm a member of the PineCoders community and I sometimes take freelance pine coding jobs for TradingView users.
Off the top of my head, users often want to:
- convert an indicator into a strategy, so as to get the backtesting statistics from TradingView
- add alerts to their indicator/strategy
- develop a generic strategy template which can be plugged into (almost) any indicator
My gift for the community today is my Ultimate Strategy Template
Step 1: Create your connector
Adapt your indicator with only 2 lines of code and then connect it to this strategy template.
For doing so:
1) Find in your indicator where are the conditions printing the long/buy and short/sell signals.
2) Create an additional plot as below
I'm giving an example with a Two moving averages cross.
Please replicate the same methodology for your indicator wether it's a MACD, ZigZag, Pivots, higher-highs, lower-lows or whatever indicator with clear buy and sell conditions
//@version=4
study(title='Moving Average Cross', shorttitle='Moving Average Cross', overlay=true, precision=6, max_labels_count=500, max_lines_count=500)
type_ma1 = input(title="MA1 type", defval="SMA", options= )
length_ma1 = input(10, title = " MA1 length", type=input.integer)
type_ma2 = input(title="MA2 type", defval="SMA", options= )
length_ma2 = input(100, title = " MA2 length", type=input.integer)
// MA
f_ma(smoothing, src, length) =>
iff(smoothing == "RMA", rma(src, length),
iff(smoothing == "SMA", sma(src, length),
iff(smoothing == "EMA", ema(src, length), src)))
MA1 = f_ma(type_ma1, close, length_ma1)
MA2 = f_ma(type_ma2, close, length_ma2)
// buy and sell conditions
buy = crossover(MA1, MA2)
sell = crossunder(MA1, MA2)
plot(MA1, color=color_ma1, title="Plot MA1", linewidth=3)
plot(MA2, color=color_ma2, title="Plot MA2", linewidth=3)
plotshape(buy, title='LONG SIGNAL', style=shape.circle, location=location.belowbar, color=color_ma1, size=size.normal)
plotshape(sell, title='SHORT SIGNAL', style=shape.circle, location=location.abovebar, color=color_ma2, size=size.normal)
/////////////////////////// SIGNAL FOR STRATEGY /////////////////////////
Signal = buy ? 1 : sell ? -1 : 0
plot(Signal, title="🔌Connector🔌", transp=100)
Basically, I identified my buy, sell conditions in the code and added this at the bottom of my indicator code
Signal = buy ? 1 : sell ? -1 : 0
plot(Signal, title="🔌Connector🔌", transp=100)
Important Notes
🔥 The Strategy Template expects the value to be exactly 1 for the bullish signal , and -1 for the bearish signal
Now you can connect your indicator to the Strategy Template using the method below or that one
Step 2: Connect the connector
1) Add your updated indicator to a TradingView chart
2) Add the Strategy Template as well to the SAME chart
3) Open the Strategy Template settings and in the Data Source field select your 🔌Connector🔌 (which comes from your indicator)
From then, you should start seeing the signals and plenty of other stuff on your chart
🔥 Note that whenever you'll update your indicator values, the strategy statistics and visual on your chart will update in real-time
Settings
- Color Candles : Color the candles based on the trade state (bullish, bearish, neutral)
- Close positions at market at the end of each session : useful for everything but cryptocurrencies
- Session time ranges : Take the signals from a starting time to an ending time
- Close Direction : Choose to close only the longs, shorts, or both
- Date Filter : Take the signals from a starting date to an ending date
- Set the maximum losing streak length with an input
- Set the maximum winning streak length with an input
- Set the maximum consecutive days with a loss
- Set the maximum drawdown (in % of strategy equity)
- Set the maximum intraday loss in percentage
- Limit the number of trades per day
- Limit the number of trades per week
- Stop-loss: None or Percentage or Trailing Stop Percentage or ATR
- Take-Profit: None or Percentage or ATR
- Risk-Reward based on ATR multiple for the Stop-Loss and Take-Profit
This script is open-source so feel free to use it, and optimize it as you want
Alerts
Maybe you didn't know it but alerts are available on strategy scripts.
I added them in this template - that's cool because:
- if you don't know how to code, now you can connect your indicator and get alerts
- you have now a cool template showing you how to create alerts for strategy scripts
Source: www.tradingview.com
I hope you'll like it, use it, optimize it and most importantly....make some optimizations to your indicators thanks to this Strategy template
Special Thanks
Special thanks to @JosKodify as I borrowed a few risk management snippets from his website: kodify.net
Additional features
I thought of plenty of extra filters that I'll add later on this week on this strategy template
Best
Dave
Triple SMA Strategy with entries based on sma price closesHi! :)
This strategy is made for intraday trades, especially on 5 sec - 5 min charts to follow the trend.
I have not tested on higher timeframes, but feel free to play with the values.
I have set a basic value for the 3 SMA at
-200
-400
-600
We will use an oscillator for entries which is not mine. Link ->
The oscillator mentioned above is just for visualization purposes, You do not need to get the signals, but You can see how scripts are generated with different values.
When the price above/below all the 3 SMA and oscillator crosses above/below "value you set" - You will get the buy or sell signal.
Your stop will be where the slowest SMA is.
Pyramiding is set for 10.
You can manually set 3 take profit and quantity levels.
Basic values are 1 %, 2 %, and 6 % for taking profits - You can change it based on how volatile the asset is.
Basic quantity values are 30 % at each level.
Hope You find it useful :)
Self-Optimising MACD (Experimental)Hi guys, just thought I'd share a small part of an idea i've been working on.
One of the biggest problems with algo trading is optimisation and finding a way to constantly adapt to the market conditions as time unfolds.
First of all... You should NEVER EVER trade just using a MACD, including this study, and I only produced this script in a small amount of time, so make sure you backtest it properly before using it. When backtesting, it is my advice that your sample size should be at least 5000 trades, but I recommend 10000 in order to get sufficient statistical significance.
Also, I am not a financial advisor, and any trading based decisions are your sole responsibility.
Anyways...
This script is simple... it simply uses 4 different MACD's and tracks their profit/loss and automatically uses the one with the most historical profit at any given time to execute a trade. The type of MACD will obviously change as market states fluctuate.
Included are : Hull MACD, Ema MACD, Sma MACD and VWMA Macd.
You can adjust all four of their settings to your desire.
The trade execution is simple and definitely flawed... it simply tracks the MACD when it has a crossover for long, and then the opposite for short.
The green line represents the performance of the top MACD for Longs at any given time. This line refreshes once a year, and where it is in relation to price, reflects how profitable it has been I.e - the higher it is the better.
The Red line represents the performance on the Short side, and again, it reflects profit/loss, but this time the LOWER the line is in relation to price the better.
There is no exit strategy in place! This is why I do NOT recommend trading off this script alone, but to use it as a tool to help optimise your choice of MACD.
However, your exit strategy could change your optimal choice of MACD, so keep that in mind.
The lookback period represents how far the script will track the performance at any given time. This will change your results. The longer the period, the more it will show long term success and vice versa.
This optimisation process could be done with different indicators, moving averages, or even multiple strategies to find the most statistically viable option at any given time... if you wish to have this process coded into your strategies or indicators, message me.
Enjoy.
[fareid] Quick Backtest Framework█ OVERVIEW
This Framework allows Pine Coders to quickly code Study() based signal/strategy and validate its viability before proceed to code with more advance/complex customized rules for entry, exit, trailstop, risk management etc..
This is somewhat an upgraded version of my earlier personal template with different strategy used, cleaner code
and additional features.
█ USE CASES
- You have an idea for trade signal and need a quick way to verify its potential before writing lengthy/complicated code
- You found a study script for trading signal in public library and want to validate it profitability with minimum effort before including it in your trading playbook
█ FEATURES
- Alert: Ready to use alert function based on signals from your custom indicator.
- Visual Backtest: Auto-plot entry, stop-loss and take profit for simple strategy performance analysis
- Backtest Statistic: Provide basic key metrics based on backtest strategy
- BTE External Signal Protocol: Ready to use code that will supply required state to PineCoders Backtesting & Trading Engine if you wish to have more advance and sophisticated backtesting engine
Notes: All of the above features have On/Off toggle
█ Description & How To Use
This Framework consist of 5 Modules but you only need to edit the first 2 Modules:
Module1: Indicator
Module2: Framework Input Protocol
Module3: Alert
Module4: Backtest
Module5: Backtest & Trading Engine
Tips: The source-code includes collapsible block by module for easy navigating
Module1: Indicator:
-----------------------------------------------------------------------------------
Main Module. Place custom indicator input parameter/calculation/indicator plotting here
Sample Strategy: Double MACD Crossover
MACD Signal: 1st MACD Cross above signal line indicate Buy Signal
1st MACD Cross below signal line indicate Sell Signal
MACD Filter: 2nd MACD is above 0 line indicate Uptrend
2nd MACD is below 0 line indicate Downtrend
Module2: Framework Input Protocol:
-----------------------------------------------------------------------------------
Use this module to connect main indicator/signal calculated in Module1 to the rest of the framework's module
4 variables needed to be defined here:
1. Uptrend
2. Dntrend
3. BuySignal
4. SellSignal
i'm not sure how to place a code snippet here to show you example so in the source code i already put a comment in Module2 on which part u need to edit. I hope its pretty simple to use.
Module3: Alert Module Description:
-----------------------------------------------------------------------------------
As long as the variables in Module2 properly defined, the alert module is ready to use without any further modification.
Input:
Enable Alert --> Enable TV's alert and plot signal to chart
Alert Type --> Set to take Buy only, Sell only or Both alert
Module4: Backtest Module Description:
-----------------------------------------------------------------------------------
As long as the variables in Module2 properly defined, the backtest module is ready to use without any further modification.
Input:
Backtest Stat --> Enable Backtest Statistic Label
Backtest Visual --> Enable Backtest visual simulation
Backtest Type --> Set to take Buy only or Sell only or both
SL Type -->
ATR : Set SL in ATR times Multiplier below entry price
Fixed : Set SL in fixed point below entry point (in 'Dollar'). e.g. for Stocks -> 0.5 equals to 50cent while for EURUSD currency -> 0.005 equal to 50 pips
HiLo Bar: Set SL at highest/lowest wick of previous bar plus/minus Fixed point. e.g. EURUSD HiLo=3 and Fixed Point = 0.0005, buy trade will place SL 5 Pips below lowest of previous 3 bar
SL ATR Multi --> Set Lookback Period used for SL's ATR calculation
SL ATR Multi --> Set ATR Multiplier for SL
SL Fixed --> Set Fixed Level for SL
SL Bar --> Set Number of previous bar to check for SL placement
TP RR Ratio --> Set TP based on RR multiplier. e.g. 2 means TP level will be twice further from entry point compared to Entry-SL distance.
Notes: The point is for preliminary testing, so it only supports 1 trade at a time and no Trailing Stop
Module5: Backtest & Trading Engine Description:
-----------------------------------------------------------------------------------
As long as the variables in Module2 properly defined, the Pinecoders BTE module is ready to use without any further modification.
Input:
External Signal Protocol --> Set ESP State to send to "Backtesting & Trading Engine "
Signal With Filter --> Use this to send entry signal that already filtered by this study indicator (without stoploss level)
Signal Without Filter --> Use this to send raw entry signal that are NOT YET FILTERED by this study indicator (without stoploss level)
Signal and Stop With Filter --> Use this to send entry signal WITH StopLoss that already filtered by this study indicator (with stoploss level)
Signal and Stop Without Filter --> Use this to send raw entry signal WITH StopLoss that are NOT YET FILTERED by this study indicator (with stoploss level)
Notes: Backtesting & Trading Engine already have built-in Filter, Entries and Stop Level. e.g. Unselect all their filter state if only want to use custom filter and make sure send Signal with Filter (with or without SL level)
█ DISCLAIMER:
This framework main objective is to create my personal indicator template so that i just have to modify the indicator module for preliminary testing in future.
The sample strategy included are for educational purpose only. Use at your own risk
credit: LucF/PineCoders for a lot of his scripts that i use as a guide to complete this
Multi MA MTF SandBox StrategyA moving averages SandBox strategy where you can experiment using two different moving averages (like KAMA, ALMA, HMA, JMA, VAMA and more) on different time frames to generate BUY and SELL signals, when they cross.
Great sandbox for experimenting with different moving averages and different time frames.
== How to use ==
We select two types of moving averages on two different time frames (or the same time frame):
First is the FAST moving average that should be at the same time frame or higher.
Second is the SLOW moving average that should be on the same time frame or higher.
== Buy and Sell Signals ==
When FAST moving average cross over the SLOW moving average we have a BUY signal (for LONG)
When FAST moving average cross under the SLOW moving average we have a SELL signal (for SHORT)
WARNING: Using a lower time frame than your chart time frame will result in unrealistic results in your backtesting and bar replay.
== NOTES ==
You can select BOTH, LONG, SHORT or NONE in the strategy settings.
You can also enable Stop Loss and Take Profit.
More sandboxes to come, Follow to get notified.
Like if you like and Enjoy!
Can also act as indicator by setting 'What trades should be taken' to 'NONE':
Parabolic SAR Swing strategy GBP JPY Daily timeframeToday I bring you a new strategy thats made of parabolic sar. It has optmized values for GBPJPY Daily timeframe chart.
It also has a time period selection, in order to see how it behave between selected years.
The strategy behind it is simple :
We have an uptrend , (the psar is below our candles) we go long. We exit when our candle crosses the psar value.
The same applies for downtrend(the psar is above our candles), where we go short. We exit when our candle cross the psar value.
Among the basic indicators, it looks like PSAR is one of the best canditates for swing trading.
If you have any questions, please let me know.
Inferential Statistics And Quick Metrics For Strategy Analysis.Part of this script is used to calculate inferential statistics and metrics not available through the built in variables in the strategy tester.
A label will be created on the last bar displaying important strategy results, so you can test and analyze strategies quicker.
The built in strategy itself is just an example. You can copy and paste the metrics into any existing version 4 strategy and instantly use it**
**Just be sure all the variable names are unique in your target script.
I am looking for critique and would appreciate input on the statistical functions. I am aware that some of these functions are based on the assumption that the data is normally distributed. It's not meant to be perfect, but it is meant to be helpful. So if you think I can add or improve something to make it more helpful, let me know.
BNB Burn BuyerThis strategy is only meant to be used on BNB.
It's more of an inconclusive analysis of the effect of BNB's quarterly coin burn.
To date there have been 13 coin burns.
According to Binance's whitepaper, each quarter, they will burn BNB based on their trading volume until 50% of all BNB is burned. They eventually will destroy 100MM BNB, leaving 100MM BNB remaining.
Historically, coin burns for the 3rd quarter happen around October 17th-18th. So keep an eye out for those dates.
I built this strategy to run some experiments and test the fundamental effect a known coin burn has on the price. So far more testing is needed. So leave your insights and comments below!
RSI on VWAP Upgraded strategyFirst of all, the idea of apply RSI to VWAP was inspired by XaviZ; at least, that where I first saw that.
I simply applied the idea and searched for apply this on lower timeframe (M15) to increase the number of positions and improve the profit factor.
The conditions to enter are the same :
long : enter on RSI crossover oversold level
short : enter on RSI crossunder oversell level
To close position, I found a little change to apply :
long : close position when RSI(VWAP) went in overbought zone and crossunder the overbought level OR after being at least x bars in the overbought zone (parameter is 28 by default) => when the first condition happens
short : close position when RSI(VWAP) went in oversold zone and crossover the oversold level OR after being at least x bars in the oversell zone (parameter is 28 by default) => when the first condition happens
With this change, I got better results specially on BTCUSDTPERP (M15) where I reach a 6.8 profit factor with 119 trades closed. Not BAD !
The defaults parameters are the best found for BTCUSDTPERP (M15), but the strategy works fine for other pairs if you take time to find the rights combinations.
In this strategy you can change (with defaults in () ):
RSI length (28)
RSI overbought level (85)
RSI oversell level (30)
Number of bars before leaving as explain above (28)
The choice to take longs only, shorts only or both
The number of coin/token by position
The start date for backtesting
Please note that the script use a pyramiding parameter of 3 (can be changed in the first line of the script); that means that you can take up to 3 positions before closing. It lets you improve average enter price but increase the risk. 3 is the best I found to improve profit factor without expose myself too much.
This script would be better if automated because of the conditions of buy and sell.
It's only for educative purpose, not an advice to invest.
All my free scripts here : fr.tradingview.com
Leave a message and don't forget to follow me ;) !
The MATRIX: Ultimate Crypto Position Strategy (Alert Version)Welcome back everyone,
It's been a while since our last post. In recent months we have worked on all kinds of projects, but more on that later. In the meantime, we also received a lot of positive feedback about our original 'The MATRIX: Ultimate Crypto Position Strategy' script.
One of the many requests was whether we could release an alert version.
However, since Pinescript does not provide the alert functionality in a strategy type script, it had to be converted to a study type script. Besides that, we have also added a stop-loss functionality. This release has the same internal algorithm as the original 'The MATRIX: Ultimate Crypto Position Strategy' script. But instead of showing back test results, this script provides the functionality to add alerts that can notify the user via email / pop-up / sms / app once a signal is given! You must manually add these alerts via TradingView. If you need help setting up these alerts, feel free to ask in the comment box or send us a dm.
***The script is invite-only, message us to get script access***
-------------------------------------------------------------------------------------------------
The MATRIX: Ultimate Crypto Position Strategy should be used as follows:
• The trading strategy was designed and optimized for trading cryptocurrencies only ; furthermore it works best on established high market cap cryptocurrencies that have a clear trend such as:
BTCUSD
ETHUSD
LTCUSD
XRMUSD
EOSUSD
ADAUSD
DASHUSD
ETCUSD
• The trading strategy is based on swing/position methodology. The script must therefore be used on daily timeframe candles only (1D).
• Use USD trading pairs only (e.g. use ETHUSD instead of the ETHBTC) since the individual trend is captured more effectively and therefore gives better results.
-------------------------------------------------------------------------------------------------
The MATRIX:Ultimate Crypto Position Strategy is based on the following indicators:
• Ichimoku Cloud ; acts as the leading indicator.
• Volume ; without strong volume , a market move is not valid.
• MACD and Vortex ; both being used as confirmation indicators.
• Choppiness index ; avoids trading in choppy markets.
• Bullish/ Bearish Regular Divergences in combination with RSI to spot tops and bottoms.
• Simple and Exponential Moving Averages ; prêvents trading against the trend.
The trading strategy is easy to use, trend based and without repainting, meaning once a signal has been made it is permanent and that no future data is used in the decision making. It detects the trend and filters out market noise based on more than 10 technical indicators. ONLY when all indicators align with each other the algorithm prints a BUY or SELL signal. The trading strategy provides high probability trading signals and minimizes risk! This script aims to capture the profit from longer term trending moves and by doing so filters out non-substantial trends and avoids the associated risks with these trades.
-------------------------------------------------------------------------------------------------
The MATRIX: Ultimate Crypto Position Strategy has the following features:
• ALERTS can be enabled which can notify the user through email/popup/app once a signal is given.
• Automatically generated Buy / Sell alerts in the form of a label.
• NO Repaint once candle is closed.
• SAFEGUARD ; custom built-in security prevẹnts trading when the price is out of equilibrium.
• Customizable Display for the Ichimoku cloud indicator display.
-------------------------------------------------------------------------------------------------
Reminder: Use this trading strategy at your own risk and trade responsibly. We are not responsible for any financial loss using this strategy.
***The script is invite-only, message us to get script access***
Lagged Donchian Channel + EMAThis strategy is based on a lagged 24 periods Donchian Channel and a 200 periods EMA .
The enter positions are calculated this way :
Bull entry
1. we wait for the close of a candle below the channel and it must be below the 200 EMA
2. the following candle must be a green one and close in the lagged channel
3. we put a long order at the close of the second candle, a stop loss at the low of last 3 candles and a x3 take profit
Bear entry
1. we wait for the close of a candle above the channel and it must be above the 200 EMA
2. the following candle must be a red one and close in the lagged channel
3. we put a short order at the close of the second candle, a stop loss at the high of last 3 candles and a x3 take profit
For both long or short positions :
If the order is not filled, it's cancelled if the price reach 50% of the TP or if the price reach the stop loss level
The position is closed if a new bear/bull condition appears in the other side of the position (if a bear appears when you're long and inversement)
Features :
Position calculator's included with leverage option
Labels of position can be plotted or not
Bull/Bear channels can be plotted with red and green filled
All parameters can be changed for backtesting
Better results have been got with defaults parameters on LTCUSDTPERP in H1 timeframe => profit factor of 2.84 with almost 100 positions.
Hope this strategy will be useful and it would be cool if I could get feedback, comments or better combinations of parameters !!
Don't hesitate to like and leave a comment ;)
@Mysteriown
STRATEGY TESTER ENGINE - ON CHART DISPLAY - PLUG & PLAYSo i had this idea while ago when @alexgrover published a script and dropped a nugget in between which replicates the result of strategy tester on chart as an indicator.
So it seemed fair to use one of his strategy to display the results.
This strategy tester can now be used in replay mode like an indicator and you can see what happen at a particular section of the chart which was is not possible in default strategy tester results of TV.
Please read how each result is calculated so you will know what you are using.
This engine shows most common results of strategy tester in a single screen, which are as follows:
1. Starting Capital
2. Current Profit Percentage
3. Max Profit Percentage
4. Gross Profit
5. Gross Loss
6. Total Closed Trades
7. Total Trades Won
8. Total Trades Lost
9. Percentage Profitable
10. Profit Factor
11. Current Drawdown
12. Max Drawdown
13. Liquidation
So elaborating on what is what:
1. Starting Capital - This stays 0, which signifies your starting balance as 0%. It is set to 0 so we can compare all other results without any change in variables. If set to 100, then all the results will be increased by 100. Some users might find it useful to set it to 100, then they can change code on line 41 from to and it should show starting balance as 100%.
2. Current Profit Percentage - This shows your current profit adjusted to current price of the candle, not like TV which shows after candle is close. There is a comment on the line 38 which can be removed and your can see unrealized profit as well in this section. Please note that this will affect Draw-down calculations later in this section.
3. Max Profit Percentage - This will show you your max profit achieved during your strategy run, which was not possible yet to see via strategy tester. So, now you can see how much profit was achieved by your strategy during the run and you can compare it with chart to see what happens during bull-run or bear-run, so you can further optimize your strategy to best suit your desired results.
4. Gross Profit - This is total percentage of profit your strategy achieved during entire run as if you never had any losses.
5. Gross Loss - This is total percentage of loss your strategy achieved during entire run as if you never had any profits.
6. Total Closed Trades - This is total number of trades that your strategy has executed so far.
7. Total Trades Won - This is the total number of trades that your strategy has executed that resulted in positive increase in equity.
8. Totals Trades Lost - This is the total number of trades that your strategy has executed that resulted in decrease in equity.
9. Percentage Profitable - This is the ratio between your current total winning trades divided by total closed trades, and finally multiplied by 100 to get percentage results.
10. Profit Factor - This is the ratio between Gross Profit and Gross Loss, so if profit factor is 2, then it indicates that you are set to gain 2 times per your risk per trade on average when total trades are executed.
11. Current Drawdown - This is important section and i want you to read this carefully. Here draw-down is calculated very differently than what TV shows. TV has access to candle data and calculates draw-down accordingly as per number of trades closed, but here DD is calculated as difference between max profit achieved and current profit. This way you can see how much percentage you are down from max peak of equity at current point in time. You can do back-test of the data and see when peak was achieved and how much your strategy did a draw-down candle by candle.
12. Max Drawdown - This is also calculated differently same as above, current draw-down. Here you can see how much max DD your strategy did from a peak profit of equity. This is not set as max profit percentage is set because you will see single number on display, while idea is to keep it custom. I will explain.
So lets say, your max DD on TV is 30%. Here this is of no use to see Max DD , as some people might want to see what was there max DD 1000 candles back or 10 candle back. So this will show you your max DD from the data you select. TV shows 25000 candle data in a chart if you go back, you can set the counter to 24999 and it will show you max DD as shown on TV, but if you want custom section to show max DD , it is now possible which was not possible before.
Also, now let's say you put DD as 24999 and open a chart of an asset that was listed 1 week ago, now on 1H chart max DD will never show up until you reach 24999 candle in data history, but with this you can now enter a manual number and see the data.
13. Liquidation - This is an interesting feature, so now when your equity balance is less than 0 and your draw-down goes to -100, it will show you where and at what point in time you got liquidated by adding a red background color in the entire section. This is the most fun part of this script, while you can only see max DD on TV.
------------------------------------------------------------------------------
How to Use -
1 word, plug and play. Yes. Actual codes start from line 33.
select overlay=false or remove it from the title in your strategy on first line,
Just copy the codes from line 33 to 103,
then go to end section of your strategy and paste the entire code from line 33 to line 103,
see if you have any duplicate variable, edit it,
Add to chart.
What you see above is very contracted view. Here is how it looks when zoomed in.
imgur.com
----------------------------------------------------------------------------------
Feel free to edit and share and use. If you use it in your scripts, drop me tag. Cheers.
365 Day High Breakout StrategySCRIPT NOTES
- Strategy consists of 3 parameters :-
1. BUY on 365 day breakout (250 days taken in back-testing instead of 365 days considering weekends and other holidays in a year)
2. Moving averages (Noise Filtering condition )
3. RELATIVE STRENTH indicator (Original Author - tradingview.com ) (Noise Filtering condition )
- Strategy works better on low volatile stocks.
- This strategy is for self improvement and concept sharing purpose only.
- Trading (including profit/loss) using this strategy is completely user's responsibility.
DigitalTrendTrade | 0.3The Digital Trend Trade trading strategy is designed for trading both local and global trends, as well as for displaying floating and fixed support levels and identifying price extremes.
The strategy consists of several main elements:
Global Average - On the chart, GA is displayed as the average price line, showing the current local trend direction with its color, as well as edging the bars to the trend color. Generates a signal when the local trend changes.
Global Trend - The second element of the strategy indicator is Global Trend, which forms the key support and resistance levels, when breaking through which the global trend changes and the corresponding signal is formed.
Bill Williams Fractal Levels - And the third element is the Bill Williams Fractal Levels block, which primarily fixes local extremes that can be used for scalping, as well as for setting a take profit and stop loss for a trade.
Support and resistance levels are also formed from local extremes.
To get access to the indicator, contact us via private messages.
PpSignal Algorithmic trading system this strategy uses
1) trend
2) volatility
3) volume
Also, you can find in additional tools, rsi wilders on the chart and its standard deviation.
CFB composite fractal behavior and smoothed atr.
Candle converter MTF.
The strategy uses these four indicators to generate inputs and outputs.
Basically buy when cfb, rsi and atr go in the same direction upwards and the movement is accompanied by a rising volume (cfb green color and rsi Aqua ATR).
Idem in reverse for sell, when cfb, atra and rsi are giving a sell signal (Red color) and the volume is descending.
It is important that you also use other trading systems that you consider convenient. Support and resistance and also fibonacci levels all help to better trading.
Not all assets have or use the same configuration, for this, you must find the appropriate parameters with the variables, long length, short length, source, and period.
for example for btcusd the optimal parameters for me are:
long length = 2
short length = 2
signal length = 2
source = ohlc4
period = 9
It also has a take profit and stops loss tool in percentage.
remember to use parameters according to your tolerance as a trader or investor.
enjoy it
PD: you can write to me privately I have many optimizations and settings already done
este estrategia usa
1) trend
2)volatilidad
3)volumen
Tambien usted podrá encontrar en herramientas adicionales, rsi wilder on the chart y su desviación estándar.
CFB composite fractal behavior y atr suavizado.
Candle converter MTF.
La estrategia usa estos cuatro indicadores para generar entradas y salidas.
Básicamente buy cuándo cfb, rsi y atr van en la misma dirección hacia arriba y el movimiento está acompañado por un volumen ascendente (color verde cfb y rsi Aqua ATR).
Idem a la inversa para el sell, cuando cfb, atra y rsi están dando señal de venta (color Rojo) y el volumen es descendente.
Es importante que también use otros sistemas de trading que usted crea conveniente. Soporte y resistencia y también niveles fibonacci todo ayuda a un mejor trading.
No todos los activos tienen o usan la misma configuración para esto usted deberá encontrar los parámetros adecuado con las variables, long length, short length, source y period.
por ejemplo para btcusd los parámetros óptimos para mi son:
long length = 2
short length = 2
signal length = 2
source = ohlc4
period = 9
También posee una herramienta de take profit y stop lose en porcentaje.
recuerde usar parámetros acorde a su tolerancia como trader o inversor.
disfrutelo