Indicator · Pine Script v4 · On the chart

My Squeeze Play

by modster· code credited to Greeffer

This indicator requests a five-minute Bitcoin series and plots two lines offset 5,000 price units above and below the bar average.

View on GitHub

Repaints

GitHub stars1on the repository
Pine versionv4older, still runs
Lines of code38
Settings0inputs
LicenceMIT
Last update4 years ago11 Feb 2022

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 indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

38 lines of Pine Script v4 from squeeze-play.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

squeeze-play.pine
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Greeffer
// This PineScript uses alertcondition() so an alert must be created for both long and short squeeze
//@version=4

// S T U D Y
study("My Squeeze Play", "Squeeze Study", overlay=true)

symbol = "BTCUSDT"
amount=0.001
sell=false
buy=false

expr1 = ohlc4+5000.00
expr2 = ohlc4-5000.00

s1 = security(symbol="BTCUSDT", resolution="5", expression=expr1, lookahead=barmerge.lookahead_on)
s2 = security(symbol="BTCUSDT", resolution="5", expression=expr2, lookahead=barmerge.lookahead_on)
plot(s1)
plot(s2)

if high>s1
    sell:=true
else
    sell:=false

if low<s2
    buy:=true
else
    buy:=false

// S E L L
alertcondition(sell, "short squeeze", message='{"side":"shortSqueeze","symbol":"BTCUSDT", "amount":"0.001"}')
//strategy.order("order", long=false, oca_name="order", qty=0.001, comment="sell", when=high>s1)

// B U Y
alertcondition(buy, "long squeeze", message='{"side":"longSqueeze","symbol":"BTCUSDT", "amount":"0.001"}')
//strategy.order("order", long=true, oca_name="order", qty=0.001, comment="buy", when=low<s2)

Overview

My Squeeze Play raises a short squeeze alert when the high exceeds the upper line and a long squeeze alert when the low falls below the lower line. The offsets are fixed in the code and there are no settings. Because it uses higher-timeframe data with lookahead enabled, values can differ between live and historical bars.

Details

Published by

modster on GitHub

Code credit

Greeffer, as written in the script's header

Type

Indicator, Pine Script v4

Draws

On the price chart

Category

Breakout

Markets

Crypto

Timeframes

M1-M5

Risk Notes

  • Signals can change on the live bar or after it closes (repainting)
  • Reads higher-timeframe data with lookahead on, so the history can show signals that were not there in real time
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

Sideway Zones Live

by dearvn
257 stars

Sideway Zones Live is an overlay indicator that estimates inner and outer sideways bands from recent highs and lows with a rational quadratic kernel. It tracks swing pivots over a loopback period and counts bars that remain between the outer high and low. Afte

Indicator v5 TrendSupport & resistance
Updated 6 weeks ago · None stated GitHub repository of Sideway Zones Live
219 stars

Candlestick - Inside Bar Pattern is an overlay indicator that identifies inside bar setups across three consecutive candles. It detects when the price range of the preceding bar is completely contained within the range of the bar prior to it. The direction of

Indicator v5 Candlestick patternsBreakout
Updated 1 year ago · None stated GitHub repository of Candlestick - Inside Bar Pattern
218 stars

This indicator plots dynamic support and resistance levels on the price chart. It detects pivot highs and lows using the pivot length and tracks touches to build strength-based levels. Support and resistance zones appear as colored boxes while lines mark key l

Indicator v6 Support & resistanceBreakout
Updated 3 months ago · None stated GitHub repository of Dynamic Support & Resistance

Acceleration Bands

by capissimo
114 stars

Acceleration Bands is an overlay indicator that plots a volatility envelope around a central simple moving average. It calculates upper and lower boundary bands scaled by the high-to-low bar range relative to the midpoint price, smoothed by an SMA over a user-

Indicator v4 Volatility & bandsMoving averages
Updated 1 year ago · None stated GitHub repository of Acceleration Bands

Donchian Channels (DC)

by mihakralj
99 stars

This indicator calculates and plots Donchian Channels directly on the price chart. It determines the highest high and lowest low over a user-selected lookback period using an optimized monotonic deque algorithm, as well as a middle basis line computed as their

Indicator v6 Volatility & bandsSupport & resistance
Updated 4 weeks ago · Apache-2.0 GitHub repository of Donchian Channels (DC)

Lows from New Highs

by be-thomas
65 stars

This indicator tracks bar lows during consecutive rising highs using Pine Script arrays. When at least four lows accumulate or the price breaches the minimum low in the stack, the script sorts the recorded lows in ascending order and flushes them. It plots up

Indicator v4 Support & resistanceBreakout
Updated 5 days ago · GPL-3.0 GitHub repository of Lows from New Highs

More indicators

Trade Your Charts With a Regulated Broker

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

Compare brokers