// 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 AMOMOMACSTO : 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 (Open[0] < Close[0]
&& MACD(12, 26, 9)[0] > MACD(12, 26, 9).Avg[0]
&& Stochastics(7, 14, 3).K[0] > Stochastics(7, 14, 3).D[0]
&& MACD(12, 26, 9).Avg[0] > MACD(12, 26, 9).Avg[1]
&& StochasticsFast(3, 14).K[0] > StochasticsFast(3, 14).K[1]
&& MACD(12, 26, 9).Diff[0] > MACD(12, 26, 9).Diff[1]
&& BuyVolume()[0] > SellVolume()[0])
{
DrawArrowUp("My up arrow" + CurrentBar, true, 0, Low[0] + -3 * TickSize, Color.Yellow);
PlaySound(@"C:\Program Files\NinjaTrader 6.5\sounds\Ding.wav");
}
// Condition set 2
if (Open[0] > Close[0]
&& MACD(12, 26, 9)[0] < MACD(12, 26, 9).Avg[0]
&& Stochastics(7, 14, 3).K[0] < Stochastics(7, 14, 3).D[0]
&& MACD(12, 26, 9).Avg[0] < MACD(12, 26, 9).Avg[1]
&& StochasticsFast(3, 14).K[0] < StochasticsFast(3, 14).K[1]
&& MACD(12, 26, 9).Diff[0] < MACD(12, 26, 9).Diff[1]
&& SellVolume()[0] > BuyVolume()[0])
{
DrawArrowDown("My down arrow" + CurrentBar, true, 0, High[0] + 3 * TickSize, Color.Yellow);
PlaySound(@"C:\Program Files\NinjaTrader 6.5\sounds\beep.wav");
}
Comment