OPEN-SOURCE SCRIPT

Bollinger Bands strategy with RSI and MACD v1.0

This is a strategy based on the Bollinger Bands, where buy trades are made when the price crosses the lower line of the Bollinger Bands upwards, and sell trades are made when the price crosses the upper line downwards.

In addition, it is possible through the inputs to enable trading with RSI and MACD, so that buy or sell trades are supported by these two indicators.

Trades are partially and fully closed in the following way, a buy trade will close half of the position when the price touches the middle line of the Bollinger bands and will be fully closed when the price touches the upper band. In the case of a sell position, half of the position will be closed if the price touches the middle band and the entire position will be closed when the price touches the lower band. Alternatively, a fixed take profit can be placed. In case the price moves against us, trailing stops can be placed.

In case of selecting to use RSI, MACD, or MACD variation, trades will be executed as long as The Bollinger Bands, and all the above-mentioned indicators give the same signals, either buy or sell.

For example in the case of selecting only Use RSI, buy trades would be made as long as RSI and BB give buy signals.

Strategy inputs:

-BB source: Bollinger Bands price source.

-Bollinger Bands SMA length: Bollinger Bands simple moving average length.

-Bollinger Bands StdDev length: Bollinger Bands standard deviation length.

-Trail Long Loss (%): Distance in percentage at which the stop loss will initially be placed for buy trades.

-Trail Short Loss (%): Distance in percentage at which the stop loss will be initially placed for sell trades.

-Maximum orders: Maximum of simultaneous operations, for example, if it is 3, up to 3 parallel operations of buy and up to 3 parallel operations of sell will be carried out.

-Position size: Number of contracts per trade.

-Use RSI: If selected, the strategy will also trade based on oversold or overbought signals provided by the RSI.

-RSI source: RSI price source.

-RSI period: The RSI period to use.

-RSI value for buy: If the RSI is below this value, it will give a buy signal.

-RSI value for sell: If the RSI value is above this value, it will give a sell signal.

-Use MACD: If selected, buy trades will be made when the MACD crosses 0 upwards, and sell trades will be made when the MACD crosses 0 downwards.

-Use MACD variation: Only available if MACD is previously selected. In this case, buy trades are made if the MACD value in the last 3 candles has been decreasing, and sell trades are made if the MACD value has been increasing.

-MACD source: MACD price source.

-MACD fast length: MACD fast EMA lenght.

-MACD slow length: MACD slow EMA lenght.

-MACD signal length: MACD signal EMA lenght.

-Use maximum TP long: If selected, a fixed take profit will be placed for buy trades. The position could be closed before reaching this take profit if the price touches one of the lower or upper lines first.

-Maximum take profit long (%): Distance in percentage at which the take profit will be placed for buy trades.

-Use maximum TP short: if selected, a fixed take profit will be placed for sell trades. The position could be closed before reaching this take profit if the price touches one of the lower or upper lines first.

-Maximum take profit short (%): Distance in percentage at which the take profit will be set for sell trades.

I hope you like it and as always all feedback is welcome.
Bollinger Bands (BB)Moving Average Convergence / Divergence (MACD)Relative Strength Index (RSI)rsimacd

오픈 소스 스크립트

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

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

면책사항