• 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

Custom Swing High/Low Indicator Help

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

    Custom Swing High/Low Indicator Help

    Hi,

    I have a swing high/low indicator which plots a dot on swing points. Like the NinjaTrader indicator it allows the user to set the number of bars it will count before it plots a dot.

    However it does not draw a dot on the chart when there is a candlestick which is equally priced next to it. The reason the indicator doesn't mark it is because the bar is not the 'HIGHEST' bar within a certain range, it is one bar which is matched in price by another bar.

    I have taken a screenshot and annotated it to show the point.

    Is there a way somebody can modify the script to prevent this problem? I have a .cs file and a .dll file.

    Any help would be greatly appreciated.

    Kind regards.
    Attached Files

    #2
    Hello CTDavies,

    What is the condition statement that is drawing this dot?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_ChelseaB View Post
      Hello CTDavies,

      What is the condition statement that is drawing this dot?
      Hi, thanks for the fast reply. I have no experience with coding, so I'm not sure what you mean by condition statement.

      The conditions that should exist before it draws a dot are that there should be 3 bars either side of the dot which do not exceed the swing high or low of the bar with the dot on. This is the case if you set the strength to '3', which can be changed.

      Comment


        #4
        Hello CTDavies,

        Thank you for your response and welcome to the NinjaTrader Support Forum!

        We do not provide programming services for our users. However, you can provide the indicator .cs file (under (My) Documents\NinjaTrader 7\bin\Custom\Indicator on your computer) attached to your response and our community can take a look at the code and provide insight here.
        Patrick H.NinjaTrader Customer Service

        Comment


          #5
          In the context of the Swing indicator, what you are seeing is expected behavior.

          (But you're not asking about the Swing indicator, per se, you have some third-party provided swing-like indicator, with a .cs and .dll, you probably bought or downloaded it.)

          Discussing NinjaTrader's Swing indicator, here is the relevant code that determines the swing high,

          Code:
          bool isSwingHigh = true;
          double swingHighCandidateValue = (double) lastHighCache[strength];
          
          // examine bars to left of candidate
          for (int i=0; i < strength; i++)
              if ((double) lastHighCache[i] >= swingHighCandidateValue - double.Epsilon)
                 isSwingHigh = false;
          
          // examine bars to right of candidate
          for (int i=strength+1; i < lastHighCache.Count; i++)
              if ((double) lastHighCache[i] > swingHighCandidateValue - double.Epsilon)
                  isSwingHigh = false;
          Note how the code sets isSwingHigh to true. This is a common technique where a programmer starts with an assumption, and then writes code immediately following to check if that assumption should be reversed or cancelled.

          I bring your attention to the boolean operator in the 2nd and 3rd blocks of code. They are different, and this difference is critical. One uses >= operator and the other uses > operator.

          For a swing high of strength N, the code says N bars to left of the swing high candidate must all be less than the swing high. The intent of the code is: any left bar greater than or equal to the swing high candidate cancels that swing high.

          But, for the last 3 lines of code above, which checks the N bars to the right of the swing high, note how the comparison operator is different. This is a big deal.

          For those bars to the right, the code says that N bars to the right of the swing high candidate must all be less than or equal to the swing high. The intent of the code is to say: any right bar greater than the swing high candidate cancels that swing high ... but note how this also means that any right bar equal to the swing high candidate is ok.

          Since the comparison operator is not the same, the equal height of the left or right bars makes a difference when determining if a bar is a swing high or swing low.

          Swing High of N strength:
          for N bars to the left code uses >= operator to cancel (meaning N left bars must be < swing high)
          for N bars to the right code uses > operator to cancel (meaning N right bars must be <= swing high)

          The swing low is similar:

          Swing Low of N strength:
          for N bars to the left code uses <= operator to cancel (meaning N left bars must be > swing low)
          for N bars to the right code uses < operator to cancel (meaning N right bars must be >= swing low)

          This is how the Swing indicator is coded.
          Last edited by bltdavid; 03-16-2015, 06:24 PM. Reason: completely new, better wording

          Comment


            #6
            Originally posted by CTDavies View Post
            Is there a way somebody can modify the script to prevent this problem? I have a .cs file and a .dll file.
            I suspect the indicator you have is closed source. If that is the case, the answer is no.

            Most likely, the only somebody who can modify the indicator is the somebody who wrote the indicator and supplied you with the .dll.

            Did you buy this indicator? Have you inquired about the indicator's behavior with the vendor/supplier/programmer from where you got it?

            Comment


              #7
              Thank you to the NinjaTrader moderator for clarification.

              Originally posted by bltdavid View Post
              I suspect the indicator you have is closed source. If that is the case, the answer is no.

              Most likely, the only somebody who can modify the indicator is the somebody who wrote the indicator and supplied you with the .dll.

              Did you buy this indicator? Have you inquired about the indicator's behavior with the vendor/supplier/programmer from where you got it?
              And thank you bltdavid for your explanation. It was a free indicator and I haven't contacted the person I received it from. But yes I would be looking to modify the parts you set out above so that values which happened historically and which are equal to the swing high/low do not cancel the drawing of the dot.

              How do I tell whether the indicator is closed source?

              Comment


                #8
                To check if the indicator is contained in the .dll, these are the brute force instructions that will work in every situation.

                First, shutdown NinjaTrader.

                Move (not copy, move) the indicator's .dll file to a completely different location. For ex, move this .dll file to a folder named C:\TEMP -- the point is to make completely SURE that NinjaTrader cannot find it.

                Then restart NinjaTrader.
                Open a new chart.
                Add the third-party swing indicator to the chart.

                If all 3 steps above are completely successful, then the indicator is not contained in the .dll file. Thus the .cs file you downloaded wholly contains the indicator.

                But, if some kind of error occurs on that last step (such as the indicator is missing from the list of indicators available to add), then the missing .dll is most assuredly the culprit, and thus the indicator (or significant portions thereof) is contained in that .dll file.

                Don't forget to shutdown NinjaTrader and move the .dll back to its exact original location. After restarting NinjaTrader, adding that third-party indicator to a new chart should now work again.
                Last edited by bltdavid; 03-16-2015, 05:56 PM.

                Comment


                  #9
                  Originally posted by bltdavid View Post
                  To check if the indicator is contained in the .dll, these are the brute force instructions that will work in every situation.

                  First, shutdown NinjaTrader.

                  Move (not copy, move) the indicator's .dll file to a completely different location. For ex, move this .dll file to a folder named C:\TEMP -- the point is to make completely SURE that NinjaTrader cannot find it.

                  Then restart NinjaTrader.
                  Open a new chart.
                  Add the third-party swing indicator to the chart.

                  If all 3 steps above are completely successful, then the indicator is not contained in the .dll file. Thus the .cs file you downloaded wholly contains the indicator.

                  But, if some kind of error occurs on that last step (such as the indicator is missing from the list of indicators available to add), then the missing .dll is most assuredly the culprit, and thus the indicator (or significant portions thereof) is contained in that .dll file.

                  Don't forget to shutdown NinjaTrader and move the .dll back to its exact original location. After restarting NinjaTrader, adding that third-party indicator to a new chart should now work again.
                  Ok thank you bltdavid.

                  I removed the .dll file and it took that indicator along with many others. So I put it back and now I have it again. I guess that means it's closed source. Is this the end of the road for me?

                  Comment


                    #10
                    Btw, be prepared to be disappointed.

                    Consider this: You have downloaded a free indicator, which (presumably) is closed source, and which appears to correctly conform to the definition of swing highs and swing lows as provided in NinjaTrader's own Swing indicator --- and you think you found a problem?

                    I mean, don't be surprised if the vendor declines to fix the "problem".

                    Hint: don't even mention "problem" in your comms with the vendor. State your desire as a feature request, or an enhancement request. My point is, you may get more mileage by *not* describing your observations of the indicator behavior in "problematic" terms, stay positive; you wish to suggest a new behavior, make extensions, etc.

                    Since this was a free indicator, can you provide a link to where you downloaded it from?

                    Comment


                      #11
                      Originally posted by bltdavid View Post
                      Btw, be prepared to be disappointed.

                      Consider this: You have downloaded a free indicator, which (presumably) is closed source, and which appears to correctly conform to the definition of swing highs and swing lows as provided in NinjaTrader's own Swing indicator --- and you think you found a problem?

                      I mean, don't be surprised if the vendor declines to fix the "problem".

                      Hint: don't even mention "problem" in your comms with the vendor. State your desire as a feature request, or an enhancement request. My point is, you may get more mileage by *not* describing your observations of the indicator behavior in "problematic" terms, stay positive; you wish to suggest a new behavior, make extensions, etc.

                      Since this was a free indicator, can you provide a link to where you downloaded it from?
                      Oh I won't be contacting anyone about it, I just thought someone here might have a solution to this. I downloaded it years ago and never made use of it until recently so I can't remember exactly where. I got it by doing google searches though, so you may find it that way.

                      Thanks for your time anyway.

                      Comment


                        #12
                        Originally posted by CTDavies View Post
                        I guess that means it's closed source. Is this the end of the road for me?
                        Maybe. Probably. But talk to the vendor.

                        Otherwise, unless you have considerable skills in reverse engineering .NET code, yeah, it's over.

                        If the vendor has a paid version of same indicator, you might consider buying that ... at least, as a paying customer, you might have a better leg to stand on with your complaint, er, I mean, suggestion.

                        Comment


                          #13
                          Originally posted by CTDavies View Post
                          I got it by doing google searches though, so you may find it that way.
                          Search using what?
                          What's the exact name of the indicator?

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by brian meade, Today, 01:39 PM
                          1 response
                          4 views
                          0 likes
                          Last Post NinjaTrader_PaulH  
                          Started by Johnny Santiago, Today, 12:20 PM
                          1 response
                          5 views
                          0 likes
                          Last Post NinjaTrader_ChrisL  
                          Started by NinjaTrader_Brandon, Today, 10:24 AM
                          0 responses
                          47 views
                          0 likes
                          Last Post NinjaTrader_Brandon  
                          Started by ptertich, Today, 07:56 AM
                          2 responses
                          15 views
                          0 likes
                          Last Post Johnny Santiago  
                          Started by aslane, Today, 08:24 AM
                          1 response
                          14 views
                          0 likes
                          Last Post NinjaTrader_ChrisL  
                          Working...
                          X