# Squeeze

Modified on 2010/09/13 15:18 by Eugene — Categorized as: Community Indicators

### Syntax

```
DataSeries Squeeze( Bars bars, DataSeries ds, int period, double dev )
```

### Parameter Description

 bars Bars object ds Data series period Lookback period dev Number of standard deviations for Bollinger Bands calculation

### Description

From John F. Carter's book "Mastering The Trade".

Description found in a blog: squeeze indicator

• "A contraction of the Bollinger Bands (BB) inside the Keltner Bands (KB) is shown by a white circle on the 0 axis of the indicator. Such contractions reflect a market taking a break and consolidating, and is usually seen as a potential leading indicator of subsequent directional movement. Therefore a series of white circles will warn the trader to stay on the lookout for a BB expansion outside the KB (shown by blue circles) which would be an entry signal. Keep in mind that the longer the contraction, the stronger the potential breakout.
• The entry should be made in the direction of the momentum (see histogram). A positive momentum supports a long position, while a negative momentum supports a short position. Note that I have built the histogram based on an fast EMA study (5 periods) of the momentum indicator. This smoothed the histogram and made the exit signal (see below) clearer.
• The exit should be made when momentum weakens. In long trades, strenghtening momentum is shown by lime bars (current bar is greater than former bar) while weakening momemtum is shown by green bars (current bar is lesser than former bar). In short trades, strength is shown by red bars, while weakness is shown by magenta bars. A typical move would be to exit the trade at the first sign of weakness in momentum (e.g. first green or magenta bar). Note that the trader could also pay attention to candlestick patterns as signs of reversals which would offset the lagging nature of the histogram."

### Example

This example illustrates how to use the Squeeze indicator to build a trading strategy:

```
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using WealthLab;
using WealthLab.Indicators;
using Community.Indicators;namespace WealthLab.Strategies
{
public class SqueezeStrategy : WealthScript
{
protected override void Execute()
{
PlotSeriesDualFillBand( PricePane, BBandUpper.Series( Close, 20, 2 ),
BBandLower.Series( Close, 20, 2 ), Color.Transparent, Color.Blue, Color.Blue, LineStyle.Solid, 2 );
PlotSeriesDualFillBand( PricePane, KeltnerUpper.Series( Bars, 20, 20 ),
KeltnerLower.Series( Bars, 20, 20 ), Color.Transparent, Color.Black, Color.Black, LineStyle.Solid, 3 );

Squeeze squeeze = Squeeze.Series( Bars, Close, 20, 2  );
ChartPane SqueezePane = CreatePane( 30, true, true );
PlotSeries( SqueezePane, squeeze, Color.Blue, LineStyle.Histogram, 3 );			for(int bar = 20; bar < Bars.Count; bar++)
{
if (IsLastPositionActive)
{
if( CumDown.Series( Momentum.Series( Close, 14 ), 1 )[bar] >= 1 )
SellAtMarket( bar+1, LastPosition, "MomExit" );
}
else
{
if( squeeze[bar] < 0.00 )