OPEN-SOURCE SCRIPT

MA Bollinger Bands + RSI

업데이트됨
This script uses the standard deviation of a given moving average along with an RSI direction.
When: rsi crossover neutral line + price crossover lower deviation boundary => long
When: rsi crossunder neutral line + price crossunder upper deviation boundary => short
릴리즈 노트
V1 UPDATE:
Strategy() entry/exit functions were fixed.

New chart plots:
- Stop losses: Red squares, above/below trade entrance
- Long signals: blue up-arrows after trade entry (no pyramiding)
- Short signals: red down-arrows after trade entry (no pyramiding)

New User input:
- Stop loss activation as a % of maximum adverse excursion from entry price
- Possibility to re-enter a trade in the same direction as previous (if SL activated)
- How many bars back to look for RSI to cross neutral line (uppon price closing back within bounds)

If SL are not activated, the strategy will wait for an opposite signal to reverse trades direction
If SL are activated, triggered and re-entry is enabled, the strategy will look for another signal in the same direction.

This script will probably never really see its final state, so I'll keep on updating it as I go and learn new cool stuff.
Finally, feel free to contact me if you get ideas on how to improve this script. As always, I'll be happy to discuss it with you!

Enjoy ;)
릴리즈 노트
:)
릴리즈 노트
RSI signal update:
- Source code has been simplified.
- "RSI cross lookback" parameter: now alows to look as far a 1000 bars back for a valid signal RSI signal
NB: If you set it to 1000, it is almost certain that a signal will be detect, hence, it is just like not taking the RSI signal into account when looking to enter a trade.

Overall, the script was re-organized to make it more readable.

Enjoy!
릴리즈 노트
Better stop losses
- It is now also possible to set stop losses for "re-entry trades" (“Long after SL” & “Short after SL”) after previous trade in same direction was stopped.
- To enjoy these, turn on “Enable SL” + “Allow re-entry” and play around with the "SL distance %" to achieve desired risk.

New Moving Average Types
- Weighted Moving Average (WMA) and Volume Weighted Moving Average (VWMA) were added to the Moving Average types available for standard deviation.
- Go to "MA Types" and select prefered one from drop down menu

Strategy() functions
- Were updated and made clearer to read

Do not hesitate to contact me if you have questions or suggestions.
릴리즈 노트
ALERTS ARE HERE!

You can find them in a separate Study script: Search for “MA Bollinger Bands + RSI (Study)” in Indicators, Metrics and Strategies: Community Scripts
I designed the Study as a conform copy of this Strategy: same user inputs, same parameters, same trading signals, etc.

6 different alerts are currently available:
- MABB+RSI Long (or Short) Signal: activates when trade direction changes from Short to Long (or from Long to Short)
- MABB+RSI Long (or Short) Re-Entry Signal: after a stop loss was hit, activates upon same trade direction new signal (“Enable SL” & “Allow re-entry” must be switched on)
- MABB+RSI Long (or Short) Signal (all): activates for every single Long (or Short) signals

Overall, Strategy script was simplified and received minor updates.


릴리즈 노트
Hi all,

4 new functionnalities now available:

TRADE DIRECTIONS
Select to trade only Longs, only Shorts or both.

TIME FILTERS
Select time periods to exclude from back testing!
It might help you identify during which time periods or price trends this strategy performs the best.
If you don’t use (3rd party) automated orders, it can also help you see exactly how the strategy performs only during your active trading hours

TRAILING STOPS
Editable trailing stops set with ATR * multiplier now available.
Trailing stop visual is red until it becomes higher/lower than trade entry price, then becomes green
If “Enable ATR Trailing Stop” is activated in the settings, it will overwrite any other enabled stop losses
NB: see numerous orange (or red) squares? => Try “Allow Re-Entry”

HIGH VOLATILITY PARAMETER
Volatility extremes are defined as follows:
1) Upper Band – Lower Band = BB Volatility
2) A large SMA2000 (baseline) is applied to BBvolatility
3) Bands are created from long SMA: Volatility upper/lower band = SMA +/- SMA * volatility factor
If BB volatility > volatility upper band = high volatility (Red BB Price).
If BB volatility < volatility lower band = low volatility (Green BB Price).
NB: These values can be plotted with “Additionnal Vol. Visuals” in the settings.

When reaching high volatility zone, the strategy will change its behavior:
- If flat: strategy will not pick any signals before volatility comes back down from high zone.
- If in trade and price fluctuates along trade direction: the trade cannot be stopped by potential false signals and will play the entire movement.
- If in trade and price fluctuates against trade direction: the trade will be stopped according to stop settings and will not Re-Enter before volatility comes back out of extreme zone.

I’ve been inspired for these updates thanks to some of your comments and DMs. Never hesitate to share your ideas, it can only make the script better!
Enjoy!
릴리즈 노트
.
릴리즈 노트
No changes for Users!
Just making some improvements so updating the corresponding Study script becomes easier:
All « strategy.position_size » variables were replaced by custom identifier: LSF (Long, Short, Flat).
릴리즈 노트
Hi all,
There were inconsistencies within stop losses plots and activations: those where fixed.
NB:
Still minor issues when stop loss should activate on the candle right after trade entry candle. Instead of stopping, trade keeps going until it hits stop loss in following candles (or until trade direction reversal)
This issue occurs only when stop loss is set very close to trade entry price. So, depending on your strategy settings, if you give enough room for your trades to “breath”, this will not be a problem.
릴리즈 노트
.
릴리즈 노트
Hi all,

- New parameters added to take profits as a fix percentage of entry price and re-entrer trade in same direction after take profit was hit. Although it might reduce net profit by quite a bit, it can also be a good way to drastically reduce maximum drawdown

- New trend following parameters: if activated, this filter allows you to take only short or long trades when the price is below / above the Trend EMA (min length: 1500). A security function was used to call data from higher timeframe so there is not need to wait for 1500 bars (EMA 375 (1hr) = EMA 1500 (15min)) for the strategy to start backtesting.

- Default settings in the annotation function where modified to give a better representation of the backtesting. It also allows to better compare strategy's performances over different tickers and markets. If you miss the old default values, you can always set in back the way it was by going to the "Properties" tab of the strategy settings.

NB: After almost a month spent maturing this strategy I wanted to point out a few things.
You now have 8 different settings groups, allowing to input over 30 different parameters.
Hence, there are now several profitable ways to trade this strategy (and many more un-profitable ^^). Depending on your risk tolerance and trading style, some parameters will effectively improve performances over a given configuration / tickers. In a different configuration, those same parameters could have opposite effects.
I always try to bring easy-to-read visual plots to the chart so what happens in the back makes more sense.
As a wise man said: do not blindly trust the backtester: look in details how the strategy behaves on the chart and always be mindful of overfitting risks.

Like always, I am very open to suggestions and questions. The users (you!) are at the source of my inspiration! In that sense, some will acknowledge modifications discussed in DMs / comments ;)


E-N-J-O-Y !
릴리즈 노트
Hi all, here is the latest version of the script:

NEW USER INPUTS SETTINGS
- High volatility filter: (previously, “Enable Volatility Parameter”) filters out signals when volatility is high / when bands turn red.
- Low volatility filter: (new) filters out signals when volatility is low / when bands turn green
- Risk Reward: increase take profit size
- Alert Messages: Designed for 3Commas users to simply copy/paste "Messages" from their bots using TradingView custom signals (see tooltip). Otherwise, input any messages and/or {{placeholders}} you like!
OTHER IMPROVEMENTS
- Stops and target are now using the ATR and a multiplier of the ATR to calculate top loss and take profits distances.
- Trailing stop were improved, allowing tighter fits through more options.
- The strategy is now in Pinescript V5.
- Use of the strategy function parameter: calc_on_order_fills = TRUE
If left FALSE, Strategy’s alerts would only fire upon bar closed. It’s ok for trade entries (upon bar close), but problematic for stop losses & take profits (anytime).
Therefore, “calc_on_order_fills” was set to TRUES. Hence, Strategy tester display: “Caution!
This strategy may use look-ahead bias, which can lead to unrealistically profitable results”. Here, this warning is irrelevant.

Overall, the whole script and user settings were cleaned up, making it more readable and editable.
As always, hope you enjoy!
릴리즈 노트
- Bug fix for variables "shortSLTPhit" and "longSLTPhit"
- Settings menu layout updates
Bitcoin (Cryptocurrency)Bollinger Bands (BB)Relative Strength Index (RSI)Simple Moving Average (SMA)

오픈 소스 스크립트

진정한 TradingView 정신에 따라, 이 스크립트의 저자는 트레이더들이 이해하고 검증할 수 있도록 오픈 소스로 공개했습니다. 저자에게 박수를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 출판물에서 이 코드를 재사용하는 것은 하우스 룰에 의해 관리됩니다. 님은 즐겨찾기로 이 스크립트를 차트에서 쓸 수 있습니다.

차트에 이 스크립트를 사용하시겠습니까?

면책사항