Bar Patterns

Modified on 2017/09/01 09:44 by Eugene — Categorized as: Community Components

Syntax

public bool isInsideBar(int bar) public bool isOutsideBar(int bar) public bool isGapUp(int bar) public bool isGapDown(int bar) public enum GapType { PartialDown, FullDown, PartialUp, FullUp } public GapType isGap(int bar)

Parameter Description

bar Bar number

Description

  1. A collection of functions to detect simple bar patterns: Inside Day, Outside Day, Gap Up and Gap Down.
  2. An alternative isGap function returns an enumeration GapType, indicating the type of gap - up/down, full/partial.

Example

Example using C# extension methods:

using System; using System.Collections.Generic; using System.Text; using System.Drawing; using WealthLab; using WealthLab.Indicators;

namespace WealthLab.Strategies { public class BarPatternsDemo : WealthScript { protected override void Execute() { for(int bar = 1; bar < Bars.Count; bar++) { if( this.isGapUp(bar) && this.isGap(bar) == CommonSignalsEx.GapType.FullUp ) AnnotateBar( "Gap Up", bar, true, Color.Blue ); if( this.isGapDown(bar) && this.isGap(bar) == CommonSignalsEx.GapType.FullDown ) AnnotateBar( "Gap Down", bar, false, Color.Red); } } } }