private bool curLong = true; // Default setting for CurLong
private bool curShort = true; // Default setting for CurShort
private bool noPos = true; // Default setting for NoPos
private double highTickThresh = 600; // Default setting for HighTickThresh
private double lowTickThresh = -600; // Default setting for LowTickThresh
protected override void Initialize()
{
Add("ES 12-15",PeriodType.Minute,1);
Add("^TICK",PeriodType.Minute,1);
CalculateOnBarClose = true;
CurLong = false;
CurShort = false;
NoPos = true;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
// Condition set 1
if (Low[1] <= LowTickThresh)
{
if (CurShort == true )
{
ExitShort();
CurShort = false;
}
if (CurLong == false)
{
EnterLong();
CurLong = true;
}
}
// Condition set 2
if (High[1] >= HighTickThresh)
{
if (CurLong == true)
{
ExitLong();
CurLong = false;
}
if (CurShort == false)
{
EnterShort();
CurShort = true;
}
}
}
Comment