[Description("Enter the description of your strategy here")]
publicclass MyBasic : Strategy
{
#region Variables
// Wizard generated variables
privateint 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>
protectedoverridevoid Initialize()
{
Add ("YM 06-10", PeriodType.Minute, 5);
Add(LinReg(25));
Add(MACD(12,26,7));
SetProfitTarget("M2LS", CalculationMode.Ticks, 32);
SetStopLoss("M2LS", CalculationMode.Ticks, 18, false);
CalculateOnBarClose = true;
}
///<summary>
/// Called on each bar update event (incoming tick)
///</summary>
protectedoverridevoid OnBarUpdate()
{
if (BarsInProgress != 0)
return;
// Condition set 1 if the primary index price closes below the 25LSMA
// and the MACD on the YM 5 minute is below the 0 line -- go short
if (Close[0] < LinReg(25)[0] && MACD(BarsArray[1], (12,26,7))[0] < 0)
{
EnterShort(DefaultQuantity, "M2LS");
}
}
#region Properties
[Description("")]
[Category("Parameters")]
publicint MyInput0
{
get { return myInput0; }
set { myInput0 = Math.Max(1, value); }
}
#endregion
}
}
Please advise
Merrill

Comment