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
Description
- A collection of functions to detect simple bar patterns: Inside Day, Outside Day, Gap Up and Gap Down.
- 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);
}
}
}
}