• 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

Low[0] High[0] input issue

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

    Low[0] High[0] input issue

    Hello,
    I've created an indicator that prints a line on the chart when certain conditions are met. The input for the line is Low[0]. For some reason, at certain times the line is being printed at the High[0]. Can someone please take a look at my code. I believe the issue is with the other indicator that I've created to use as a condition, but I can't figure out why that would change the input from Low to High.
    Thanks.
    Code:
    #region Variables
            private int triggerBar1 = -1;
            private int entryKillBar1 = -1;
            private double plotValue1 = 0;
            #endregion
    Code:
    protected override void Initialize()
            {
                Add(new Plot(Color.FromKnownColor(KnownColor.Red), PlotStyle.Line, "Low"));
                Overlay                = true;
            }
    Code:
    if(CurrentBar < 2)
                    return;
                
                double line_Prev = WilliamsR(RMI(BOP  (Close,10),14,3),8)[1];
                double line_Current = WilliamsR(RMI(BOP  (Close,10),14,3),8)[0];
                
                            
                if(line_Prev == 0 && line_Current < 0)
                {
                    this.triggerBar1 = CurrentBar;
                    this.entryKillBar1 = CurrentBar + 25;
                    this.plotValue1 = Low[0];
                    
                }
                
                 
                if (CurrentBar == this.entryKillBar1 + 1)
                {
                    this.triggerBar1 = -1;
                    this.entryKillBar1 = -1; 
                }    
                
            if (CurrentBar > this.triggerBar1 && CurrentBar <= this.entryKillBar1)
                {
                    Low.Set(this.plotValue1);
                    Print(Time[0]);
                    Print(Low[0]);
                    
                }
                else
                {
                    Low.Reset();
                }
    Attached Files

    #2
    Hello CaptainAmericaXX,

    Thank you for your inquiry.

    Was it intentional to set Low to "this.plotValue1" inside of your "if (CurrentBar > this.triggerBar1 && CurrentBar <= this.entryKillBar1)" conditional?

    You should not modify the Low DataSeries as this holds a collection of historical bar low prices.

    Please, let us know if we may be of further assistance.
    Zachary G.NinjaTrader Customer Service

    Comment


      #3
      ZacharyG,
      Thank you for catching that error. Unfortunately that didn't solve this particular issue. Do you have any other thoughts on the matter?

      Comment


        #4
        Hello CaptainAmericaXX,

        I would suggest using Print() statements to check if you are getting expected values or not for your values. This can help narrow down what's going on and from there allow you to debug further.

        Here is a helpful link from the tips section of our support forum that details more about debugging: http://ninjatrader.com/support/forum...58&postcount=1

        Please, let me know if I can be of further assistance.
        Zachary G.NinjaTrader Customer Service

        Comment


          #5
          ZacharyG,
          Thanks for your reply. Before I started this thread I did do as you are suggesting and got the same results as this time. For some reason some of the Lows are printing as Highs.
          Here is the code.
          Code:
           if (CurrentBar > this.triggerBar1 && CurrentBar <= this.entryKillBar1)
                      {
                          Low.Set(plotValue1);//Green
                          Print(Time[0]);
                          Print(Low[0]);
                          
                      }
          Here is what the output window shows at the time of this particular instance.
          Code:
          9/2/2015 11:12:47 AM
          9/2/2015 11:15:07 AM
          110.9
          According to the Data Box the Low of that bar should be 110.7.

          I really do appreciate your help on this. That's about the extent of my debugging knowledge.
          Thanks
          Attached Files

          Comment


            #6
            Hello CaptainAmericaXX,

            In the code you have provided me in your previous post, it still looks like you are assigning the Low collection to a value. This will modify your Low values.

            I would suggest changing the name of your DataSeries from Low to something else so it will not conflict with the existing Low DataSeries, which holds a collection of historical low prices.

            Please comment out this line of code:
            Code:
            Low.Set(plotValue1);
            Do you experience the same?

            I would suggest reading this section in the help guide for more information about developing indicators: http://ninjatrader.com/support/helpG...indicators.htm

            Please, let us know if we may be of further assistance.
            Zachary G.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by psquare, Today, 03:11 PM
            4 responses
            16 views
            0 likes
            Last Post psquare
            by psquare
             
            Started by ballboy11, Today, 03:20 PM
            1 response
            12 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by tonynt, Today, 02:18 PM
            1 response
            10 views
            0 likes
            Last Post NinjaTrader_JoshG  
            Started by denalek2419, Today, 01:46 PM
            3 responses
            12 views
            0 likes
            Last Post NinjaTrader_ChristopherJ  
            Started by REI140205, Today, 12:58 PM
            1 response
            11 views
            0 likes
            Last Post NinjaTrader_Jim  
            Working...
            X