Squeeze: Indicator Documentation
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". See his
YouTube presentation.
- Contractions like the Bollinger Bands inside the Keltner Bands reflect a market taking a break and consolidating, and is usually seen as a potential leading indicator of subsequent directional movement. A series of contractions may suggest to look for a BB expansion outside the KB which would be an entry signal. The longer the contraction, the stronger the potential breakout.
- The entry should be made in the direction of the momentum. A positive momentum supports a long position, while a negative momentum supports a short position.
- The exit should be made when momentum weakens.
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 )
BuyAtMarket( bar+1 );
}
}
}
}
}