protected override void Initialize()
{
Add(Swing(1));
Add(Swing(1));
SetStopLoss("", CalculationMode.Ticks, StopLoss, false);
SetProfitTarget("", CalculationMode.Ticks, TakeProfit);
CalculateOnBarClose = true;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
// Condition set 1
if (Open[-2] >= Swing(1).SwingHigh[0])
{
EnterLong(DefaultQuantity, "");
}
// Condition set 2
if (CrossBelow(Open, Swing(1).SwingLow, 1))
{
EnterShort(DefaultQuantity, "");
}
}
#region Properties
[Description("")]
[GridCategory("Parameters")]
public int Indicador
{
get { return indicador; }
set { indicador = Math.Max(1, value); }
}
[Description("")]
[GridCategory("Parameters")]
public int StopLoss
{
get { return stopLoss; }
set { stopLoss = Math.Max(1, value); }
}
[Description("")]
[GridCategory("Parameters")]
public int TakeProfit
{
get { return takeProfit; }
set { takeProfit = Math.Max(1, value); }
}
#endregion
Comment