Il s’agit du Multi Time Frame Moving Average, MTF SMA,EMA,WMA.
On peut donc mettre sur un même graphique des moyennes mobiles de différentes unités de temps si j’ai bien compris.
Je voulais donc savoir si on pouvait le convertir pour pro real time ?
Le code
#region Using declarations
using System;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Xml.Serialization;
using NinjaTrader.Data;
using NinjaTrader.Gui.Chart;
#endregion
#region NinjaScript generated code. Neither change nor remove.
// This namespace holds all indicators and is required. Do not change it.
namespace NinjaTrader.Indicator
{
public partial class Indicator : IndicatorBase
{
private MAMTF[] cacheMAMTF = null;
private static MAMTF checkMAMTF = new MAMTF();
/// <summary>
/// Multi time frames Moving averages, custom indicators by Patternsmart.com
/// </summary>
/// <returns></returns>
public MAMTF MAMTF(int length, Aggregation1 timeframe, MAtype type)
{
return MAMTF(Input, length, timeframe, type);
}
/// <summary>
/// Multi time frames Moving averages, custom indicators by Patternsmart.com
/// </summary>
/// <returns></returns>
public MAMTF MAMTF(Data.IDataSeries input, int length, Aggregation1 timeframe, MAtype type)
{
if (cacheMAMTF != null)
for (int idx = 0; idx < cacheMAMTF.Length; idx++)
if (cacheMAMTF[idx].Length == length && cacheMAMTF[idx].Timeframe == timeframe && cacheMAMTF[idx].Type == type && cacheMAMTF[idx].EqualsInput(input))
return cacheMAMTF[idx];
lock (checkMAMTF)
{
checkMAMTF.Length = length;
length = checkMAMTF.Length;
checkMAMTF.Timeframe = timeframe;
timeframe = checkMAMTF.Timeframe;
checkMAMTF.Type = type;
type = checkMAMTF.Type;
if (cacheMAMTF != null)
for (int idx = 0; idx < cacheMAMTF.Length; idx++)
if (cacheMAMTF[idx].Length == length && cacheMAMTF[idx].Timeframe == timeframe && cacheMAMTF[idx].Type == type && cacheMAMTF[idx].EqualsInput(input))
return cacheMAMTF[idx];
MAMTF indicator = new MAMTF();
indicator.BarsRequired = BarsRequired;
indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
indicator.MaximumBarsLookBack = MaximumBarsLookBack;
#endif
indicator.Input = input;
indicator.Length = length;
indicator.Timeframe = timeframe;
indicator.Type = type;
Indicators.Add(indicator);
indicator.SetUp();
MAMTF[] tmp = new MAMTF[cacheMAMTF == null ? 1 : cacheMAMTF.Length + 1];
if (cacheMAMTF != null)
cacheMAMTF.CopyTo(tmp, 0);
tmp[tmp.Length - 1] = indicator;
cacheMAMTF = tmp;
return indicator;
}
}
}
}
// This namespace holds all market analyzer column definitions and is required. Do not change it.
namespace NinjaTrader.MarketAnalyzer
{
public partial class Column : ColumnBase
{
/// <summary>
/// Multi time frames Moving averages, custom indicators by Patternsmart.com
/// </summary>
/// <returns></returns>
[Gui.Design.WizardCondition("Indicator")]
public Indicator.MAMTF MAMTF(int length, Aggregation1 timeframe, MAtype type)
{
return _indicator.MAMTF(Input, length, timeframe, type);
}
/// <summary>
/// Multi time frames Moving averages, custom indicators by Patternsmart.com
/// </summary>
/// <returns></returns>
public Indicator.MAMTF MAMTF(Data.IDataSeries input, int length, Aggregation1 timeframe, MAtype type)
{
return _indicator.MAMTF(input, length, timeframe, type);
}
}
}
// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
public partial class Strategy : StrategyBase
{
/// <summary>
/// Multi time frames Moving averages, custom indicators by Patternsmart.com
/// </summary>
/// <returns></returns>
[Gui.Design.WizardCondition("Indicator")]
public Indicator.MAMTF MAMTF(int length, Aggregation1 timeframe, MAtype type)
{
return _indicator.MAMTF(Input, length, timeframe, type);
}
/// <summary>
/// Multi time frames Moving averages, custom indicators by Patternsmart.com
/// </summary>
/// <returns></returns>
public Indicator.MAMTF MAMTF(Data.IDataSeries input, int length, Aggregation1 timeframe, MAtype type)
{
if (InInitialize && input == null)
throw new ArgumentException("You only can access an indicator with the default input/bar series from within the 'Initialize()' method");
return _indicator.MAMTF(input, length, timeframe, type);
}
}
}
#endregion