Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

triangles arent plotting

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

    triangles arent plotting

    i cant get the triangle to plot when cond 1 is met for the ES.
    i know the private int myInput0 = 1;is not needed but the wizard inserted it so i left it in.

    HTML Code:
    #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>
    /// Setups for framing
    /// </summary>
    [Description("Setups for framing")]
    public class TwentyOneMinFraming : Indicator
    {
    #region Variables
    // Wizard generated variables
    private int myInput0 = 1;
    private int dist = 1; // Default setting for Dist 
     
    #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()
    {
     
    Overlay = true;
    PriceTypeSupported = false;
    }
    /// <summary>
    /// Called on each bar update event (incoming tick)
    /// </summary>
    protected override void OnBarUpdate()
    {
    // Condition set 1
    if (Low[2] <= Low[3]+.25
    && High[1] >= High[2]+.5
    && Low[0] > Low[1]-1.0);
    {
    DrawTriangleUp("My triangle up" + CurrentBar, false, 0, Low[0]- (TickSize*dist), Color.Lime);
    }
    }
     
    #region Properties
    [Browsable(false)] // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
    [XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
    public DataSeries Plot0
    {
    get { return Values[0]; }
    }
    [Description("")]
    [Category("Parameters")]
    public int MyInput0
    {
    get { return myInput0; }
    set { myInput0 = Math.Max(1, value); }
    }
    [Description("Tick dist from hi or low")]
    [Category("Parameters")]
    public int Dist
    {
    get { return dist; }
    set { dist = 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 TwentyOneMinFraming[] cacheTwentyOneMinFraming = null;
    private static TwentyOneMinFraming checkTwentyOneMinFraming = new TwentyOneMinFraming();
    /// <summary>
    /// Setups for framing
    /// </summary>
    /// <returns></returns>
    public TwentyOneMinFraming TwentyOneMinFraming(int dist, int myInput0)
    {
    return TwentyOneMinFraming(Input, dist, myInput0);
    }
    /// <summary>
    /// Setups for framing
    /// </summary>
    /// <returns></returns>
    public TwentyOneMinFraming TwentyOneMinFraming(Data.IDataSeries input, int dist, int myInput0)
    {
    checkTwentyOneMinFraming.Dist = dist;
    dist = checkTwentyOneMinFraming.Dist;
    checkTwentyOneMinFraming.MyInput0 = myInput0;
    myInput0 = checkTwentyOneMinFraming.MyInput0;
    if (cacheTwentyOneMinFraming != null)
    for (int idx = 0; idx < cacheTwentyOneMinFraming.Length; idx++)
    if (cacheTwentyOneMinFraming[idx].Dist == dist && cacheTwentyOneMinFraming[idx].MyInput0 == myInput0 && cacheTwentyOneMinFraming[idx].EqualsInput(input))
    return cacheTwentyOneMinFraming[idx];
    TwentyOneMinFraming indicator = new TwentyOneMinFraming();
    indicator.BarsRequired = BarsRequired;
    indicator.CalculateOnBarClose = CalculateOnBarClose;
    indicator.Input = input;
    indicator.Dist = dist;
    indicator.MyInput0 = myInput0;
    indicator.SetUp();
    TwentyOneMinFraming[] tmp = new TwentyOneMinFraming[cacheTwentyOneMinFraming == null ? 1 : cacheTwentyOneMinFraming.Length + 1];
    if (cacheTwentyOneMinFraming != null)
    cacheTwentyOneMinFraming.CopyTo(tmp, 0);
    tmp[tmp.Length - 1] = indicator;
    cacheTwentyOneMinFraming = tmp;
    Indicators.Add(indicator);
    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>
    /// Setups for framing
    /// </summary>
    /// <returns></returns>
    [Gui.Design.WizardCondition("Indicator")]
    public Indicator.TwentyOneMinFraming TwentyOneMinFraming(int dist, int myInput0)
    {
    return _indicator.TwentyOneMinFraming(Input, dist, myInput0);
    }
    /// <summary>
    /// Setups for framing
    /// </summary>
    /// <returns></returns>
    public Indicator.TwentyOneMinFraming TwentyOneMinFraming(Data.IDataSeries input, int dist, int myInput0)
    {
    return _indicator.TwentyOneMinFraming(input, dist, myInput0);
    }
    }
    }
    // This namespace holds all strategies and is required. Do not change it.
    namespace NinjaTrader.Strategy
    {
    public partial class Strategy : StrategyBase
    {
    /// <summary>
    /// Setups for framing
    /// </summary>
    /// <returns></returns>
    [Gui.Design.WizardCondition("Indicator")]
    public Indicator.TwentyOneMinFraming TwentyOneMinFraming(int dist, int myInput0)
    {
    return _indicator.TwentyOneMinFraming(Input, dist, myInput0);
    }
    /// <summary>
    /// Setups for framing
    /// </summary>
    /// <returns></returns>
    public Indicator.TwentyOneMinFraming TwentyOneMinFraming(Data.IDataSeries input, int dist, int myInput0)
    {
    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.TwentyOneMinFraming(input, dist, myInput0);
    }
    }
    }
    #endregion
    Last edited by simpletrades; 03-26-2010, 09:02 PM.

    #2
    Hi simpletrades,

    Try removing the semi-colon after the if statement conditions.

    A correct if statement looks like...

    Code:
    if (conditions)
    {
    do something;
    }
    TimNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Tim View Post
      Hi simpletrades,

      Try removing the semi-colon after the if statement conditions.

      A correct if statement looks like...

      Code:
      if (conditions)
      {
      do something;
      }
      DIDNT HELP.
      I even tried simplifying the condition to just this and still no arrow up.
      if (High[0]>=High[1]+.0)

      Comment


        #4
        Hi simpletrades,

        Please simply both the condition and the DrawUpArrow and test, if you are still not seeing it, please post the relevant portion of the code that you are trying.
        Last edited by NinjaTrader_Tim; 03-27-2010, 07:03 PM.
        TimNinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_Tim View Post
          Hi simpletrades,

          Please simply both the condition and the DrawUpArrow condtion and test, if you are still not seeing it, please post the relevant portion of the code that you are trying.
          the condition is simplified--i changed it to work if the current bar high>= the high 1 bar ago.

          how do i simplify the arrow?
          it is worded just like another that puts a dot when ema's cross except the dot is measured from the ema not the bar low.
          DrawDot("FasterEMA up" + CurrentBar, false, 0, MyEMAGreen[0]-(TickSize*dist), Color.Lime);
          and this one:
          DrawTriangleUp("My triangle up" + CurrentBar, false, 0, Low[0]- (TickSize*dist), Color.Lime)

          in both examples dist=1

          Comment


            #6
            Originally posted by NinjaTrader_Tim View Post
            Hi simpletrades,

            Please simply both the condition and the DrawUpArrow condtion and test, if you are still not seeing it, please post the relevant portion of the code that you are trying.
            could it have anything to do with this unused line left from the wizard in variables? and it's matching piece in properties?

            #region Variables
            // Wizard generated variables
            privateint myInput0 = 1;
            ************************************************** ******
            [Description("")]
            [Category(
            "Parameters")]
            publicint MyInput0
            {
            get { return myInput0; }
            set { myInput0 = Math.Max(1, value); }

            Comment


              #7
              Hi simpletrades,

              Please provide the code snippen for the most recent condition and action that you have tested.
              TimNinjaTrader Customer Service

              Comment


                #8
                Originally posted by NinjaTrader_Tim View Post
                Hi simpletrades,

                Please provide the code snippen for the most recent condition and action that you have tested.

                protectedoverridevoid OnBarUpdate()
                {
                // Condition set 1
                if (High[0]>=High[1]+.0)//test

                // if (Low[2] <= Low[3]+.25)
                // && High[1] >= High[2]+.5
                // && Low[0] > Low[1]-1.0)
                {
                DrawTriangleUp(
                "My triangle up" + CurrentBar, false, 0, Low[0]- (TickSize*dist), Color.Lime);
                }
                }

                is this what you mean? i left the original there, but '//' it out.

                Comment


                  #9
                  Hi,

                  It is likely that you are experiencing the issue discussed here...



                  Please check you log tab for the identifying error.
                  TimNinjaTrader Customer Service

                  Comment


                    #10
                    Originally posted by NinjaTrader_Tim View Post
                    Hi,

                    It is likely that you are experiencing the issue discussed here...



                    Please check you log tab for the identifying error.
                    i just looked that link over and if that were true, why did the ema i showed alongside my arrow up code draw a dot at the ema on the same chart with the same settings?

                    Comment


                      #11
                      Hi simpletrades,

                      Were the conditions exactly the same?

                      Please post that snippet.
                      TimNinjaTrader Customer Service

                      Comment


                        #12
                        Originally posted by NinjaTrader_Tim View Post
                        Hi simpletrades,

                        Were the conditions exactly the same?

                        Please post that snippet.
                        from my post #5 below

                        the condition is simplified--i changed it to draw if the current bar high>= the high 1 bar ago. but it doesnt do it.

                        how do i simplify the arrow?
                        it is worded just like another that puts a dot when ema's cross except the dot is measured from the ema not the bar low.
                        DrawDot("FasterEMA up" + CurrentBar, false, 0, MyEMAGreen[0]-(TickSize*dist), Color.Lime);
                        and this one:
                        DrawTriangleUp("My triangle up" + CurrentBar, false, 0, Low[0]- (TickSize*dist), Color.Lime)

                        in both examples dist=1

                        Comment


                          #13
                          Hi simpletrades,

                          For me to test this, please provide the exact code snippet.
                          TimNinjaTrader Customer Service

                          Comment


                            #14
                            Originally posted by NinjaTrader_Tim View Post
                            Hi simpletrades,

                            For me to test this, please provide the exact code snippet.
                            this is all of it. i am using the ES contract.

                            HTML Code:
                            #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>
                            /// Setups for framing
                            /// </summary>
                            [Description("Setups for framing")]
                            public class TwentyOneMinFraming : Indicator
                            {
                            #region Variables
                            // Wizard generated variables
                            private int myInput0 = 1;
                            private int dist = 1; // Default setting for Dist 
                            
                            #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()
                            {
                            
                            Overlay = true;
                            PriceTypeSupported = false;
                            }
                            /// <summary>
                            /// Called on each bar update event (incoming tick)
                            /// </summary>
                            protected override void OnBarUpdate()
                            {
                            // Condition set 1
                            if (High[0]>=High[1]+.0)//test
                            
                            // if (Low[2] <= Low[3]+.25)
                            // && High[1] >= High[2]+.5
                            // && Low[0] > Low[1]-1.0)
                            {
                            DrawTriangleUp("My triangle up" + CurrentBar, false, 0, Low[0]- (TickSize*dist), Color.Lime);
                            }
                            }
                            
                            #region Properties
                            [Browsable(false)] // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
                            [XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
                            public DataSeries Plot0
                            {
                            get { return Values[0]; }
                            }
                            [Description("")]
                            [Category("Parameters")]
                            public int MyInput0
                            {
                            get { return myInput0; }
                            set { myInput0 = Math.Max(1, value); }
                            }
                            [Description("Tick dist from hi or low")]
                            [Category("Parameters")]
                            public int Dist
                            {
                            get { return dist; }
                            set { dist = 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 TwentyOneMinFraming[] cacheTwentyOneMinFraming = null;
                            private static TwentyOneMinFraming checkTwentyOneMinFraming = new TwentyOneMinFraming();
                            /// <summary>
                            /// Setups for framing
                            /// </summary>
                            /// <returns></returns>
                            public TwentyOneMinFraming TwentyOneMinFraming(int dist, int myInput0)
                            {
                            return TwentyOneMinFraming(Input, dist, myInput0);
                            }
                            /// <summary>
                            /// Setups for framing
                            /// </summary>
                            /// <returns></returns>
                            public TwentyOneMinFraming TwentyOneMinFraming(Data.IDataSeries input, int dist, int myInput0)
                            {
                            checkTwentyOneMinFraming.Dist = dist;
                            dist = checkTwentyOneMinFraming.Dist;
                            checkTwentyOneMinFraming.MyInput0 = myInput0;
                            myInput0 = checkTwentyOneMinFraming.MyInput0;
                            if (cacheTwentyOneMinFraming != null)
                            for (int idx = 0; idx < cacheTwentyOneMinFraming.Length; idx++)
                            if (cacheTwentyOneMinFraming[idx].Dist == dist && cacheTwentyOneMinFraming[idx].MyInput0 == myInput0 && cacheTwentyOneMinFraming[idx].EqualsInput(input))
                            return cacheTwentyOneMinFraming[idx];
                            TwentyOneMinFraming indicator = new TwentyOneMinFraming();
                            indicator.BarsRequired = BarsRequired;
                            indicator.CalculateOnBarClose = CalculateOnBarClose;
                            indicator.Input = input;
                            indicator.Dist = dist;
                            indicator.MyInput0 = myInput0;
                            indicator.SetUp();
                            TwentyOneMinFraming[] tmp = new TwentyOneMinFraming[cacheTwentyOneMinFraming == null ? 1 : cacheTwentyOneMinFraming.Length + 1];
                            if (cacheTwentyOneMinFraming != null)
                            cacheTwentyOneMinFraming.CopyTo(tmp, 0);
                            tmp[tmp.Length - 1] = indicator;
                            cacheTwentyOneMinFraming = tmp;
                            Indicators.Add(indicator);
                            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>
                            /// Setups for framing
                            /// </summary>
                            /// <returns></returns>
                            [Gui.Design.WizardCondition("Indicator")]
                            public Indicator.TwentyOneMinFraming TwentyOneMinFraming(int dist, int myInput0)
                            {
                            return _indicator.TwentyOneMinFraming(Input, dist, myInput0);
                            }
                            /// <summary>
                            /// Setups for framing
                            /// </summary>
                            /// <returns></returns>
                            public Indicator.TwentyOneMinFraming TwentyOneMinFraming(Data.IDataSeries input, int dist, int myInput0)
                            {
                            return _indicator.TwentyOneMinFraming(input, dist, myInput0);
                            }
                            }
                            }
                            // This namespace holds all strategies and is required. Do not change it.
                            namespace NinjaTrader.Strategy
                            {
                            public partial class Strategy : StrategyBase
                            {
                            /// <summary>
                            /// Setups for framing
                            /// </summary>
                            /// <returns></returns>
                            [Gui.Design.WizardCondition("Indicator")]
                            public Indicator.TwentyOneMinFraming TwentyOneMinFraming(int dist, int myInput0)
                            {
                            return _indicator.TwentyOneMinFraming(Input, dist, myInput0);
                            }
                            /// <summary>
                            /// Setups for framing
                            /// </summary>
                            /// <returns></returns>
                            public Indicator.TwentyOneMinFraming TwentyOneMinFraming(Data.IDataSeries input, int dist, int myInput0)
                            {
                            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.TwentyOneMinFraming(input, dist, myInput0);
                            }
                            }
                            }
                            #endregion

                            Comment


                              #15
                              i just tried your suggestion in post 10.

                              i added this
                              if (CurrentBar < 1)
                              return;

                              this made the simplified line work when the current bar was higher than the prior bar, but when i deleted that sample line and reinserted my real 3 parts of condition 1, it didnt work.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by bortz, 11-06-2023, 08:04 AM
                              47 responses
                              1,607 views
                              0 likes
                              Last Post aligator  
                              Started by jaybedreamin, Today, 05:56 PM
                              0 responses
                              9 views
                              0 likes
                              Last Post jaybedreamin  
                              Started by DJ888, 04-16-2024, 06:09 PM
                              6 responses
                              19 views
                              0 likes
                              Last Post DJ888
                              by DJ888
                               
                              Started by Jon17, Today, 04:33 PM
                              0 responses
                              6 views
                              0 likes
                              Last Post Jon17
                              by Jon17
                               
                              Started by Javierw.ok, Today, 04:12 PM
                              0 responses
                              15 views
                              0 likes
                              Last Post Javierw.ok  
                              Working...
                              X