• 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

    bool statement

    I have a 3rd party indicator with locked code but gives us functions for us to make our own indicators and strategies.

    One such function looks like this: ThirdPartyInd.Test[barsAgo]. This paints the bar a certain color based on the value created in the 3rd party indicator. I do not have access to this value or code.

    What I want to do is put this function in an IF bool statement. Something like:

    if (CurrentBars[0] == ThirdPartyInd.Test[0]
    { DrawText(etc......)}

    This IF statement does not work, but I think you see what I'm trying to say.

    I'd appreciate any advice.
    Thank you.

    #2
    Originally posted by imalil View Post
    I have a 3rd party indicator with locked code but gives us functions for us to make our own indicators and strategies.

    One such function looks like this: ThirdPartyInd.Test[barsAgo]. This paints the bar a certain color based on the value created in the 3rd party indicator. I do not have access to this value or code.

    What I want to do is put this function in an IF bool statement. Something like:

    if (CurrentBars[0] == ThirdPartyInd.Test[0]
    { DrawText(etc......)}

    This IF statement does not work, but I think you see what I'm trying to say.

    I'd appreciate any advice.
    Thank you.
    Try examining ThirdPartyInd.Test[0] with a Print() statement to the OutputWindow.

    What does: " This IF statement does not work" mean? What happens? Error message? When?

    Comment


      #3
      Hello,
      In addition to what Koganam has asked, please advise the following:
      Can you provide exactly what you are trying to compare with your If statement?
      Cody B.NinjaTrader Customer Service

      Comment


        #4
        I can't print because I keep getting compile errors: CS0119, "not valid in given context". Then when I try to make a variable I get CS1002, 0270, 1519. I'm clearly missing a crucial step.

        I'll try to be clearer by giving you a conceptual example since I can't see the code: the 3rd party ind will look at volume. Let's say it gets 100 for the current bar. The ThirdPartyInd.Test[0] function says 'if current bar volume > 50, then paint the bar pink.'

        So what I'm trying to do: if the current bar == ThirdPartyInd.Test[0], (meaning "if the current bar has volume > 50"), then my ind will print its results via drawtext.

        I realize my logic is way off on this, but I do know many people use these functions to add to their own inds and strategies. That is what I'm trying to do.

        Thanks for the help.

        Comment


          #5
          Originally posted by imalil View Post
          I can't print because I keep getting compile errors: CS0119, "not valid in given context". Then when I try to make a variable I get CS1002, 0270, 1519. I'm clearly missing a crucial step.

          I'll try to be clearer by giving you a conceptual example since I can't see the code: the 3rd party ind will look at volume. Let's say it gets 100 for the current bar. The ThirdPartyInd.Test[0] function says 'if current bar volume > 50, then paint the bar pink.'

          So what I'm trying to do: if the current bar == ThirdPartyInd.Test[0], (meaning "if the current bar has volume > 50"), then my ind will print its results via drawtext.

          I realize my logic is way off on this, but I do know many people use these functions to add to their own inds and strategies. That is what I'm trying to do.

          Thanks for the help.
          To help resolve those kind of errors we have to see the actual lines that you are writing. You can, of course, hide the real name and call to the third-party indicator, but we do have to see the actual syntax of your lines.

          Comment


            #6
            Hello,
            As Koganam says it would be very useful if we can see what code you are writing exactly so that we can assist further as this is most likely an issue with the syntax.
            I do just want to clarify that CurrentBar returns the number of the bar from the first bar being 0 and and each subsequent bar from left to right is incremented by 1.
            If you are wanting you get the Volume you would need to use the Volume method. For example if you wanted to check if the Volume of the current bar is greater than 100 you would do the following:

            Code:
             if(VOL()[0] > 100)
            {
                //Do Something
            }
            For more information on CurrentBar property please see the following link: http://ninjatrader.com/support/helpG...currentbar.htm

            For more information on the Volume method please see the following link: http://ninjatrader.com/support/helpG...oscillator.htm
            Cody B.NinjaTrader Customer Service

            Comment


              #7
              There's no doubt it's a syntax or logic problem on my part. The error I get on the IF statement line is CS0119. This is the first time I've tried to use a function from another ind. in my ind.

              if (CurrentBars[0] == ThirdPartyInd.Test[0] && + imbalance > Buyimbal)
              { DrawText("imbalance" + CurrentBar, AutoScale, (+ imbalance).ToString(), 0, Low[0], -47,
              Color.Pink, ChartControl.Font, StringAlignment.Center, Color.Transparent, Color.Transparent, 0);
              DrawText("AvgTradeSize" + CurrentBar, AutoScale, (String.Format("{0:0.0}", avgtradesize)), 0, Low[0], -64,
              Color.DodgerBlue, ChartControl.Font, StringAlignment.Center, Color.Transparent, Color.Transparent, 0);}
              Thanks for the help.

              Comment


                #8
                if (CurrentBars[0] == ThirdPartyInd.Test[0] && + imbalance > Buyimbal)
                What is in red is almost certainly a logic error that will never be true. CurrentBars[0] is an int; ThirdPartyInd.Test[0] is a double.
                What is in blue simply is a syntax error. What are you even trying to say there?

                Comment


                  #9
                  Hello,
                  As Koganam has outlined CurrentBars[0] == ThirdParty.Test[0] is indeed a logic error.
                  Can you clarify what you are trying to call with CurrentBars[0] as it is likely you need to call something else here.

                  &&+ is not an operator. Can you clarify what you are trying to call here as well?

                  I look forward to your reply.
                  Cody B.NinjaTrader Customer Service

                  Comment


                    #10
                    Originally posted by NinjaTrader_CodyB View Post
                    Hello,
                    As Koganam has outlined CurrentBars[0] == ThirdParty.Test[0] is indeed a logic error.
                    Can you clarify what you are trying to call with CurrentBars[0] as it is likely you need to call something else here.

                    &&+ is not an operator. Can you clarify what you are trying to call here as well?

                    I look forward to your reply.
                    Can you link me something that explains what something like ThirdParty.Test[0] is? What tells you this is a double? I don't know enough about it to ask a clear question.

                    Thanks.

                    Comment


                      #11
                      Hello,
                      I do not have a link on information on ThirdPartyIndicator.Test as this is a custom method from the third party product. Koganam may be able to elaborate on how he deduced it is double. It is likely that it is a double as most indicator methods return a variable. To get the best information on this you will need to contact the vendor though so they can elaborate on their custom method.
                      Cody B.NinjaTrader Customer Service

                      Comment


                        #12
                        Originally posted by imalil View Post
                        Can you link me something that explains what something like ThirdParty.Test[0] is? What tells you this is a double? I don't know enough about it to ask a clear question.

                        Thanks.
                        I deduce that ThirdParty.Test[0] is most likely a double because the variable is indexed, implying that it belongs to some kind of "collection/NT series". Very few developers expose an IntSeries rather than a Plot. All Plots would be made of doubles by definition. This was reinforced by the questions that you are asking. Basically, given the level of ability exposed by your questions, if you can manage to reference it, it is most likely to be a Plot, rather than an IntSeries, which takes a better understanding, to be able to access.

                        Why I know that it is probably a logic error is simply from what CurrentBars[0] portends arithmetically. It is a monotonically increasing value with no real upper limit. Hence, we deduce that it is unlikely that any Plot will manage to reach the upper values of CurrentBars[0], at which time, your filter will always return false. A filter that will get pinned probably is a logic error, as, as soon as it gets pinned, it ceases to be a filter.

                        Comment


                          #13
                          Originally posted by NinjaTrader_CodyB View Post
                          Hello,
                          I do not have a link on information on ThirdPartyIndicator.Test as this is a custom method from the third party product. Koganam may be able to elaborate on how he deduced it is double. It is likely that it is a double as most indicator methods return a variable. To get the best information on this you will need to contact the vendor though so they can elaborate on their custom method.
                          Please don't misunderstand, I'm not asking for an explanation on ThirdPartyIndicator.Test, which is impossible for you to do, I'm asking for an explanation about its type. As Koganam says: "if you can manage to reference it, it is most likely to be a Plot, rather than an IntSeries". I'm asking for a way to research referencing a plot from a 3rd party ind. I know other inds supply such functions, so there must be, generally speaking, a recognized protocol or way to incorporate them in an ind. I simply want to educate myself on how this is done.

                          Thank you.

                          Comment


                            #14
                            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
                            Cody B.NinjaTrader Customer Service

                            Comment


                              #15
                              Originally posted by imalil View Post
                              Please don't misunderstand, I'm not asking for an explanation on ThirdPartyIndicator.Test, which is impossible for you to do, I'm asking for an explanation about its type. As Koganam says: "if you can manage to reference it, it is most likely to be a Plot, rather than an IntSeries". I'm asking for a way to research referencing a plot from a 3rd party ind. I know other inds supply such functions, so there must be, generally speaking, a recognized protocol or way to incorporate them in an ind. I simply want to educate myself on how this is done.

                              Thank you.
                              Your question translates to: "How do I reference the properties or methods of an object?

                              Ultimately, to reference anything from an object, that object needs to expose that entity for public access. There are more restrictive access methods, between private and public, that may be used, but public is the level most often used. You will have to read the literature on OOP principles.

                              Here is one reference: https://www.google.com/search?q=c%23...utf-8&oe=utf-8

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by njesopawt, Today, 11:32 PM
                              0 responses
                              2 views
                              0 likes
                              Last Post njesopawt  
                              Started by iceman2018, Today, 09:56 PM
                              2 responses
                              10 views
                              0 likes
                              Last Post samir
                              by samir
                               
                              Started by [email protected], Today, 10:13 PM
                              0 responses
                              4 views
                              0 likes
                              Last Post garzon.javier.e@gmail.com  
                              Started by iceman2018, Today, 09:51 PM
                              0 responses
                              5 views
                              0 likes
                              Last Post iceman2018  
                              Started by n8dogg59, Today, 06:55 AM
                              2 responses
                              18 views
                              0 likes
                              Last Post n8dogg59  
                              Working...
                              X