Strategy · Pine Script v5 · On the chart

Tweezer Lyfe

by RobACurtis· code credited to djdrob

Tweezer Lyfe is a TradingView strategy that identifies Tweezer reversal patterns on the price chart.

View on GitHub

GitHub stars1on the repository
Pine versionv5runs as is
Lines of code71
Settings3inputs
LicenceNone statedfile: MPL-2.0
Last update2 years ago20 Jan 2024

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

71 lines of Pine Script v5 from strategies/tweezerLyfe.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

tweezerLyfe.pine
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © djdrob

//@version=5
strategy('Tweezer Lyfe', overlay=true)

goLong = input.bool(true, title="Go Long")
goShort = input.bool(true, title="Go Short")
maxRisk = input.int(7, title="Max Risk in points")

big_candle_2_close = request.security(syminfo.tickerid, "55", close[2])
big_candle_1_close = request.security(syminfo.tickerid, "55", close[1])
big_candle_open = request.security(syminfo.tickerid, "55", open)

big_candle_2_open = request.security(syminfo.tickerid, "55", open[2])
big_candle_1_open = request.security(syminfo.tickerid, "55", open[1])
big_candle_close = request.security(syminfo.tickerid, "55", open)

// Bollinger Bands
[middle, upper, lower] = ta.bb(close, 20, 2)
plot(upper, color=color.rgb(4, 0, 255), title="upper")
plot(middle, color=color.rgb(4, 0, 255), title="middle")
plot(lower, color=color.rgb(4, 0, 255), title="lower")

rsi1 = ta.rsi(close, 15)
kRed = ta.sma(ta.stoch(rsi1, rsi1, rsi1, 20), 4)
dGreen = ta.sma(kRed, 4)

atr = ta.atr(20)
stopPriceLong = ta.lowest(1) - atr
stopPriceShort = ta.highest(1) + atr

bullishTweezer() =>
    prevCandleBearish = close[1] < open[1] and close[1] <= lower 
    isCloseBullish = close >= hl2[1] and open < lower
    checkRisk = (high - stopPriceLong) <= maxRisk
    bigs = big_candle_1_close > big_candle_2_close or big_candle_open > big_candle_2_close
    rsi = ta.crossover(kRed, dGreen) or (kRed < dGreen and rsi1 < 40)
    bullishTweezer = prevCandleBearish and isCloseBullish and checkRisk and rsi and bigs
    bullishTweezer

bearishTweezer() =>
    prevCandleBullish = close[1] > open[1]
    isCloseBearish = close <= hlc3[1] and open >= upper and hl2 >= upper
    checkRisk = (high[1] - stopPriceShort) <= maxRisk
    bigs = big_candle_1_close < big_candle_2_open or big_candle_open < big_candle_2_close
    rsi = ta.crossunder(kRed, dGreen) or (kRed > dGreen and rsi1 > 80)
    bearishTweezer = prevCandleBullish and isCloseBearish and checkRisk and rsi and bigs
    bearishTweezer

tweezer_strategy() =>
    [bullishTweezer(), bearishTweezer()]

[buy, sell] = tweezer_strategy()

// order entry
if buy and goLong
    strategy.entry("Go Long", strategy.long)
    strategy.exit("Stop Loss", stop=stopPriceLong)

if sell and goShort
    strategy.entry('goshort', strategy.short)
    strategy.exit("Stop Loss", stop=stopPriceShort)

if (strategy.position_size > 0)
    if (close >= (upper + middle) / 2)
        strategy.close_all('exit long')
    
if (strategy.position_size < 0)
    if (close <= (lower + middle) / 2)
        strategy.close_all('exit short')

Overview

Tweezer Lyfe plots Bollinger Bands with RSI and stochastic indicators for momentum confirmation. Bullish signals require a prior bearish candle closing near the lower band, combined with a bullish close, big candle conditions, risk limits, and RSI crossover. Bearish signals follow similar rules using upper band and RSI conditions. Long entries use ATR-based stop loss below recent lows; short entries use stops above recent highs. Position exits occur when price crosses the middle Bollinger Band. The strategy supports both long and short directions with adjustable max risk in points.

Details

Published by

RobACurtis on GitHub

Code credit

djdrob, as written in the script's header

Draws

On the price chart

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Topics

pinescripttradingtradingview

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
Go LongbooltruegoLong
Go ShortbooltruegoShort
Max Risk in pointsint7maxRisk
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

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
106 stars

This trading strategy combines three Exponential Moving Averages (8, 14, and 50 periods by default) with Stochastic RSI and Average True Range (ATR). It enters a long position when EMA 1 is above EMA 2, EMA 2 is above EMA 3, and the Stochastic RSI %K line cros

Strategy v4 TrendOscillators & momentum
Updated 2 years ago · GPL-3.0 GitHub repository of 3 x EMA + Stochastic RSI + ATR

Momentum Rider DAILY FINAL

by greenpeas007
58 stars

This strategy combines exponential moving averages (EMA 9, 21, 50), RSI, MACD, and Supertrend indicators to enter long positions. It triggers trades using six dynamic setups based on momentum breakouts, EMA crossovers, and pullbacks. Position sizing is compute

Strategy v6 TrendOscillators & momentum Repaints
Updated 4 months ago · Custom licence GitHub repository of Momentum Rider DAILY FINAL
57 stars

This strategy identifies trend reversals through market structure changes (CHoCH) filtered by MACD momentum. It initiates long positions on bullish structure breaks when MACD is positive and above its signal line, and short positions on bearish breaks when MAC

Strategy v6 SMC / ICT / price actionOscillators & momentum Repaints
Updated 1 year ago · Apache-2.0 GitHub repository of Market Structure MACD 4H + Trailing

CombinedBinHAndClucV6

by viktors1982
36 stars

CombinedBinHAndClucV6 is a trading strategy based on the popular BinHV45 and ClucMay72018 algorithms. It calculates dual Bollinger Bands, Exponential Moving Averages, Relative Strength Index, Average True Range, and volume metrics across primary and one-hour h

Strategy v4 Volatility & bandsOscillators & momentum Repaints
Updated 2 years ago · None stated GitHub repository of CombinedBinHAndClucV6

More Trend scripts

Related on ForexR

Trade Your Charts With a Regulated Broker

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

Compare brokers