Convertir un indicateur de Ninjatrader à Pro real time
Forums › ProRealTime forum Français › Support ProBuilder › Convertir un indicateur de Ninjatrader à Pro real time
- This topic has 4 replies, 2 voices, and was last updated 6 years ago by omegao.
-
-
05/25/2018 at 6:48 AM #7131505/25/2018 at 7:13 AM #71318
Oui cela est possible, sous certaines conditions toutefois. Difficile de répondre plus précisément sans avoir lu le code d’origine 🙂 Merci de partager le code source ici (si il n’est pas soumis à Copyright), avec une ou plusieurs copies d’écrans si possible, cela est fort utile pour mettre en concordance le code et le rendu final de l’indicateur.
05/25/2018 at 7:33 AM #71320Il 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
Multi time frame123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134#region Using declarationsusing 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 NT7indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;indicator.MaximumBarsLookBack = MaximumBarsLookBack;#endifindicator.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);}}}#endregion05/25/2018 at 8:04 AM #71323Non on ne pourra pas désolé. Ninjatrader utilise dans ce cas une fonction interne qui permet de connaître les données OHLC des autres timeframes et les injecte dans ses calculs de moyennes mobiles, cette fonctionnalité n’existe pas dans le langage ProBuilder.
05/25/2018 at 8:09 AM #71326 -
AuthorPosts
Find exclusive trading pro-tools on