Squeeze

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

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".

Description found in a blog: squeeze indicator





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 ); } } } } }