Strategy · Pine Script v5 · On the chart

Three Brothers Strategy

by sassiz-root

This strategy looks for three prior bars moving the same way with successively smaller bodies, followed by a current bar that closes the other way.

View on GitHub

Repaints

GitHub stars2on the repository
Pine versionv5runs as is
Lines of code25
Settings0inputs
LicenceMIT
Last update3 years ago23 Feb 2023

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new strategy, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart. The trades and results appear in the Strategy Tester tab; adjust the settings with the gear icon.

Source Code

25 lines of Pine Script v5 from three_bro_strategy.txt, published under MIT. Keep the author's credit and licence lines when you reuse it.

three_bro_strategy.txt
//@version=5
strategy("three_brothers_strategy", overlay=true,shorttitle='3_bros_stg')

bullish_bros = close[1] > open[1] and (close[1]-open[1]) < (close[2]-open[2]) and (close[2]-open[2]) < (close[3]-open[3]) and close[0] < open[0]
bearish_bros = close[1] < open[1] and (open[1]-close[1]) < (open[2]-close[2]) and (open[2]-close[2]) < (open[3]-close[3]) and close[0] > open[0]
// plotshape(bullish_bros,title='sell',color=color.red,text='Sell',textcolor=color.red,style=shape.arrowdown)
// plotshape(bearish_bros,title='buy',color=color.green,text='Buy',textcolor=color.green,style=shape.arrowup)

// var takeprofit = 0.0
// var stoploss = 0.0

// if bearish_bros
//     strategy.entry("buy",strategy.long,qty=0.01)
//     takeprofit := open[3]
//     stoploss := close + (close - open[2])
// //    
// strategy.close(id='buy',when = high>= takeprofit or low<=stoploss )    
// //or
// // strategy.exit(id='buy',limit=takeprofit,stop=stoploss)

//third method
strategy.entry('buy',strategy.long,when=bearish_bros)
//strategy.close(id='buy',when = high > strategy.position_avg_price * 1.015 or low < strategy.position_avg_price * 0.99)
strategy.exit('buy',limit = strategy.position_avg_price * 1.015,stop=strategy.position_avg_price * 0.99)
// strategy.entry("sell",strategy.short,qty=0.01,when=bullish_bros)

Overview

Three Brothers Strategy enters long when those prior bars are bearish and the current bar is bullish. A short entry is present only as a comment and does not run. Exits use a take profit 1.5 percent above the average entry price and a stop 1 percent below it. It plots on the price chart and has no inputs. The live bar can change the entry condition before it closes.

Details

Published by

sassiz-root on GitHub

Type

Strategy, Pine Script v5

Draws

On the price chart

Category

Candlestick patterns

Markets

Crypto

Timeframes

Any timeframe

Risk Notes

  • Signals can change on the live bar or after it closes (repainting)
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

330 stars

Exceeded Candle [Alorse] is a mean-reversion strategy that identifies candlestick engulfing patterns combined with Bollinger Bands filters. It enters a long position when a green candle surpasses the body of the previous red candle while price is below the mid

Strategy v4 Mean reversionCandlestick patterns
Updated 2 months ago · None stated GitHub repository of Exceeded candle [Alorse]
285 stars

Mean Reversion Strategy is an overlay strategy that identifies pullbacks using a long-term EMA, RSI, and candlestick patterns. It generates long signals when a bullish engulfing candle forms below the EMA while RSI is oversold, and short signals when a bearish

Strategy v4 Mean reversionCandlestick patterns
Updated 3 years ago · None stated GitHub repository of Mean Reversion Strategy

ESU2023-10M - V1

by dearvn
257 stars

ESU2023-10M - V1 is an intraday trend-reversal strategy designed for index futures contracts on the price chart. It calculates a 3-period moving average of candle highs and lows alongside specific three-bar price action patterns to detect short-term swing high

Strategy v5 TrendCandlestick patterns
Updated 6 weeks ago · None stated GitHub repository of ESU2023-10M - V1

STRG One Bar Pursuit

by harryguiacorn
219 stars

The STRG One Bar Pursuit strategy identifies single-bar momentum reversals by monitoring shifts between bullish and bearish candlesticks starting from the year 2024. It enters a long position when a bullish candle follows a bearish candle and enters a short po

Strategy v5 Candlestick patternsMean reversion
Updated 1 year ago · None stated GitHub repository of STRG One Bar Pursuit
218 stars

This strategy identifies trade opportunities based on candlestick wick imbalances relative to the Average True Range. It enters positions when candle wicks exceed defined thresholds and filters out doji candles using a minimum body ATR requirement. Exits are h

Strategy v6 Candlestick patternsVolatility & bands Repaints
Updated 3 months ago · None stated GitHub repository of Super Negative R:R Wick Strategy

More strategys

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers