7-RSI strategyHello, I've only been trying to learn PineScript for two months on my own, here I am posting a version of the strategy for a grid bot with 20 orders, order size 5%, earlier I tried to find something similar, but could not. Perhaps others, those who, like me, are just starting to learn PineScript, will find something useful. In the process of using grid bots, I noticed that the RSI indicator is sufficient, so the strategy uses 7 RSI indicators on different timeframes, but it is not necessary to use all 7, usually 3 is enough, therefore, by default, the RSI values are set to limit so that there is no effect on the settings of others. The step between bot orders is set in the settings. The code can of course be simplified, but it's better for understanding, I think.
Осцилляторы
ADX / RSI Strategy by Trade Rush (created by SirPoggy) This is one of many new strategies coming soon which were seen on Trade Rush
This one is the ADX / RSI Strategy seen here:
https:www.youtube.com/watch?v=uSkGE0ujyn4
While the strategy has been modified slightly to use the DMI instead of the ADX, the core of the strategy is essentially the same
Long signals are generated when the RSI is above 70, close is above the 200EMA, and the ADX is above 25 (added is the plus DMI over 25 and minus DMI below 20)
Stop loss is placed below /above the 21 EMA, however, there is a deviation required to ensure price is not too close to where a stop loss would be placed.
Short signals are generated when the RSI is below 30, close is below the 200EMA, and the ADX is above 25 (added is the minus DMI over 25 and plus DMI below 20)
I do not recommend using this strategy but I have provided this code for educational purposes.
Thanks!
Let me know which strategy you'd like coded next in the comments below.
Combo Backtest 123 Reversal & Statistical Volatility This is combo strategies for get a cumulative signal.
First strategy
This System was created from the Book "How I Tripled My Money In The
Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies.
The strategy buys at market, if close price is higher than the previous close
during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50.
The strategy sells at market, if close price is lower than the previous close price
during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
Second strategy
This indicator used to calculate the statistical volatility, sometime
called historical volatility, based on the Extreme Value Method.
Please use this link to get more information about Volatility.
WARNING:
- For purpose educate only
- This script to change bars colors.
REVERSALS
The systems basically play reversals, it enters when the close is lower than its low of 5 bars ago to enter
It exits when the price is higher than the high of 5 days ago
Uses a 200 MA as a market filter, does not trade when the price is below its 200 Moving average
Uses a 5% stop, as per the red Stop Loss Line -- can be adjusted
The amount of bars it uses to look for reversals is set to 5 by default, but can be adjusted in settings.
Best to use on directional instruments where you know that the long term direction is up, for example:
TQQQ, SSO, SPX, SPY, or sector tickers -- but it would be best to include some more advanced filtering for sectors
DUAL RSI
This system uses two RSI's with different settings
Fast RSI Lenght is 16, buys when RSI price is oversold @ 91 or lower, and sells when RSI price is overbought at 70
Slow RSI Lenght is 31, buys when RSI price is oversold @ 91 or lower, and sells when RSI price is overbought at 68
Pyramiding is set to 2 since each system should be able to trade in the same direction on the same day
The Red StopLine is a stop loss of 10% based on the combined strategic position average entry price.
I've used a 2D chart because I prefer longer-term charts for higher quality signals
The way I trade all the systems is to set up alerts to let me know when to look at what setups
The system also has a market filter and does not trade when the close is lower than its 200 days moving average
Simple Buy/Sell StrategyThis is the strategy version of the original 'Simple Buy/Sell Indicator' by @Shizaru .
The original indicator description explains the logic behind the strategy:
"The original script was posted on ProRealCode by user Doctrading.
This little and simple code allows you to draw an indicator, which show you when buy or sell conditions are met.
For "buy" conditions, I did just set :
close > MM200
close > Parabolic SAR
MACD > 0
RSI7 > 50
For "sell" conditions : the opposite.
Of course, you can set what you want, in order to test your strategies.
Of course, to be profitable, you must also set your trading rules (entry, stop loss, trailing stop, take profit, etc.)
It's only an indicator, which doesn't show entry or exit rules."
Hope this helps someone!
Multi-X by HamidBoxHello to All, introducing Multi Types Crossover strategy,
simply the best way of trading with Crossover and Crossunder Strategy, How it Works???
I added 5 types of Moving Averages,
1: Simple Moving Average ( SMA )
2: Exponential Moving Average ( EMA )
3: Weighted Moving Average ( WMA )
4: Volume Weighted Moving Average ( VWMA )
5: Relative Moving Average (RMA)
With this indicator, you can do scalping, You can trade not only with similar types of Moving Average indicators but also with different types of Moving Average indicators.
what is mean? like: Normal Condition is:
( Simple Moving Average ) Crossover to ( Simple Moving Average ), SMA x SMA
( Exponential Moving Average ) Crossover to ( Exponential Moving Average ), EMA x EMA
But we can Crossover with:
( Exponential Moving Average ) Crossover to ( Simple Moving Average ), EMA x SMA
( Simple Moving Average ) Crossover to ( Weighted Moving Average ), SMA x WMA
( Weighted Moving Average ) Crossover to ( Weighted Moving Average ), WMA x WMA
( Simple Moving Average ) Crossover to (Relative Moving Average), WMA x RMA
and also I added Moving Average ZONE in this tool, What does it work???
The zone will tell us what type of direction the market has, if the market is above the zone, it's mean we have a Bullish Trend, and if the market is below the zone, it means the market has a Bearish Trend,
so if you want to play on the safe side, never trade when the market is in Bearish Trend, and if you want to play on aggressive mood, you can skip Moving Average Zone section.
Binary Options Strategy TemplateWith the hype around Binary Options trading (more like gambling instead of trading) it is good to be able to backtest a strategy before using it in the live markets.
In a Binary Options trade the trade get's closed after a specific amount of time and the only thing that matters is if the market has increased in price or decreased after that amount of time.
Because of this a strategy backtest should close all positions after a specific amount of time. In this super small script the number of bars since the trade was opened is used as a way to close the position. So for example if you use this strategy on the 1 minute charts with number of bars set to 5 it will close the position 5 minutes after opening it. Purpose of this script is using it as a strategy on already existing scripts to check viability for options trading.
With the limited pine knowledge that I have I do not know if it is possible to create a more realistic binary options strategy which also calculated the profit. If someone knows a more advanced version of this please let me know.
Combo Backtest 123 Reversal & STARC BandsThis is combo strategies for get a cumulative signal.
First strategy
This System was created from the Book "How I Tripled My Money In The
Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies.
The strategy buys at market, if close price is higher than the previous close
during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50.
The strategy sells at market, if close price is lower than the previous close price
during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
Second strategy
A type of technical indicator that is created by plotting two bands around
a short-term simple moving average (SMA) of an underlying asset's price.
The upper band is created by adding a value of the average true range
(ATR) - a popular indicator used by technical traders - to the moving average.
The lower band is created by subtracting a value of the ATR from the SMA.
STARC is an acronym for Stoller Average Range Channels. The indicator is
named after its creator, Manning Stoller.
WARNING:
- For purpose educate only
- This script to change bars colors.
RSI Hidden Divergence + Stochastic + 200 EMA @DaviddTechHey Traders,
This is my first strategy of many I hope. Inspired by a strategy I found on YouTube I wanted to see if it would work with a BOT strategy.
The idea is :
## LONG ##
* When the price is above 200 EMA take only LONG positions.
* Look for Bullish hidden divergence.
* Stochastic crossover to find our entry.
## SHORTS ##
* When the price is below 200 EMA take only SHORTpositions.
* Look for Bearish hidden divergence.
* Stochastic crossunder to find our entry.
You can used a fixed percentage, ATR, HH/LL or a FIB level to take profit.
Everything is very visual and can be connected easily to a bot.
I will be doing a video on HOW-TO setup in a couple of days.
## MUTLI LEVEL PROFITS ##
This will show you on backtest is you take profits at 3 levels however I have not tested on a BOT strategy.
NOTE : This is for educational purposes and please test on a paper account, as I said this is my first strategy.
I will be working and back testing new strategies every week.
- Made with ♥ @DaviddTech
Kwan NRP Backtest To calculate the coordinates in which the kink of the line will cross,
the standard Forex instruments are used - Relative Strenght Index, Stochastic and Momentum.
It is very easy to optimize them for the existing trading strategy: they all have very
flexible and easily customizable parameters. Signals to enter the market can be 2 situations:
Change of color of the indicator line from red to blue. At the same time, it is worth entering into the purchase;
Change of color of the indicator line from blue to red. In this case, it is worth entering for sale.
The signals are extremely clear and can be used in practice even by beginners. The indicator
itself shows when to make deals: the user only has to accompany them and set the values
of Take Profit and Stop Loss. As a rule, the signal to complete trading is the approach of
the indicator level to the levels of the maximum or minimum of the previous time period.
Double Bollinger StrategyFrom "Bitcoin Trading Strategies: Algorithmic Trading Strategies For Bitcoin And Cryptocurrency That Work" by David Hanson.
*Works better with 1hr time frame and some input optimisations.
"Double Bollinger Band Scalping System
Recommended Timeframe: 1 minute or 5 minute *
Required Indicators:
// - RSI with a length of 14 (default settings)
// - Bollinger band #1 settings: Length = 50, stDev = 1 Hide the basis/middle line (basis line not needed for this strategy)
Note: This is the slower bollinger band in the directions
// - Bollinger band #2 settings: Length 20, stDev = 1 Hide the basis/middle line (basis line not needed for this strategy)
Note: This is the faster bollinger band in the directions
Enter Long/Buy Trade When:
// - RSI is above the level 50
// - A candle closes above the top of the faster bollinger band
Enter a long when a candle then closes above the top of the slower bollinger band, and price is above the top of both bands
Place a stop loss under the low of the entry candle Example of a long trade using this strategy
Exit Long Trade When: A candle closes below the top band of the fast bollinger band
Enter Short/Sell Trade When:
// - RSI is below the level 50
// - A candle closes below the bottom of the faster bollinger band
Enter a short when a candle then closes below the bottom of the slower bollinger band, and price is below both bands
Place a stop loss above the high of the entry candle Example of a short trade using this strategy
Exit Short Trade When: Price closes inside the bottom of the faster bollinger band"
[TVExtBot]Volatility Breakout Trend Strategy(1H&2H)The Volatility Breakout Trend Strategy is a short-term trend strategy that has been modified to enable trading in both long and short directions by optimizing the Volatility Breakout Basic Strategy for 1Hour and 2Hour candles.
Select Timeframe=60 for the input to use on the 1Hour candle and Timeframe=120 for the 2Hour candle.
변동성 돌파 트렌드 전략은 변동성 돌파 기본 전략을 1시간과 2시간 캔들에 최적화하여 롱과 숏 양방향으로 매매가능하도록 수정한 단기 추세 전략입니다. (※1,2시간봉 에서만 사용가능)
1시간봉에서 사용하기 위해서는 입력에서 Timeframe=60을 선택하고 2시간봉에서는 Timeframe=120을 선택합니다.
Default Options(기본설정)
Timeframe (Min) (사용시간봉) : 120분 (※60분과 120분 선택가능)
Noise Ratio (Day) (노이즈비율기간) : 30일
BeforeDay Open-Close Volatility (%) (전날 시가종가 변동률) : 7%
ToDay Open-Close Volatility (%) (당일 시가종가 변동률) : 7%
TakeProfit (%) (익절) : 15%
Trailing Stop(%) (트레일링 스탑) : 5%
ADX + BB %B + AO + EMA [Luca Massuda]This trading strategy combines different indicators:
1) ADX, Average Directional Movement: to spot the trend
2) BB %B Bollinger Band %B: to spost relative price position to Bollinger Bands
3) AO Awesome Oscillator: to spot momentum
4) ema 5,ema21, ema50, ema200: to decide long or short position
You can configure:
Take profit % : at which % gains to take profit from the entry price
Stop loss % : at which % stop loss from the entry price
BB %B Overbought: At which level you consider Overbought respect to Bollinger Bands (values 0 to 100)
BB %B Oversold: At which level you consider Oversold respect to Bollinger Bands (values 0 to 100)
Awesome Oscillator: AO level to consider a long or short position +/- 2
ADX: ADX value to consider a long or short position
Start Date, Month, Year: Starting point for a backtesting strategy
Lenght , Source , Standard Deviation: Bollinger Bands values
ADX smoothing, DI Lenght: ADX values
Green and purple zones indicate when the strategy can go long or short.
Default Long conditions:
ema5>ema21 and ema50>ema200 and bb>75% and ao>2 and adx>15
Default Short conditions:
ema515
Combo Backtest 123 Reversal & Smoothed Williams ADThis is combo strategies for get a cumulative signal.
First strategy
This System was created from the Book "How I Tripled My Money In The
Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies.
The strategy buys at market, if close price is higher than the previous close
during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50.
The strategy sells at market, if close price is lower than the previous close price
during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
Second strategy
Accumulation is a term used to describe a market controlled by buyers;
whereas distribution is defined by a market controlled by sellers.
Williams recommends trading this indicator based on divergences:
Distribution of the security is indicated when the security is making
a new high and the A/D indicator is failing to make a new high. Sell.
Accumulation of the security is indicated when the security is making
a new low and the A/D indicator is failing to make a new low. Buy.
WARNING:
- For purpose educate only
- This script to change bars colors.
Wunder VolPIN StrategyI believe it is perhaps one of the world's simplest but one of the rare indicators where backtest results are so efficient. As a strategy, we buy every time a buy signal comes, but we need to repeat this 20 times and we buy when our average rises by 0.65 percent. I know that this indicator, which I did not prepare for the sales strategy, also works very efficiently in sales transactions.
On settings part you can change the volatility and PIN percentage. I prepare for 1 minute graphs for coins. Maybe if you can arrange the settings for the stocks and different time periods.
I use this strategy in one minute periyod. 20 times buy strategy is very important. On every buy signal you must work in process. You can arrange stoploss if you want. But I am not using stoploss system.
Combo Backtest 123 Reversal & Smoothed RSIThis is combo strategies for get a cumulative signal.
First strategy
This System was created from the Book "How I Tripled My Money In The
Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies.
The strategy buys at market, if close price is higher than the previous close
during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50.
The strategy sells at market, if close price is lower than the previous close price
during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
Second strategy
This is new version of RSI oscillator indicator, developed by John Ehlers.
The main advantage of his way of enhancing the RSI indicator is smoothing
with minimum of lag penalty.
WARNING:
- For purpose educate only
- This script to change bars colors.
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.
Stochastic RSI + WMA + SMA strat// "...an entry signal it's a cross down or up on
// the stochastics. if you're in a downtrend
// on the hourly time frame you
// must also be in a downtrend on the five
// minute so the five period has to be below the 144
// as long as the five period is still trading below
// the 144 period on both the hourly and the five minutes
// we are looking for these short signals crosses down
// in the overbought region of the stochastic. Viceversa for longs"
// Works well with a wide stop with 20 bars lookback
// for the SL level and a 2:1 reward ratio Take Profit .
// These parameters can be modified in the Inputs section of the strategy panel.
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
Bollinger Bands + ADX Strategy// This strategy uses Bollinger Bands to buy when the price
// crosses over the lower band and sell when it crosses down
// the upper band. It only takes trades when the ADX is
// below a certain level, and exits all trades when it's above it.
ADX + RSI Strat// This is a strategy that uses the 7 Period RSI to buy when the indicator is shown as oversold (OS) and sells when
// the index marks overbought (OB). It also uses the ADX to determine whether the trend is ranging or trending
// and filters out the trending trades. Seems to work better for automated trading when the logic is inversed (buying OB
// and selling the OS) wihout stop loss.