• 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

bool statement

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

    #16
    Originally posted by NinjaTrader_CodyB View Post
    Hello,
    Referencing parts of an indicator really depend on how the indicator is set up. There is not a general protocol for this though. It depends on if the indicator has the plots exposed,if the indicator has multiple plots, and how the overload methods are set up for this. I highly recommend that you contact the third party vendor on how you can call this indicator and its overload methods in NinjaTrader. If you would like to learn more on calling indicators in general I'd recommend to take a look at the indicator methods section of the help guide: http://ninjatrader.com/support/helpG...indicators.htm
    Okay, thanks. Tell me if this is possible: (the function paints the bar a specific color for a specific reason; the bars will never be painted this color unless this reason is true.) Can I, therefore, say 'if the current bar is Pink, then DrawText.....'? Is this possible?

    Thank you.

    Comment


      #17
      Hello,
      Yes you could do this by checking the BarColorSeries property. For example:
      Code:
      if(BarColorSeries == Color.Pink)
      {
          //DO Something
      }
      For more information on BarColorSeries please see the following link: http://ninjatrader.com/support/helpG...olorseries.htm
      Cody B.NinjaTrader Customer Service

      Comment


        #18
        Originally posted by NinjaTrader_CodyB View Post
        Hello,
        Yes you could do this by checking the BarColorSeries property. For example:
        Code:
        if(BarColorSeries == Color.Pink)
        {
            //DO Something
        }
        For more information on BarColorSeries please see the following link: http://ninjatrader.com/support/helpG...olorseries.htm
        Thank you, on the right track, but getting error code CS0019. "== cannot be applied....ninja.data.colorseries' and 'system.drawing.color

        Comment


          #19
          Looks like [0] fixed it.

          Comment


            #20
            Thanks. I incorporated the BarColorSeries into my indicator and it's not recognizing it. For example, I'm doing this:

            if (BarColorSeries[0] == Color.DodgerBlue && + imbalance >= 1)
            { DrawText.....}

            My indicator results are printing as if this statement were not there. I have many IF statements before my DrawText commands. For those bars that are not DodgerBlue I've included:

            if (BarColorSeries[0] != Color.DodgerBlue && + imbalance >......
            It compiles fine and there are no conflicts in commands, it is just behaving as if the BarColorSeries command is not there.

            Do you have any Idea what I'm doing wrong?
            Thank you for the help.

            Comment


              #21
              Hello,
              To debug this I would recommend to print out the BarColorSeries to view what color it is set to when you are expecting it to be DodgerBlue in addition to the Time to verify these are working as expected.
              Code:
              Print(BarColorSeries[0] + Time[0]);
              Cody B.NinjaTrader Customer Service

              Comment


                #22
                I'm printing this:

                Print(BarColorSeries[0].ToString());
                Print(ToTime(Time[0]));
                The time is correct, but for the color I get [empty].

                I'm trying to find the error. If you have any ideas let me know.
                Thank you.

                Comment


                  #23
                  Hello,
                  Please provide the snippet of your code where you are setting the BarColorSeries so I may assist further.
                  Cody B.NinjaTrader Customer Service

                  Comment


                    #24
                    Here's a print statement:

                    if (BarColorSeries[0] == Color.DodgerBlue && + imbalance >= 1)
                    { DrawText("imbalance" + CurrentBar, AutoScale, (+ imbalance).ToString(), 0, Low[0], -(placementimballevel), Color.Pink, ChartControl.Font, StringAlignment.Center, Color.Transparent, Color.Transparent, 0);}
                    Print(BarColorSeries[0].ToString());
                    Print(ToTime(Time[0]));

                    Comment


                      #25
                      Hello,
                      This snippet does not seem to be setting the BarColorSeries.
                      Where in your code are you setting the BarColorSeries?
                      I look forward to your reply.
                      Cody B.NinjaTrader Customer Service

                      Comment


                        #26
                        Originally posted by NinjaTrader_CodyB View Post
                        Hello,
                        This snippet does not seem to be setting the BarColorSeries.
                        Where in your code are you setting the BarColorSeries?
                        I look forward to your reply.
                        I do not know how to answer your question as of right now.
                        Could you please give me an example of setting the BarColorSeries? For example, the syntax and where in the code--OnBarUpdate, I assume--it goes.

                        Thank you.

                        Comment


                          #27
                          Hello,
                          Yes you could set the BarColorSeries in the OnBarUpdate() method.
                          See below for an example of setting the BarColorSeries:

                          Code:
                          protected override void OnBarUpdate()
                          {
                              if(/* Condition for when you want to set the BarColorSeries */)
                              {
                                   BarColorSeries[0] = Color.DodgerBlue;
                              }
                          
                          }
                          Please see the following link on BarColorSeries: http://ninjatrader.com/support/helpG...olorseries.htm
                          Cody B.NinjaTrader Customer Service

                          Comment


                            #28
                            I understand what you're saying, but I'm using a 3rd party indicator which determines the condition that makes the bar DodgerBlue. I merely want to recognize if the bar is DodgerBlue, then, if it is, run my print statement.

                            Does this make sense?

                            Thanks.

                            Comment


                              #29
                              Originally posted by imalil View Post
                              I understand what you're saying, but I'm using a 3rd party indicator which determines the condition that makes the bar DodgerBlue. I merely want to recognize if the bar is DodgerBlue, then, if it is, run my print statement.

                              Does this make sense?

                              Thanks.
                              Then you need to be accessing the BarColorSeries of that indicator, not of the containing class.
                              Code:
                              ThirdPartyInd.BarColorSeries[0]

                              Comment


                                #30
                                The developer of my 3rd party indicators sent me this:

                                "All values are public IntSeries or public BoolSeries. BoolSeries gives True or False
                                values. Bullish signals generate values of +1; Bearish signals generate values of -1."

                                He is not in the business of selling indicators so he will not spent a lot of time with me.

                                Does this help your understanding of how I can access their values?

                                Thank you.

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by bomanpbm, Today, 09:27 PM
                                0 responses
                                1 view
                                0 likes
                                Last Post bomanpbm  
                                Started by tgn55, Today, 08:47 AM
                                0 responses
                                8 views
                                0 likes
                                Last Post tgn55
                                by tgn55
                                 
                                Started by ballboy11, 05-04-2019, 10:26 AM
                                6 responses
                                58 views
                                0 likes
                                Last Post Kermit
                                by Kermit
                                 
                                Started by mrlucky1x, Yesterday, 10:01 PM
                                0 responses
                                15 views
                                0 likes
                                Last Post mrlucky1x  
                                Started by roger556, Yesterday, 09:22 PM
                                0 responses
                                8 views
                                0 likes
                                Last Post roger556  
                                Working...
                                X