Convertir un indicateur de Ninjatrader à Pro real time

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #71315 quote
    omegao
    Participant
    Average

    Bonjour,

    Je voulais savoir s’il était possible de convertir un indicateur de Ninjatrader langage cs en pro real time s’il vous plaît ?

    Merci

    #71318 quote
    Nicolas
    Keymaster
    Master

    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.

    #71320 quote
    omegao
    Participant
    Average

    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
    
    #71323 quote
    Nicolas
    Keymaster
    Master

    Non 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.

    #71326 quote
    omegao
    Participant
    Average

    C’est dommage, merci !

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.

Convertir un indicateur de Ninjatrader à Pro real time


ProBuilder : Indicateurs & Outils Personnalisés

New Reply
Author
author-avatar
omegao @omegao Participant
Summary

This topic contains 4 replies,
has 2 voices, and was last updated by omegao
7 years, 9 months ago.

Topic Details
Forum: ProBuilder : Indicateurs & Outils Personnalisés
Language: French
Started: 05/25/2018
Status: Active
Attachments: No files
Logo Logo
Loading...