public class Gaps : Indicator
{
#region Variables
// Wizard generated variables
private int linewidth = 2;
private int _intCalculationIndex = 1;
private int _intStartBar = 0;
private Brush hiddenGapdown=Brushes.Magenta;
private Brush hiddenGapup=Brushes.Cyan;
private int opaque = 5;
#endregion
/// <summary>
/// </summary>
protected override void OnStateChange()
{
IsAutoScale = false;
IsOverlay = true;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
this._intCalculationIndex = 1;
if (CurrentBar < 5)
return;
{
//Gap Up++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++Up+++++++ ++++++++++++
if (Low[0] > High[2] )
{
Draw.Rectangle(this, CurrentBar.ToString(), false, 2, High[2] , 0, Low[0], hiddenGapup, hiddenGapup, Opacity);
}
//Gap Down ---------------------------------------------------------------------------Down--------------------------------------------
if (High[0] < Low[2] //Gap from Current Candle to Candle before
)
{
Draw.Rectangle(this, CurrentBar.ToString(), false, 2, Low[2], 0, High[0] , hiddenGapdown,hiddenGapdown,Opacity);
}
}
}
// In order to trim the indicator's label we need to override the ToString() method.
public override string ToString()
{
return Name ;
// return "" ;
}
// In order to trim the indicator's label we need to override the ToString() method.
public override string ToString()
{
return Name ;
// return "" ;
}
#region Properties
#region Gap Down Color
[XmlIgnore()]
[Category("\t\t\t\tTrigger Colors")]
public Brush GapDownColor
{
get { return hiddenGapdown; }
set { hiddenGapdown = value; }
}
[Browsable(false)]
public string GapDownColorSerialize
{
get { return Serialize.BrushToString(hiddenGapdown); }
set {hiddenGapdown = Serialize.StringToBrush(value); }
}
#endregion
#region Gap Up Color
[XmlIgnore()]
[Category("\t\t\t\tTrigger Colors")]
public Brush GapUpColor
{
get { return hiddenGapup; }
set { hiddenGapup = value; }
}
[Browsable(false)]
public string GapUpColorSerialize
{
get { return Serialize.BrushToString(hiddenGapup); }
set {hiddenGapup = Serialize.StringToBrush(value); }
}
#endregion
#region Gap Fill Opacity
[XmlIgnore()]
[Category("\t\t\t\tTrigger Colors")]
public int Opacity
{
get { return opaque; }
set { opaque = value; }
}
#endregion
Comment