
// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
/// <summary>
/// Enter the description of your strategy here
/// </summary>
[Description("Enter the description of your strategy here")]
public class MASHALL : Strategy
{
#region Variables
// Wizard generated variables
private int myInput0 = 1; // Default setting for MyInput0
private bool enterLongStrat1 = false;
private bool enterLongStrat2= false;
// 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 = true;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
// Strategy 1
if (Bars.BarsSinceSession >=7)
if (Stochastics(7, 14, 3).D[0] >= 30)
{
enterLongStrat1 = true;
// enterLongStrat2 = false;
DrawTriangleUp("My triangle up" + CurrentBar, true, 0, High[0] + 20 * TickSize, Color.Red);
}
//Strategy 2
if (Bars.BarsSinceSession >=7)
if ( Close[0] >= EMA(30)[0])
{
enterLongStrat2 = true;
// enterLongStrat1 = false; now, then both conditions can never be simultaneously true if you have this
DrawTriangleUp("My triangle up" + CurrentBar, true, 0, High[0] + 30 * TickSize, Color.Blue);
}
if (Bars.BarsSinceSession >=7)
if(enterLongStrat2 == true && enterLongStrat1 == true)
{
EnterLong(DefaultQuantity, "");
}
}
#region Properties
[Description("")]
[GridCategory("Parameters")]
public int MyInput0
{
get { return myInput0; }
set { myInput0 = Math.Max(1, value); }
}
#endregion
}
}

Comment