/// <summary>
/// LONG AND SHORT
/// </summary>
[Description("LONG AND SHORT")]
[Gui.Design.DisplayName("STEVE")]
public class FLOWTRADING : Strategy
{
#region Variables
// Wizard generated variables
private int myInput0 = 1; // Default setting for MyInput0
// User defined variables (add any user defined variables below)
#endregion
/// <summary>
/// This method is used to configure the strategy and is called once before any strategy method is called.
/// </summary>
protected override void Initialize()
{
CalculateOnBarClose = false;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
// Condition set 1
if (Bars.CurrentAsk == High[1] + 1 * TickSize
&& Low[1] < Low[2]
&& High[1] <= High[2])
{
EnterLongLimit(DefaultQuantity, Bars.CurrentAsk, "");
}
// Condition set 2
if (Low[2] < Low[3]
&& Bars.CurrentAsk == High[1] + 1 * TickSize
&& High[1] <= High[2])
{
EnterLongLimit(DefaultQuantity, Bars.CurrentAsk, "");
}
// Condition set 3
if (Bars.CurrentAsk == High[1] + 1 * TickSize
&& Low[3] < Low[4]
&& High[1] <= High[2]
&& High[2] <= High[3])
{
EnterLongLimit(DefaultQuantity, Bars.CurrentAsk, "");
}
// Condition set 4
if (Bars.CurrentAsk == High[1] + 1 * TickSize
&& Low[4] < Low[5]
&& High[1] <= High[2]
&& High[2] <= High[3]
&& High[3] <= High[4])
{
EnterLongLimit(DefaultQuantity, Bars.CurrentAsk, "");
}
// Condition set 5
if (Bars.CurrentAsk == High[1] + 1 * TickSize
&& Low[5] < Low[6]
&& High[1] <= High[2]
&& High[2] <= High[3]
&& High[3] <= High[4]
&& High[4] <= High[5])
{
EnterLongLimit(DefaultQuantity, Bars.CurrentAsk, "");
}
// Condition set 6
if (Bars.CurrentAsk == High[1] + 1 * TickSize
&& High[1] > High[2]
&& Low[1] < Low[2])
{
EnterLongLimit(DefaultQuantity, Bars.CurrentAsk, "");
}
// Condition set 7
if (Bars.CurrentAsk == High[1] + 1 * TickSize
&& Low[0] < Low[1])
{
EnterLongLimit(DefaultQuantity, Bars.CurrentAsk, "");
}
// Condition set 8
if (Bars.CurrentBid == Low[1] + -1 * TickSize
&& High[1] > High[2]
&& Low[1] >= Low[2])
{
EnterShortLimit(DefaultQuantity, Bars.CurrentBid, "");
}
// Condition set 9
if (Bars.CurrentBid == Low[1] + -1 * TickSize
&& High[2] > High[3]
&& Low[1] >= Low[2])
{
EnterShortLimit(DefaultQuantity, Bars.CurrentBid, "");
}
// Condition set 10
if (Bars.CurrentBid == Low[1] + -1 * TickSize
&& High[3] > High[4]
&& Low[1] >= Low[2]
&& Low[2] >= Low[3])
{
EnterShortLimit(DefaultQuantity, Bars.CurrentBid, "");
}
// Condition set 11
if (Bars.CurrentBid == Low[1] + -1 * TickSize
&& High[4] > High[5]
&& Low[1] >= Low[2]
&& Low[2] >= Low[3]
&& Low[3] >= Low[4])
{
EnterShortLimit(DefaultQuantity, Bars.CurrentBid, "");
}
// Condition set 12
if (Bars.CurrentBid == Low[1] + -1 * TickSize
&& High[5] > High[6]
&& Low[1] >= Low[2]
&& Low[2] >= Low[3]
&& Low[3] >= Low[4]
&& Low[4] >= Low[5])
{
EnterShortLimit(DefaultQuantity, Bars.CurrentBid, "");
}
// Condition set 13
if (Bars.CurrentBid == Low[1] + -1 * TickSize
&& Low[1] < Low[2]
&& High[1] > High[2])
{
EnterShortLimit(DefaultQuantity, Bars.CurrentBid, "");
}
// Condition set 14
if (Bars.CurrentBid == Low[1] + -1 * TickSize
&& High[0] > High[1])
{
EnterShortLimit(DefaultQuantity, Bars.CurrentBid, "");
}
}
#region Properties
[Description("")]
[Category("Parameters")]
public int MyInput0
{
get { return myInput0; }
set { myInput0 = Math.Max(1, value); }
}
#endregion
}
}
Comment