I am new to ninja trader and now I want to make an indicator (or strategy) that indicates when the EMA10 crosses EMA5. I have made a strategy but that one does nothing. How can I procede? It would be best if it could change the color of a candle, but some kind of arrow would do as well.
This is what I made and didn't work:
namespace NinjaTrader.Strategy
{
/// <summary>
/// This strategy puts a marker when the EMA 10 crosses the EMA 5
/// </summary>
[Description("This strategy puts a marker when the EMA 10 crosses the EMA 5")]
public class TrendChange : Strategy
{
#region Variables
// Wizard generated variables
// 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()
{
// Condition set 1
if (CrossAbove(EMA(10), EMA(5), 1))
{
DrawArrowDown("My down arrow" + CurrentBar, false, 0, 0, Color.Red);
}
// Condition set 2
if (CrossBelow(EMA(10), EMA(5), 1))
{
DrawArrowUp("My up arrow" + CurrentBar, false, 0, 0, Color.Lime);
}
}
#region Properties
#endregion
}
}
Comment