• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Hma rising and falling arrows

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Hma rising and falling arrows

    Hi All, I am trying to put an arrow when the HMA changes color from red to green and green to red using the rising and falling. I'm using the HMA Code code below called the (HMA color change indicator) which changes the color of the HMA to green when rising and red when falling. I put in the following code but it inserts a number of arrows not just a single arrow when the HMA changed from falling to rising. I was able to do the arrows for SAR crossovers but not this one. Any ideas would be appreciated. Thanks. DJ

    1. My code

    // Condition set 1
    if (HMAColourChange(14).FallingPlot[0] < HMAColourChange(14).RisingPlot[1])
    {
    DrawArrowDown("My down arrow" + CurrentBar, false, 0, Close[0] + 20 * TickSize, Color.Red);
    }

    // Condition set 2
    if (HMAColourChange(14).RisingPlot[0] > HMAColourChange(14).FallingPlot[1])
    {
    DrawArrowUp("My up arrow" + CurrentBar, false, 0, Close[0] + -20 * TickSize, Color.Lime);
    }


    2. HMA Code


    //
    // Copyright (C) 2009, GreatTradingSystems <www.greattradingsystems.com>.
    //
    //
    #region Using declarations
    using System;
    using System.Diagnostics;
    using System.Drawing;
    using System.Drawing.Drawing2D;
    using System.ComponentModel;
    using System.Xml.Serialization;
    using NinjaTrader.Cbi;
    using NinjaTrader.Data;
    using NinjaTrader.Gui.Chart;
    #endregion

    // This namespace holds all indicators and is required. Do not change it.
    namespace NinjaTrader.Indicator
    {
    /// <summary>
    /// This is a sample indicator plotting a HMA in three colors.
    /// </summary>
    [Description("Sample HMA plotted with three colors.")]
    [Gui.Design.DisplayName("HMAColourChange")]
    public class HMAColourChange : Indicator
    {
    #region Variables
    private int period = 14;
    #endregion

    /// <summary>
    /// This method is used to configure the indicator and is called once before any bar data is loaded.
    /// </summary>
    protected override void Initialize()
    {
    // Add one plot for every color you wish to use.
    Add(new Plot(Color.LimeGreen, PlotStyle.Line, "Rising"));
    Add(new Plot(Color.Red, PlotStyle.Line, "Falling"));
    Add(new Plot(Color.Yellow, PlotStyle.Line, "Neutral"));

    CalculateOnBarClose = true;
    Overlay = true;
    }

    /// <summary>
    /// Called on each bar update event (incoming tick)
    /// </summary>
    protected override void OnBarUpdate()
    {
    // Checks to make sure we have at least 1 bar before continuing
    if (CurrentBar < 1)
    return;

    // Plot green if the HMA is rising
    // Rising() returns true when the current value is greater than the value of the previous bar.
    if (Rising(HMA(Period)))
    {
    // Connects the rising plot segment with the other plots
    RisingPlot.Set(1, HMA(Period)[1]);

    // Adds the new rising plot line segment to the line
    RisingPlot.Set(HMA(Period)[0]);
    }

    // Plot red if the HMA is falling
    // Falling() returns true when the current value is less than the value of the previous bar.
    else if (Falling(HMA(Period)))

    {
    // Connects the new falling plot segment with the rest of the line
    FallingPlot.Set(1, HMA(Period)[1]);


    // Adds the new falling plot line segment to the line
    FallingPlot.Set(HMA(Period)[0]);

    }

    // Plot yellow if the HMA is neutral
    else
    {
    // Connects the neutral plot segment with the rest of the line
    NeutralPlot.Set(1, HMA(Period)[1]);

    // Adds the new neutral plot line segment to the line
    NeutralPlot.Set(HMA(Period)[0]);

    #2
    Are there any errors in the log tab of your Control Center?

    Likely you miss a CurrentBars check at the start of your indicator's OnBarUpdate() -

    http://www.ninjatrader.com/support/f...ead.php?t=3170
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Hma

      Thanks Bertrand, well I'm not seeing any errors. I have attached a screenshot and the full code. You can see from the screenshot it is drawing multiple arrows I'm not exactly sure what that link you sent me is supposed to do because I never had to do it for the SAR crossover. I can only do very basic things at this point. I also tried crosses under or over instead of greater than or less than and still same problem. Thanks. DJ

      // This namespace holds all strategies and is required. Do not change it.
      namespace NinjaTrader.Strategy
      {
      /// <summary>
      /// Enter the description of your strategy here
      /// </summary>
      [Description("Enter the description of your strategy here")]
      public class HMAdj : Strategy
      {
      #region Variables
      // Wizard generated variables
      private int myInput0 = 1; // Default setting for MyInput0
      // 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 (HMAColourChange(14).FallingPlot[0] < HMAColourChange(14).RisingPlot[1])
      {
      DrawArrowDown("My down arrow" + CurrentBar, false, 0, Close[0] + 20 * TickSize, Color.Red);
      }

      // Condition set 2
      if (HMAColourChange(14).RisingPlot[0] > HMAColourChange(14).FallingPlot[1])
      {
      DrawArrowUp("My up arrow" + CurrentBar, false, 0, Close[0] + -20 * TickSize, Color.Lime);
      }
      }
      Attached Files

      Comment


        #4
        djkiwi, thanks for clarifying the issue, I see what you mean now - to resolve just access the HMA base indicator value directly -

        Code:
         
        // Condition set 1
        if (HMA(14)[0] < HMA(14)[1] && HMA(14)[1] > HMA(14)[2])
        {
        DrawArrowDown("My down arrow" + CurrentBar, false, 0, Close[0] + 20 * TickSize, Color.Red);
        }
        // Condition set 2
        if (HMA(14)[0] > HMA(14)[1] && HMA(14)[1] < HMA(14)[2])
        {
        DrawArrowUp("My up arrow" + CurrentBar, false, 0, Close[0] - 20 * TickSize, Color.Lime);
        }
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Hma

          Hi Bertrand still no luck with lots of iterations. Same problem with lots of arrows. So I tried to say rising and then close above the HMA and still doesnt work. Any other ideas? Thanks. DJ

          Here is the code and new image:

          [Description("Enter the description of your strategy here")]
          public class HMAdj : Strategy
          {
          #region Variables
          // Wizard generated variables
          private int myInput0 = 1; // Default setting for MyInput0
          // 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 (Falling(DefaultInput) == true
          && CrossBelow(Close, HMA(14), 1))
          {
          DrawArrowDown("My down arrow" + CurrentBar, false, 0, High[0] + 5 * TickSize, Color.Red);
          }

          // Condition set 2
          if (Rising(HMA(14)) == true
          && CrossAbove(Close, HMA(14), 1))
          {
          DrawArrowUp("My up arrow" + CurrentBar, false, 0, Low[0] + -5 * TickSize, Color.Lime);
          }

          DrawTriangleDown("My triangle down" + CurrentBar, false, 0, Low[0], Color.Red);
          }
          Attached Files

          Comment


            #6
            Sorry I don't follow you, with the code change I posted I get this result for example on the FDAX 7R chart, this looks like what you're after?
            Attached Files
            BertrandNinjaTrader Customer Service

            Comment


              #7
              Thanks Bertrand works perfectly! Greatly appreciate the help. I missed the code you typed.

              Cheers
              DJ

              Comment


                #8
                Swing highs and lows

                Hi Bertrand, I am trying to modify the strategy you helped me with to include swing lows and highs but does not seem to work. I am live trading with ninja 7 and would like to incorporate swing highs and lows in an automated strategy I'm working on. Basically it should short when the HMA crosses (5 as an example) AND the Closing bar once the cross occurs is below the last swing high as follows. I've used the following cde that you will see below:

                &&Close[0] < Swing(Swing1).SwingHighBar(0,2,100))

                The opposite for going long. The problem is it is basically ignoring the code and drawing an arrow wnytime the HMA crosses. Also the short signal is being ignored totally. I also tried it with this code and it didn't work either.

                && Swing(5).SwingHighBar(0,1,100) < Swing(5).SwingHighBar(0,2,100)

                I've attached a screenshot. I'm not sure why it is drawing the up arrows when it is clearly closing below a swing high or not drawing down arrows at all even though there are many instances that it is clearly above the last swing low. Any help on this one would be appreciated!

                Thanks
                DJ










                #region Using declarations
                using System;
                using System.ComponentModel;
                using System.Diagnostics;
                using System.Drawing;
                using System.Drawing.Drawing2D;
                using System.Xml.Serialization;
                using NinjaTrader.Cbi;
                using NinjaTrader.Data;
                using NinjaTrader.Indicator;
                using NinjaTrader.Gui.Chart;
                using NinjaTrader.Strategy;
                #endregion

                // This namespace holds all strategies and is required. Do not change it.
                namespace NinjaTrader.Strategy
                {
                /// <summary>
                /// Enter the description of your strategy here
                /// </summary>
                [Description("Enter the description of your strategy here")]
                public class swingdj : Strategy
                {

                #region Variables
                // Wizard generated variables
                private int h1 = 5; // Default setting for H1
                private int eMA1 = 10; // Default setting for EMA1
                private int eMA2 = 30; // Default setting for EMA2
                private int eMA3 = 10; // Default setting for EMA3
                private int target1 = 20; // Default setting for Target1
                private int target2 = 40; // Default setting for Target2
                private int target3 = 60; // Default setting for Target3
                private int trail = 15; // Default setting for Trail
                private int Swing1 = 5; // Default setting for Swing
                // 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()
                {
                SetProfitTarget("Short1", CalculationMode.Ticks, Target1);
                SetProfitTarget("Short2", CalculationMode.Ticks, Target2);
                SetProfitTarget("Short3", CalculationMode.Ticks, Target3);
                SetTrailStop("Short1", CalculationMode.Ticks, Trail, false);
                SetTrailStop("Short2", CalculationMode.Ticks, Trail, false);
                SetTrailStop("Short3", CalculationMode.Ticks, Trail, false);
                SetProfitTarget("Long1", CalculationMode.Ticks, Target1);
                SetProfitTarget("Long2", CalculationMode.Ticks, Target2);
                SetProfitTarget("Long3", CalculationMode.Ticks, Target3);
                SetTrailStop("Long1", CalculationMode.Ticks, Trail, false);
                SetTrailStop("Long2", CalculationMode.Ticks, Trail, false);
                SetTrailStop("Long3", CalculationMode.Ticks, Trail, false);

                CalculateOnBarClose = false;
                }

                /// <summary>
                /// Called on each bar update event (incoming tick)
                /// </summary>
                protected override void OnBarUpdate()
                {
                // Condition set 1
                if (HMA(H1)[0] < HMA(H1)[1]
                &&HMA(H1)[1] > HMA(H1)[2]
                &&Close[0] < Swing(Swing1).SwingHighBar(0,2,100))
                {
                DrawArrowDown("My down arrow" + CurrentBar, false, 0, High[0] + 15 * TickSize, Color.Red);
                Alert("MyAlert48", Priority.High, "", @"C:\Program Files\NinjaTrader 7\sounds\TNA below S2.wav", 60, Color.White, Color.Black);
                EnterShort(DefaultQuantity, "Short1");
                EnterShort(DefaultQuantity, "Short2");
                EnterShort(DefaultQuantity, "Short3");
                }

                // Condition set 2
                if (HMA(H1)[0] > HMA(H1)[1]
                &&HMA(H1)[1] < HMA(H1)[2]
                &&Close[0] > Swing(Swing1).SwingLowBar(0,2,100))
                {
                Alert("MyAlert49", Priority.High, "", @"C:\Program Files\NinjaTrader 7\sounds\TNA below S2.wav", 60, Color.White, Color.Black);
                DrawArrowUp("My up arrow" + CurrentBar, false, 0, Low[0] + -15 * TickSize, Color.Lime);
                EnterLong(DefaultQuantity, "Long1");
                EnterLong(DefaultQuantity, "Long2");
                EnterLong(DefaultQuantity, "Long3");
                }

                }
                #region Properties
                [Description("")]
                [GridCategory("Parameters")]
                public int H1
                {
                get { return h1; }
                set { h1 = Math.Max(1, value); }
                }

                [Description("")]
                [GridCategory("Parameters")]
                public int EMA1
                {
                get { return eMA1; }
                set { eMA1 = Math.Max(1, value); }
                }

                [Description("")]
                [GridCategory("Parameters")]
                public int EMA2
                {
                get { return eMA2; }
                set { eMA2 = Math.Max(1, value); }
                }

                [Description("")]
                [GridCategory("Parameters")]
                public int EMA3
                {
                get { return eMA3; }
                set { eMA3 = Math.Max(1, value); }
                }

                [Description("")]
                [GridCategory("Parameters")]
                public int Target1
                {
                get { return target1; }
                set { target1 = Math.Max(1, value); }
                }

                [Description("")]
                [GridCategory("Parameters")]
                public int Target2
                {
                get { return target2; }
                set { target2 = Math.Max(1, value); }
                }

                [Description("")]
                [GridCategory("Parameters")]
                public int Target3
                {
                get { return target3; }
                set { target3 = Math.Max(1, value); }
                }

                [Description("")]
                [GridCategory("Parameters")]
                public int Trail
                {
                get { return trail; }
                set { trail = Math.Max(1, value); }
                }


                #endregion
                }
                }
                Attached Files

                Comment


                  #9
                  DJ, what the Swing indicator offers programmatically is not the same as what it would show visually on the charts - it's more meant a visual decision support here showing the swing structure.

                  To understand the realtime behavior you would see, I suggest you start off by plotting the Swing High and Low values in an indicator.
                  BertrandNinjaTrader Customer Service

                  Comment


                    #10
                    Data issues

                    Thanks Bertand, I have found a work around. There is one real headache I was hoping you could help me with. When I log in to Interactive Brokers in the morning or at night I am always missing the day or overnight data on the charts (see attached screenshot).You will see I logged 11 pm on thhe 9th and to the left on the ES chart is the 8th of Sep and it then it starts the 9th from like 11 pm at night. I'm not sure why I have this problem with IB data not giving me the previous day/night data, maybe I have a setting wrong somewhere . So what I have to do every day is put in the free license key and log on to the demo of zenfire so it fills in the data that is missing then I have to put in the live license key and then log back into IB so IB can continue with the live feed and I can trade live. The other problem is I just downloaded the new v 21 software and now I get an error trying to log into zenfire (see attached screenshot error). Any ideas how to fix this problem with the IB data and any idea why it doesn't show up? Thanks. DJ
                    Attached Files
                    Last edited by djkiwi; 09-09-2010, 09:21 PM. Reason: FILE ADDED

                    Comment


                      #11
                      DJ, if you're using tick based chart intervals with IB, there's unfortunately no backfill for the time you're not connected live, as the connection does not provide this feature.

                      For the ZenFire issue in B21, please uninstall B21 from the Control Panel, delete the NT7 folder in Program Files on your harddrive and then reinstall it completely fresh - as this should clearup the issues you've ran into unfortunately.
                      BertrandNinjaTrader Customer Service

                      Comment


                        #12
                        Hi Bertrand, I have reinstalled and all ok now apart from the tick data issue which continues to be annoying. The solution would be to include my broker AMP as an option on my live trading connection tab but have it inactive for live trading(or active and I simply don't use it for trading). This would save the hassle having to log in and out of the demo/live trading account day in and day out. Another issue I'm grappling with is turning a strategy into an indicator. I have done this before but does not seem to work now. For example I have copied this code from a strategy and turned it into an indicator. Although there were no errors the arrows don't show up even though they show up when a strategy is run. Would be grateful if you could take a quick look on this one!

                        Thanks
                        DJ

                        #region Using declarations
                        using System;
                        using System.ComponentModel;
                        using System.Diagnostics;
                        using System.Drawing;
                        using System.Drawing.Drawing2D;
                        using System.Xml.Serialization;
                        using NinjaTrader.Cbi;
                        using NinjaTrader.Data;
                        using NinjaTrader.Gui.Chart;
                        #endregion

                        // This namespace holds all indicators and is required. Do not change it.
                        namespace NinjaTrader.Indicator
                        {
                        /// <summary>
                        /// Enter the description of your new custom indicator here
                        /// </summary>
                        [Description("Enter the description of your new custom indicator here")]
                        public class DJTF7 : Indicator
                        {

                        #region Variables
                        // Wizard generated variables
                        private int h1 = 5; // Default setting for H1
                        private int eMA1 = 10; // Default setting for EMA1
                        private int eMA2 = 20; // Default setting for EMA2
                        private int eMA3 = 50; // Default setting for EMA3
                        // 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 (HMA(H1)[0] < HMA(H1)[1]
                        && HMA(H1)[1] > HMA(H1)[2]
                        && EMA(EMA1)[0] < EMA(EMA2)[0]
                        && EMA(EMA2)[0] < EMA(EMA3)[0])
                        {
                        DrawArrowDown("My down arrow" + CurrentBar, false, 0, High[0] + 15 * TickSize, Color.Yellow);
                        }

                        // Condition set 2
                        if (HMA(H1)[0] > HMA(H1)[1]
                        && HMA(H1)[1] < HMA(H1)[2]
                        && EMA(EMA1)[0] > EMA(EMA2)[0]
                        && EMA(EMA2)[0] > EMA(EMA3)[0])
                        {
                        DrawArrowUp("My up arrow" + CurrentBar, false, 0, Low[0] + -15 * TickSize, Color.Yellow);
                        }
                        }

                        #region Properties
                        [Description("")]
                        [GridCategory("Parameters")]
                        public int H1
                        {
                        get { return h1; }
                        set { h1 = Math.Max(1, value); }
                        }

                        [Description("")]
                        [GridCategory("Parameters")]
                        public int EMA1
                        {
                        get { return eMA1; }
                        set { eMA1 = Math.Max(1, value); }
                        }

                        [Description("")]
                        [GridCategory("Parameters")]
                        public int EMA2
                        {
                        get { return eMA2; }
                        set { eMA2 = Math.Max(1, value); }
                        }

                        [Description("")]
                        [GridCategory("Parameters")]
                        public int EMA3
                        {
                        get { return eMA3; }
                        set { eMA3 = Math.Max(1, value); }
                        }
                        #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 DJTF7[] cacheDJTF7 = null;

                        private static DJTF7 checkDJTF7 = new DJTF7();

                        /// <summary>
                        /// Enter the description of your new custom indicator here
                        /// </summary>
                        /// <returns></returns>
                        public DJTF7 DJTF7(int eMA1, int eMA2, int eMA3, int h1)
                        {
                        return DJTF7(Input, eMA1, eMA2, eMA3, h1);
                        }

                        /// <summary>
                        /// Enter the description of your new custom indicator here
                        /// </summary>
                        /// <returns></returns>
                        public DJTF7 DJTF7(Data.IDataSeries input, int eMA1, int eMA2, int eMA3, int h1)
                        {
                        if (cacheDJTF7 != null)
                        for (int idx = 0; idx < cacheDJTF7.Length; idx++)
                        if (cacheDJTF7[idx].EMA1 == eMA1 && cacheDJTF7[idx].EMA2 == eMA2 && cacheDJTF7[idx].EMA3 == eMA3 && cacheDJTF7[idx].H1 == h1 && cacheDJTF7[idx].EqualsInput(input))
                        return cacheDJTF7[idx];

                        lock (checkDJTF7)
                        {
                        checkDJTF7.EMA1 = eMA1;
                        eMA1 = checkDJTF7.EMA1;
                        checkDJTF7.EMA2 = eMA2;
                        eMA2 = checkDJTF7.EMA2;
                        checkDJTF7.EMA3 = eMA3;
                        eMA3 = checkDJTF7.EMA3;
                        checkDJTF7.H1 = h1;
                        h1 = checkDJTF7.H1;

                        if (cacheDJTF7 != null)
                        for (int idx = 0; idx < cacheDJTF7.Length; idx++)
                        if (cacheDJTF7[idx].EMA1 == eMA1 && cacheDJTF7[idx].EMA2 == eMA2 && cacheDJTF7[idx].EMA3 == eMA3 && cacheDJTF7[idx].H1 == h1 && cacheDJTF7[idx].EqualsInput(input))
                        return cacheDJTF7[idx];

                        DJTF7 indicator = new DJTF7();
                        indicator.BarsRequired = BarsRequired;
                        indicator.CalculateOnBarClose = CalculateOnBarClose;
                        #if NT7
                        indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                        indicator.MaximumBarsLookBack = MaximumBarsLookBack;
                        #endif
                        indicator.Input = input;
                        indicator.EMA1 = eMA1;
                        indicator.EMA2 = eMA2;
                        indicator.EMA3 = eMA3;
                        indicator.H1 = h1;
                        Indicators.Add(indicator);
                        indicator.SetUp();

                        DJTF7[] tmp = new DJTF7[cacheDJTF7 == null ? 1 : cacheDJTF7.Length + 1];
                        if (cacheDJTF7 != null)
                        cacheDJTF7.CopyTo(tmp, 0);
                        tmp[tmp.Length - 1] = indicator;
                        cacheDJTF7 = 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>
                        /// Enter the description of your new custom indicator here
                        /// </summary>
                        /// <returns></returns>
                        [Gui.Design.WizardCondition("Indicator")]
                        public Indicator.DJTF7 DJTF7(int eMA1, int eMA2, int eMA3, int h1)
                        {
                        return _indicator.DJTF7(Input, eMA1, eMA2, eMA3, h1);
                        }

                        /// <summary>
                        /// Enter the description of your new custom indicator here
                        /// </summary>
                        /// <returns></returns>
                        public Indicator.DJTF7 DJTF7(Data.IDataSeries input, int eMA1, int eMA2, int eMA3, int h1)
                        {
                        return _indicator.DJTF7(input, eMA1, eMA2, eMA3, h1);
                        }
                        }
                        }

                        // This namespace holds all strategies and is required. Do not change it.
                        namespace NinjaTrader.Strategy
                        {
                        public partial class Strategy : StrategyBase
                        {
                        /// <summary>
                        /// Enter the description of your new custom indicator here
                        /// </summary>
                        /// <returns></returns>
                        [Gui.Design.WizardCondition("Indicator")]
                        public Indicator.DJTF7 DJTF7(int eMA1, int eMA2, int eMA3, int h1)
                        {
                        return _indicator.DJTF7(Input, eMA1, eMA2, eMA3, h1);
                        }

                        /// <summary>
                        /// Enter the description of your new custom indicator here
                        /// </summary>
                        /// <returns></returns>
                        public Indicator.DJTF7 DJTF7(Data.IDataSeries input, int eMA1, int eMA2, int eMA3, int h1)
                        {
                        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.DJTF7(input, eMA1, eMA2, eMA3, h1);
                        }
                        }
                        }
                        #endregion

                        Comment


                          #13
                          Hello djkiwiw,

                          You will want to be sure you have the CurrentBar check:

                          if (CurrentBar < 1)
                          return;


                          Make sure you have enough bars in the data series you are accessing
                          Ryan M.NinjaTrader Customer Service

                          Comment


                            #14
                            Current bar check

                            Hi Ryan, not sure what you mean about current bar check, where does that go in the code? Thanks. DJ

                            Comment


                              #15
                              Also this worked as a strategy without any problems. The problem appeared when I copied the code and turned it into an indicator.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by StevenNelson, Today, 04:07 PM
                              2 responses
                              7 views
                              0 likes
                              Last Post StevenNelson  
                              Started by Matthew Spositi, Today, 03:28 PM
                              2 responses
                              5 views
                              0 likes
                              Last Post Matthew Spositi  
                              Started by faisamtrader, Today, 01:30 PM
                              2 responses
                              19 views
                              0 likes
                              Last Post NinjaTrader_ChrisL  
                              Started by idangre, 12-08-2016, 10:37 AM
                              3 responses
                              546 views
                              0 likes
                              Last Post NinjaTrader_Kate  
                              Started by priceisking, Today, 11:30 AM
                              1 response
                              9 views
                              0 likes
                              Last Post NinjaTrader_Jesse  
                              Working...
                              X