Contrarian Scalping Counter Trend Bb Envelope Adx and StochasticContrarian Scalping is an trading strategy designed to take advanted of a counter-trend.
The advantage of these strrategies types is that they have a good profitability but with do not great gain (in relation at the time frame).
Indicators used:
Bollinger
Envelope
ADX
Stochastic
Rules for entry
For short: close of the price is above upper band from bb and envelope, adx is below 30 and stochastic is above 50
For long: close of the price is below lower band from bb and envelope, adx is below 30 and stochastic is below 50
Rules for exit
For short: either close of the candle is below lower band of bb or enveloper or stochastic is below 50
For long: either close o the candle is above upper band of bb or envelope or stochastic is above 50
If there are any questions let me know !
Oscylator Stochastyczny
[JL] Stochastic Divergence AlertCompare two cross area:
k is increasing, low is lower and previous k is less than bottom level then it is bottom divergence
k is decrease, high is higher and previous k is more than top level then it is top divergence
With long term moving average(400), seems that Stochastic Divergence is more accurate than RSI Divergence on 1m chart.
Stochastic kai ストキャス改Stochastic oscillator is a good indicator in the range market, but in the trend market, the value is saturated and sticks to the upper or lower side, so it is difficult to handle, so I tried to improve it.
I tried to make it difficult to saturate by adding trends. (Although there are limits ...)
I think the usage is the same as Stochastic Oscillator
レンジ相場ではストキャスティクスは良いインジケーターなのですが、トレンド相場では値が飽和して上の方か下の方に貼りついて扱いにくいので改良してみました。
トレンドを加味し飽和しにくくしてみました。(限界はありますが・・・)
使い方はストキャスティクスと同じで良いと思います
Stochastic Spread AnalyzerA comparative version of the previously published Stochastic Structure Analyzer. It incorporates the 3-TF stochastics against both price and OBV values of the spread.
Simple EMA20 Strategy + StochasticThis is a Trend Following Strategy.
The intent of this strategy is to catchthe price as it trends higher than the 20-period EMA and sell immediately after the price closes below it.
I have implemented calculations from Stochastic to make sure the price is coming from an oversold area.
There is also a check to see if the 20-period EMA is trending higher than before.
RSI & Stoch MultiTimeThis indicator renders a table with 2 rows and 7 columns displaying the values of RSI and Stoch over different time periods. This works best on 1m charts due to a bug with the time periods I haven't yet solved.
Data Trader Stoch | RSI | MACD Strategy IndicatorImplementation of Data Trader's strategy, described in the youtube video, "Highly Profitable Stochastic + RSI + MACD Trading Strategy (Proven 100x)"
Also see Algovibes' video, "Highly Profitable Stochastic + RSI + MACD Trading Strategy? Testing Data Traders strategy in Python"
Note: Despite the claims, it generates barely, if any, signals, certainly in the crypto markets
If there are any mistakes, give feedback in the comments, and I'll fix
### Strategy Summary ###
# Long Signals #
Stoch K and D are oversold
RSI above midline
MACD above signal line
# Short Signals #
Stoch K and D are overbought
RSI below midline
MACD below signal line
# Stop loss and Take Profit #
Stop loss
Longs: below last swing low
Shorts: above last swing high
Take profit at 1.5x stop loss
Combo 4+ KDJ STO RSI EMA3 Visual Trend Pine V5@RL! English !
Combo 4+ KDJ STO RSI EMA3 Visual Trend Pine V5 @ RL
Combo 4+ KDJ STO RSI EMA3 Visual Trend Pine V5 @ RL is a visual trend following indicator that groups and combines four trend following indicators. It is compiled in PINE Script Version V5 language.
• STOCH: Stochastic oscillator.
• RSI Divergence: Relative Strength Index Divergence. RSI Divergence is a difference between a fast and a slow RSI.
• KDJ: KDJ Indicator. (trend following indicator).
• EMA Triple: 3 exponential moving averages (Default display).
This indicator is intended to help beginners (and also the more experienced ones) to trade in the right direction of the market trend. It allows you to avoid the mistakes of always trading against the trend.
The calculation codes of the different indicators used are standard public codes used in the usual TradingView coding for these indicators.
The STO indicator calculation script is taken from TradingView's standard STOCH calculation.
The RSI indicator calculation script is a replica of the one created by @Shizaru.
The KDJ indicator calculation script is a replica of the one created by @iamaltcoin.
The Triple EMA indicator calculation script is a replica of the one created by @jwilcharts.
This indicator can be configured to your liking. It can even be used several times on the same graph (multi-instance), with different configurations or display of another indicator among the four that compose it, according to your needs or your tastes.
A single plot, among the 4 indicators that make it up, can be displayed at a time, but either with its own trend or with the trend of the 4 (3 by default) combined indicators (sell=green or buy=red, background color).
Trend indications (potential sell or buy areas) are displayed as a background color (bullish: green or bearish: red) when at least three of the four indicators (3 by default and configurable from 1 to 4) assume that the market is moving in the same direction. These trend indications can be configured and displayed, either only for the signal of the selected indicator and displayed, or for the signals of the four indicators together and combined (logical AND).
You can tune the input, style and visibility settings of each indicator to match your own preferences or habits.
A 'buy stop' or 'sell stop' signal is displayed (layouts) in the form of a colored square (green for 'stop buy' and red for 'stop sell'. These 'stop' signals can be configured and displayed, either only for the indicator chosen, or for the four indicators together and combined (logical OR).
Note that the presence of a Stop Long signal cancels the background color of the Long trend (green).
Likewise, the presence of a Stop Short signal cancels out the background color of the Short trend (red).
It is also made up of 3 labels:
• Trend Label
• signal Stop Label (signals Stop buy or sell )
• Info Label (Names of Long / Short / Stop Long / Stop Short indicators, and / Open / Close / High / Low ).
Each label is configurable (visibility and position on the graph).
• Trend label: indicates the number of indicators suggesting the same trend (Long or Short) as well as a strength index (PWR) of this trend: For example: 3 indicators in Short trend, 1 indicator in Long trend and 1 indicator in neutral trend will give: PWR SHORT = 2/4. (3 Short indicators - 1 Long indicator = 2 Pwr Short). And if PWR = 0 then the display is "Wait and See". It also indicates which current indicator is displayed and the display mode used (combined 1 to 4 indicators or not combined ).
• Signal Stop Label: Indicates a possible stop of the current trend.
• Label Info (Simple or Full) gives trend info for each of the 4 indicators and OHLC info for the chart (in “Full” mode).
It is possible to display this indicator several times on a chart (up to 3 indicators max with the Basic TradingView Plan and more with the paid plans), with different configurations: For example:
• 1-Stochastic - 2/4 Combined Signals - no Label displayed
• 1-RSI - Combined Signals 3/4 - Stop Label only displayed
• 1-KDJ - Combined Signals 4/4 - the 3 Labels displayed
• 1-EMA'3 - Non-combined signals (EMA only) - Trend Label displayed
Some indicators have filters / thresholds that can be configured according to your convenience and experience!
The choice of indicator colors is suitable for a graph with a "dark" theme, which you will probably need to modify for visual comfort, if you are using a "Light" mode or a custom mode.
This script is an indicator that you can run on standard chart types. It also works on non-standard chart types but the results will be skewed and different.
Non-standard charts are:
• Heikin Ashi (HA)
• Renko
• Kagi
• Point & Figure
• Range
As a reminder: No indicator is capable of providing accurate signals 100% of the time. Every now and then, even the best will fail, leaving you with a losing deal. Whichever indicator you base yourself on, remember to follow the basic rules of risk management and capital allocation.
BINANCE:BTCUSDT
**********************************************************************************************************************************************************************************************************************************************************************************
! Français !
Combo 4+ KDJ STO RSI EMA3 Visual Trend Pine V5@RL
Combo 4+ KDJ STO RSI EMA3 Visual Trend Pine V5@RL est un indicateur visuel de suivi de tendance qui regroupe et combine quatre indicateurs de suivi de tendance. Il est compilé en langage PINE Script Version V5.
• STOCH : Stochastique.
• RSI Divergence : Relative Strength Index Divergence. La Divergence RSI est une différence entre un RSI rapide et un RSI lent.
• KDJ : KDJ Indicateur. (indicateur de suivi de tendance).
• EMA Triple : 3 moyennes mobiles exponentielles (Affichage par défaut).
Cet indicateur est destiné à aider les débutants (et aussi les plus confirmé) à trader à dans le bon sens de la tendance du marché. Il permet d'éviter les erreurs qui consistent à toujours trader à contre tendance.
Les codes de calcul des différents indicateurs utilisés sont des codes publics standards utilisés dans le codage habituel de TradingView pour ces indicateurs !
Le script de calcul de l’indicateur STO est issu du calcul standard du STOCH de TradingView.
Le script de calcul de l’indicateur RSI Div est une réplique de celui créé par @Shizaru.
Le script de calcul de l’indicateur KDJ est une réplique de celui créé par @iamaltcoin.
Le script de calcul de l’indicateur Triple EMA est une réplique de celui créé par @jwilcharts
Cet indicateur peut être configuré à votre convenance. Il peut même être utilisé plusieurs fois sur le même graphique (multi-instance), avec des configurations différentes ou affichage d’un autre indicateur parmi les quatre qui le composent, selon vos besoins ou vos goûts.
Un seul tracé, parmi les 4 indicateurs qui le composent, peut être affiché à la fois mais, soit avec sa propre tendance soit avec la tendance des 4 (3 par défaut) indicateurs combinés (couleur de fond vente=vert ou achat=rouge).
Les indications de tendance (zones de vente ou d’achat potentielles) sont affichés sous la forme de couleur de fond (Haussier : vert ou baissier : rouge) lorsque au moins trois des quatre indicateurs (3 par défaut et configurable de 1 à 4) supposent que le marché évolue dans la même direction. Ces indications de tendance peuvent être configuré et affichés, soit uniquement pour le signal de l’indicateur choisi et affiché, soit pour les signaux des quatre indicateurs ensemble et combinés (ET logique).
Vous pouvez accorder les paramètres d’entrée, de style et de visibilité de chacun des indicateurs pour correspondre à vos propres préférences ou habitudes.
Un signal ‘stop achat’ ou ‘stop vente’ est affiché (layouts) sous la forme d’un carré de couleur (vert pour ‘stop achat’ et rouge pour ‘stop vente’. Ces signaux ‘stop’ peuvent être configuré et affichés, soit uniquement pour l’indicateur choisi, soit pour les quatre indicateurs ensemble et combinés (OU logique).
A noter que la présence d’un signal Stop Long annule la couleur de fond de la tendance Long (vert).
De même, la présence d’un signal Stop Short annule la couleur de fond de la tendance Short (rouge).
Il est aussi composé de 3 étiquettes (Labels) :
• Trend Label (infos de tendance)
• Signal Stop Label (signaux « Stop » achat ou vente)
• Infos Label (Noms des indicateurs Long/Short/Stop Long/Stop Short,
et /Open/Close/High/Low )
Chaque label est configurable (visibilité et position sur le graphique).
• Label Trend : indique le nombre d’indicateurs suggérant une même tendance (Long ou Short) ainsi qu’un indice de force (PWR) de cette tendance :
Par exemple : 3 indicateurs en tendance Short, 1 indicateur en tendance Long et 1 indicateur en tendance neutre donnera :
PWR SHORT = 2/4. (3 indicateurs Short – 1 indicateur Long=2 Pwr Short).
Et si PWR=0 alors l’affichage est « Wait and See » (Attendre et Observer).
Il indique aussi quel indicateur actuel est affiché et le mode d’affichage utilisé (combiné 1 à 4 indicateurs ou non combiné ).
• Signal Stop Label : Indique un possible arrêt de la tendance en cours.
• Infos Label (Simple ou complet) donne les infos de tendance de chacun des 4 indicateurs et les infos OHLC du graphique (en mode « Complet »).
Il est possible d’afficher ce même indicateur plusieurs fois sur un graphique (jusqu’à 3 indicateurs max avec le Plan Basic TradingView et plus avec les plans payants), avec des configurations différentes :
Par exemple :
• 1-Stochastique – Signaux Combinés 2/4 – aucun Label affiché
• 1-RSI – Signaux Combinés 3/4 – Label Stop uniquement affiché
• 1-KDJ – Signaux Combinés 4/4 – les 3 Labels affichés
• 1-EMA’3 - Signaux Non combinés (EMA seuls) – Trend Label affiché
Certains indicateurs ont des filtres/seuils (Thresholds) configurables selon votre convenance et votre expérience !
Le choix des couleurs de l’indicateur est adapté pour un graphique avec thème « sombre », qu’il vous faudra probablement modifier pour le confort visuel, si vous utilisez un mode « Clair » ou un mode personnalisé.
Ce script est un indicateur que vous pouvez exécuter sur des types de graphiques standard. Il fonctionne aussi sur des types de graphiques non-standard mais les résultats seront faussés et différents.
Les graphiques Non-standard sont :
• Heikin Ashi (HA)
• Renko
• Kagi
• Point & Figure
• Range
Pour rappel : Aucun indicateur n’est capable de fournir des signaux précis 100% du temps. De temps en temps, même les meilleurs échoueront, vous laissant avec une affaire perdante. Quel que soit l’indicateur sur lequel vous vous basez, n’oubliez pas de suivre les règles de base de gestion des risques et de répartition du capital.
BINANCE:BTCUSDT
Multi-Length Stochastic Average [LuxAlgo]This indicator returns the average of stochastic oscillators with periods ranging from 4 to length . This allows for a slightly more reactive oscillator as well as having information regarding the position of the price relative to rolling maximums/minimums of different periods.
We introduce settings that allow for pre and post-smoothing, with selectable smoothing methods and periods for both steps.
Settings
Length: Period of the indicator, determine the maximum period of the stochastic oscillator used in the average
Source: Source input of the indicator
Pre-Smoothing (1st Input): Degree of smoothing applied to the source input
Pre-Smoothing (2nd Input): Pre-Smoothing Method
Post-Smoothing (1st Input): Degree of smoothing applied to the final oscillator output
Post-Smoothing (2nd Input): Post-Smoothing Method
Smoothing methods include a simple moving average, a triangular moving average, and a least-squares moving average (this method can induce overshoots during the post-smoothing step). The user can also select "None".
Usages
The "multi-length" aspect of technical indicators is something that hasn't been deeply explored yet such indicators can give us information regarding both short-term and long-term information which was the motivation for the creation of the indicator.
The Multi-length Stochastic Average allows us to quantify the price position relative to a multitude of highest/lowest levels.
In the example above the oscillator returns the average of stochastic oscillators with periods ranging from 4 to 20, as well as multiple rolling minimums with periods ranging from 4 to 20. We can see that when the price is equal to all rolling minimums the oscillator is equal to 0, the oscillator would return 100 if the price were equal to all rolling maximums with periods in that same range.
The oscillator can be interpreted like any scaled oscillator and can be used to estimate trend direction as well as trend strength.
Here we only make of use pre-smoothing by using a period 20 simple moving average. The indicator graphical elements such as colors/circles can help us determine potential directions trends might take.
Circles are displayed when the oscillator crosses over/under the 20/80 level. Such conditions offer better timing than waiting for the oscillator to be greater/lower than 50 and are less subjective to noise than simply looking at the direction taken by the oscillator. However, it can suffer from potential retracements in a trend more easily, this is illustrated in the chart above.
Ehlers Adaptive Stochastic Indicator V1 [CC]The Adaptive Stochastic Indicator V1 was created by John Ehlers (Rocket Science For Traders pgs 233-234) and this indicator uses the same calculations to find a cycle period that is then used for both the creation of the stochastic indicator but also for the smoothing to create a double smoothed stochastic indicator. Because it is calculated this way, this indicator is more reactive than almost any other stochastic indicator and provides clear buy and sell signals especially when the underlying stock is trending. It is interpreted in the same way as a normal stochastic indicator so great buy signals are when the indicator is below the oversold line and starts to move up and vice versa. Buy when the line turns green and sell when it turns red.
Let me know if there are any other indicators you would like to see me publish!
MESA Stochastic Multi LengthJohn Ehler's MESA Stochastic uses super smoothing to give solid signals. This indicator uses the same rules as every other Stochastic indicator so it would be worth looking into if you are not already familiar with reading a Stochastic. There are 4 different lengths displayed to give traders an edge on reading the market. This is a great tool to analyze waves and find tops and bottoms. It gives great pump and dump signals and even helps filter out bad trades when used with other indicators such as Boom Hunter.
Below are some examples of signals to look out for:
oo
Natural Stochastic Indicator [CC]The Natural Stochastic Indicator was created by Jim Sloman and this is another indicator from his Ocean series which I will eventually publish all of them. Big thanks to @altcoinz and @tmac87 for giving me all of the source code in order to publish Jim's life work. This is another momentum indicator but unlike a traditional stochastic indicator, this one doesn't use overbought and oversold levels. Instead it becomes a sell signal when the indicator starts getting lower and vice versa. This takes the classic approach to a stochastic and combines it with the time factor from Jim's Ocean Theory to create this new indicator. I have included strong buy and sell signals as darker colors and normal buy and sell signals as lighter colors. Buy when the line turns green and sell when it turns red.
Let me know if there are any other indicators you would like to see me publish!
Multi-TimeFrame SignalsI trade binary options on reversals. I use this as a confluence to prove that my analysis is correct. I use this on smaller time frames given the type of trading I do.
I do not use this as an entry trigger, so you should not blindly enter trades based on this solely . You were warned
This indicator (on default settings) will let you know when the 1 minute, 3 minute, and 5 minute timeframes RSI & Stochastics are all in an overbought or oversold state. It shows this by changing the background color on your chart to red (overbought) or green (oversold).
All of these settings are changeable. #winning
I left this as open-source as I figured out how to code this by using other open-source scripts as reference. I am a programmer that uses other languages.
I only published this script as a request from a close friend.
Stochastic w/ Crossover Alerts (by WJ)NOTE:
// STOCHASTIC CODE TAKEN FROM DEFAULT INDICATOR
// I HAVE ONLY MADE SOME ADJUSTMENTS FOR VISUAL AID
// I MADE THIS FOR MY OWN USE BUT HAVE DECIDED TO PUBLISH AND SHARE IN CASE ANYBODY WANTS TO USE IT
This is the normal default built-in Stochastic indicator which I have added some stuff for visual aid:
Stochastic background turns green when K line crosses D line UPWARDS, D line is below the oversold level, and price is above selected MA
Stochastic background turns red when K line crosses D line DOWNWARDS, D line is above the overbought level, and price is below selected MA
Alert notification on the crossover candle with background colour change when conditions are met (MA filter)
Kifier's MFI/STOCH Hidden Divergence/Trend BeaterMFI/STOCH Hidden Divergence/Trend Beater
General Idea:
My premise around this strategy was to make a general strategy for crypto that would help out with finding entry positions for when you’re bullish on a crypto and want to hold on for a while, and at the same time avoiding massive drops. Essentially a way to mix long term/ swing trading; I somewhat achieved my goal however it still requires a lot of logic tuning of the trend averages.
I’m a huge proponent of volume indicators and coupled with average closing price, I think this gives a really good idea of what is happening with the market. It gives an idea on the market and retail investor sentiment. This generally gives you logical entry positions (Although I don’t know how amazing that will work with all cryptos, there’s a fine line between a good strategy and one that just rides bubble market conditions, some would argue that’s still a success and others not)
How it works:
There are many components to the strategy that try to do different things:
First of all there are two types of entries, a MFI hidden divergence with a STOCH check, essentially it will only fire when a divergence is detected while STOCH is above 50%, however this might be changed in the future as due to the volatile nature of cryptos, the STOCH is not too effective. The second entry is a simple MFI/STOCH trend, if STOCH is above 50% and the trend is detected to be in a trending long, once a MFI crossover over the 50% line is detected an entry is placed, this is designed to get out profit where the divergence would otherwise be less accurate during strongly trending conditions.
-MFI is a great indicator, as a volume weighted momentum indicator I find it the most accurate of all, the STOCH however is a great indicator to get a general picture of simple market conditions and can filter out the emotional noise of retail investors.
-VWMA and an SMA (The bottom oscillator) gives an idea of the trend tacking into account of the volume, this serves as a more short term filter of the trend for filters.
-OBV checks are done between the OBV and an EMA of the OBV, to get the idea of a volume weighted long trend, which is important for crypto as there are massive rallies to go up due to retail greed, it’s great to jump onto it at the beginning, and get off before the stack of cards fall apart.
-ATR is used to detect when the market is relatively just ranging or moving sideways, which is where the hidden divergence entries are done, during predictable and profitable market conditions.
- Stop loss is based on the closest support of the entry, this is a nice medium of room to breath but also an actual stop loss.
Future plans and improvements:
Currently there’s a lot I want to improve, mostly the divergence detection and the overall sharpe ratio could be much better, but the current value of 0.5 gives me hope that the strategy is onto something. I also want to change TP from a percentage stop to something more dynamic but that might be too optimistic. The current plan is to paper trade test this either by manual or by a python bot, to see how it performs with some user input as well.
Alert(), alertcondition() or strategy alerts?Variety of possibilities offered by PineScript, especially thanks to recent additions, created some confusion. Especially one question repeats quite often - which method to use to trigger alerts?
I'm posting this to clarify and give some syntax examples. I'll discuss these 3 methods in chronological order, meaning - in the order they were introduced to PineScript.
ALERTCONDITION() - it is a function call, which can be used only in study-type script. Since years ago, you could create 2 types of a script: strategy and study. First one enables creating a backtest of a strategy. Second was to develop scripts which didn't require backtesting and could trigger alerts. alertcondition() calls in strategy-type scripts were rejected by Pine compiler. On the other hand compiling study-type scripts rejected all strategy...() calls. That created difficulties, because once you had a nice and backtested strategy, you had to rip it off from all strategy...() function calls to convert your script to study-type so you could produce alerts. Maintenance of two versions of each script was necessary and it was painful.
"STRATEGY ALERTS" were introduced because of alertcondition() pains. To create strategy alert, you need to click "Add alert" button inside Strategy Tester (backtester) and only there. Alerts set-up this way are bound with the backtester - whenever backtester triggers an order, which is visible on the chart, alert is also fired. And you can customize alert message using some placeholders like {{strategy.order.contracts}} or {{ticker}}.
ALERT() was added last. This is an alerts-triggering function call, which can be run from strategy-type script. Finally it is doable! You can connect it to any event coded in PineScript and generate any alert message you want, thanks to concatenation of strings and wrapping variables into tostring() function.
Out of these three alertcondition() is obviously archaic and probably will be discontinued. There is a chance this makes strategy/study distinction not making sense anymore, so I wouldn't be surprised if "studies" are deprecated at some point.
But what are the differences between "Strategy alerts" and alert()? "Strategy alerts" seem easier to set-up with just a few clicks and probably easier to understand and verify, because they go in sync with the backtester and on-chart trade markers. It is especially important to understand how they work if you're building strategy based on pending orders (stop and limit) - events in your code might trigger placing pending order, but alert will be triggered only (and when) such order is executed.
But "Strategy Alerts" have some limitations - not every variable you'd like to include in alert message is available from PineScript. And maybe you don't need the alert fired when the trade hit a stop-loss or take-profit, because you have already forwarded info about closing conditions in entry alert to your broker/exchange.
Alert() was added to PineScript to fill all these gaps. Is allows concatenating any alert message you want, with any variable you want inside it and you can attach alert() function at any event in your PineScript code. For example - when placing orders, crossing variables, exiting trades, but not explicitly at pending orders execution.
The Verdict
"Strategy Alerts" might seem a better fit - easier to set-up and verify, flexible and they fire only when a trade really happens, not producing unnecessary mess when each pending order is placed. But these advantages are illusionary, because they don't give you the full-control which is needed when trading with real money. Especially when using pending orders. If an alert is fired when price actually hit a stop-order or limit-order level, and even if you are executing such alert within 1 second thanks to a tool like TradingConnector, you might already be late and you are making entry at a market price. Slippage will play a great role here. You need to send ordering alert when logical conditions are met - then it will be executed at the price you want. Even if you need to cancel all the pending orders which were not executed. Because of that I strongly recommend sticking to ALERT() when building your alerts system.
Below is an example strategy, showing syntax to manage placing the orders and cancelling them. Yes, this is another spin-off from my TradingView Alerts to MT4 MT5 . As usual, please don't pay attention to backtest results, as this is educational script only.
P.S. For the last time - farewell alertcondition(). You served us well.
2nd Grade StrategyThis is a strategy to complement the 2GT indicator. It utilises the same rules as 2GT.
This is comprises of multiple popularly used indicators to help decide on whether to go long or short. This indicator will overlay the MA lines and background colours on your chart.
The heikin-ashi colour will be shown as the background colour. This will help you identify a trend more easily while using bars, candles, hollow candles, etc. When the background is green, it means that it is a green HA and vice versa.
The blue MA line is for showing the short-term trend. The red MA line is for showing the medium-term trend. You can select the moving average flavour of your choice in the settings.
The yellow MA line is the long-term trend that is mainly used as a filter to indicate bullish/bearish trend. The MA type for this filter can be different from the short/mid term MA.
This indicator will also show Stochastic crossovers (GC, DC, BC) on the chart. This will help to always keep your eye on the chart candles.
In the settings, you can also turn on/off bullish/bearish signals.
Rules for bullish signals on this indicator:-
1. MA: Blue > Red > Yellow (FastMA > SlowMA > FilterMA)
2. Stochastic: K > D and both are heading upwards
3. 2nd Green HA
When 2 out of the 3 rules are met, the candle background will be Aqua in colour. When all 3 rules are met, the candle background will be Green .
Rules for bearish signals on this indicator:-
1. MA: Yellow > Red > Blue (FilterMA > SlowMA > FastMA)
2. Stochastic: D > K and both are heading downwards
3. 2nd Red HA
When 2 out of the 3 rules are met, the candle background will be Orange in colour. When all 3 rules are met, the candle background will be Red .
Do note that you can hide any of these elements in via the settings.
If you find this useful, do smash the LIKE and FOLLOW button.
WSLM
2nd Grade TechniqueThis is comprises of multiple popularly used indicators to help decide on whether to go long or short. This indicator will overlay the MA lines and background colours on your chart.
The heikin-ashi colour will be shown as the background colour. This will help you identify a trend more easily while using bars, candles, hollow candles, etc. When the background is green, it means that it is a green HA and vice versa.
The blue MA line is for showing the short-term trend. The red MA line is for showing the medium-term trend. You can select the moving average flavour of your choice in the settings.
The yellow MA line is the long-term trend that is mainly used as a filter to indicate bullish/bearish trend. The MA type for this filter can be different from the short/mid term MA.
This indicator will also show Stochastic crossovers (GC, DC, BC) on the chart. This will help to always keep your eye on the chart candles.
In the settings, you can also turn on/off bullish/bearish signals.
Rules for bullish signals on this indicator:-
1. MA: Blue > Red > Yellow (FastMA > SlowMA > FilterMA)
2. Stochastic: K > D and both are heading upwards
3. 2nd Green HA
When 2 out of the 3 rules are met, the candle background will be Aqua in colour. When all 3 rules are met, the candle background will be Green .
Rules for bearish signals on this indicator:-
1. MA: Yellow > Red > Blue (FilterMA > SlowMA > FastMA)
2. Stochastic: D > K and both are heading downwards
3. 2nd Red HA
When 2 out of the 3 rules are met, the candle background will be Orange in colour. When all 3 rules are met, the candle background will be Red .
Do note that you can show/hide any of these elements via the settings.
If you find this useful, do smash the LIKE and FOLLOW button.
WSLM
Moving Stop-Loss mechanism + alerts to MT4/MT5"How to code moving stop-loss mechanism", is one of the most often repeating questions in private messages I receive, so just to focus on this mechanism, I made a spin-off from my previous script: TradingView-Alerts-to-MT4-MT5-dynamic-variables-NON-REPAINTING .
The logic here moves the stop-loss each time a trade is running and a new pivot high/low is detected. When such event occurs (UpdateLongStopLoss or UpdateShortStopLoss), stoploss_long or stoploss_short mutable variable is modified. And it needs to be coded inside strategy.exit() line as "stop=stoploss_long" or "stop=stoploss_short". Entries are pretty straightforward - on Stoch crosses.
Last lines of the script show how to wrap information about such updates and send send alerts to MetaTrader via TradingConnector for execution in Forex/indices/commodities/crypto markets via MetaTrader. Please note that "tradeid=" variable must be passed with each alert, to let MetaTrader know which trade to modify. SLMOD, TPMOD are recently added commands, along with BE (as in "move stop-loss to breakeven" - but that's another topic).
Please disregard strategy backtest results, as this script is for coding education purposes only. However, it seems with the stop-loss mechanism enabled, the results are even better, than in original version of the script :)
How to use Leverage and Margin in PineScriptEn route to being absolutely the best and most complete trading platform out there, TradingView has just closed 2 gaps in their PineScript language.
It is now possible to create and backtest a strategy for trading with leverage.
Backtester now produces Margin Calls - so recognizes mid-trade drawdown and if it is too big for the broker to maintain your trade, some part of if will be instantly closed.
New additions were announced in official blogpost , but it lacked code examples, so I have decided to publish this script. Having said that - this is purely educational stuff.
█ LEVERAGE
Let's start with the Leverage. I will discuss this assuming we are always entering trades with some percentage of our equity balance (default_qty_type = strategy.percent_of_equity), not fixed order quantity.
If you want to trade with 1:1 leverage (so no leverage) and enter a trade with all money in your trading account, then first line of your strategy script must include this parameter:
default_qty_value = 100 // which stands for 100%
Now, if you want to trade with 30:1 leverage, you need to multipy the quantity by 30x, so you'd get 30 x 100 = 3000:
default_qty_value = 3000 // which stands for 3000%
And you can play around with this value as you wish, so if you want to enter each trade with 10% equity on 15:1 leverage you'd get default_qty_value = 150.
That's easy. Of course you can modify this quantity value not only in the script, but also afterwards in Script Settings popup, "Properties" tab.
█ MARGIN
Second newly released feature is Margin calculation together with Margin Calls. If the market goes against your trades and your trading account cannot maintain mid-trade drawdown - those trades will be closed in full or partly. Also, if your trading account cannot afford to open more trades (pyramiding those trades), Margin mechanism will prevent them from being entered.
I will not go into details about how Margin calculation works, it was all explainged in above mentioned blogpost and documentation .
All you need to do is to add two parameters to the opening line of your script:
margin_long = 1./30*50, margin_short = 1./30*50
Whereas "30" is a leverage scale as in 30:1, and "50" stands for 50% of Margin required by your broker. Personally the Required Margin number I've met most often is 50%, so I'm using value 50 here, but there are literally 1000+ brokers in this world and this is individual decision by each of them, so you'd better ask yourself.
--------------------
Please note, that if you ever encounter a strategy which triggers Margin Call at least once, then it is probably a very bad strategy. Margin Call is a last resort, last security measure - all the risks should be calculated by the strategy algorithm before it is ever hit. So if you see a Margin Call being triggred, then something is wrong with risk management of the strategy. Therefore - don't use it!
Stochastic & RSIThis script is a simple extension of the Built-In Stochastic RSI that also plots the RSI and prints the values of ATR and ADX of the last bar of the current timeframe to a small table in the corner.
The script can be used to define the entry for a trade when the stochastics crossed and RSI is below or above 0.50 (for going long or short).
OANDA:BTCUSD
I like to use the Stochastics and RSI indicators for pullback strategies, and with this inidcator you dont have to add both indicators to your setup. The ATR can be used to define the value of your stop-loss and the ADX (e.g. > 25) give you a hint for the strength of the current trend.
Stochastic MFIDue to some similarity of the Relative Strength Index(RSI) and Money Flow Index(MFI), I thought of creating a Stoch MFI inspired by the Stoch RSI.
- can be used similar to the Stoch RSI
- useful for pullback during trending markets and for S&R trading during ranging markets
TAYOR!
DMI With Crosses (MyNewTrade)Directional Movement Indicator:
+DI and -DI
I changed the color of the bar bars according to the crossed of +DI and -DI . It helps us to have an idea of whether the trend is continuing or not.
+DI crossover to -DI barcolor is Aqua, if not bar color is Red.
It also helps us to find the lowest and highest points of the graph according to the positions of Adx +DI and -DI .
It gives warnings at the lowest and highest points, which helps us to detect the direction of the trend.