Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Modify Swing High/Low Indicator

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

    Modify Swing High/Low Indicator

    In conjunction with the Hurst indicator, I am looking at building a strategy to work with it. As part of this (I will be sure to post when complete) I need to resolve an issue with the Swing Indicator that is built in.
    It looks to me that a swing point(high) is defined by this indicator as a high point that has x lower closes either side of it and the opposite for a swing low. What I would prefer is a high point that has x lower highs either side of it.
    You can see from my screenshot that I have plotted the swing indicator with a setting of 2. I have place a blue dot above what I would consider to be a valid swing high point that is not picked up by the indicator.
    The problem is that in reading the code, I cannot seem to find where this might be altered although it sounds like a simple thing to do.
    This indicator obviously affects the plotting of other indicators like auto trend lines etc.

    As an aside, I have placed a red diamond on the chart above another high point that I would consider using if placing a trend line manually. This point has only one lower high on the left, but two on the right.
    You can see from this screenshot that if using a trend line break to enter a long trade (which I plan on, and currently do manually) the entire move would have been missed using the current swing indicator, however a trend line plotted between the bars of the blue dot and red diamond would have entered you in at a nice point indeed.
    If it were possible to code the swing indicator to allow this kind of lopsided swing point it would also be handy.
    Is anyone able to point me in the right direction of what to look for to alter in the code?
    Attached Files

    #2
    Hi yimbot,
    It may be a simplistic reply, but have you tried running the Swing indicator with a setting of 1, it will show a finer resolution then...

    Apart from that, I would suggest working yourself through the code and understanding each part before attempting to modify it.

    You can also try using the ZigZag / ZigZagUTC indicators for labeling your swings - http://www.ninjatrader-support2.com/...h=swing&desc=1

    BertrandNinjaTrader Customer Service

    Comment


      #3
      Thanks Bertrand,

      I think a setting of 1 on the swing indicator brings in a little too much noise for my purpose. But I may be able to work with the ZigZags, thank you for drawing my attention to them. I will be sure to post my results.

      Comment


        #4
        Just revisiting this idea...

        The Swing indicator uses a 'lastHighCache' and 'lastLowCache' to determine it's swing points. Does anybody know the definition of these and if they can be altered?

        Basically, I am just tying to get an indicator which shows a swing high as being the last high with x lower highs to the left and y lower highs to the right. Sounds simple enough, but none of the Swing/ZigZag indicators available seem to do the job.

        Any advice gratefully accepted.

        Comment


          #5
          Hi yimbot, those are arraylists and you could copy the code to a new custom indicator and play with it. Question for your project would be how you would arrive at the definition a swing high / low has occured, i.e. high with x lower highs will also need a certain 'strength' parameter to set the lower high in place....
          BertrandNinjaTrader Customer Service

          Comment


            #6
            yimbot,
            Looking through the code, if 'strength' is 3 then using the arraylist 'lastHighCache', it compares the 3 values to the left of the 'swingHighCandidateValue' to see if they are less than the Candidate, then checks the 3 values to the right in the same way.
            I think you could split 'strength' into 'strengthLeft' and 'strengthRight', so that you can have separate values for each.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by rhyminkevin, Today, 04:58 PM
            0 responses
            7 views
            0 likes
            Last Post rhyminkevin  
            Started by lightsun47, Today, 03:51 PM
            0 responses
            5 views
            0 likes
            Last Post lightsun47  
            Started by 00nevest, Today, 02:27 PM
            1 response
            12 views
            0 likes
            Last Post 00nevest  
            Started by futtrader, 04-21-2024, 01:50 AM
            4 responses
            48 views
            0 likes
            Last Post futtrader  
            Started by Option Whisperer, Today, 09:55 AM
            1 response
            15 views
            0 likes
            Last Post bltdavid  
            Working...
            X