Free Indicator MT MA Pack Colour - Strategy
Coded in response to a Trader request.
This requires the MicroTrendsNinjaTraderFramework to be installed before compiling.
// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
///
/// MA Rising Falling
///
[Description("MA Rising Falling")]
public class MARisingFalling : Strategy
{
#region Variables
// Wizard generated variables
private int period = 10; // Default setting for Period
// User defined variables (add any user defined variables below)
#endregion
///
/// This method is used to configure the strategy and is called once before any strategy method is called.
///
protected override void Initialize()
{
// SetStopLoss("", CalculationMode.Ticks, 100, false);
CalculateOnBarClose = true;
Add(MicroTrendsMAPackColor(Input, NinjaTrader.mATypes.EMA, this.Period));
}
///
/// Called on each bar update event (incoming tick)
///
protected override void OnBarUpdate()
{
if(CurrentBar // Condition set 1
if (MicroTrendsMAPackColor(Input, NinjaTrader.mATypes.EMA, this.Period).FallingPlot.ContainsValue(0))
{
EnterShort();
}
else if (MicroTrendsMAPackColor(Input,NinjaTrader.mATypes.EMA, this.Period).RisingPlot.ContainsValue(0))
{
EnterLong();
}
else if (MicroTrendsMAPackColor(Input,NinjaTrader.mATypes.EMA, this.Period).FlatPlot.ContainsValue(0))
{
ExitLong();
ExitShort();
}
}
#region Properties
[Description("")]
[GridCategory("Parameters")]
public int Period
{
get { return period; }
set { period = Math.Max(1, value); }
}
#endregion
}
}
Please sign in to leave a comment.
Comments
0 comments