Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Question Regarding Swing

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

    Question Regarding Swing

    Hi All

    When I set the Swing Indicator in relation to itself, I run into some problems.

    When I code:

    if (Swing1.SwingLow[1] >= Swing1.SwingLow[2])

    {

    SetParabolicStop();

    }


    And when I then backtest it, it does not set the stop according to the rule, but randomly.

    I checked the line of code also with the strategy builder, and it builts the line the same way.

    Anybody an idea whats going on there?

    Thanks in advance, traders.
    Last edited by maxherehello; 06-12-2022, 01:46 AM.

    #2
    Hello maxherehello,

    Thank you for your post.

    The way the Swing definition is defined, the indicator does not know a bar is a swing high or low until N bars have passed (where N is the Strength parameter) because we need all N bars to close to confirm that the candidate swing bar is, indeed, the higher than all N bars (or lower than all N bars).

    If you're checking only 1 or 2 bars ago and your Strength is set to 5, you wouldn't get correct values, as these will be overwritten until 5 bars have passed. So if our Swing Strength is 5, checking SwingHigh or SwingLow you'd want to check 5 bars back at the earliest.

    Please let us know if we may be of further assistance to you.
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      Hi Kate,

      thanks for your response. I'll try the thing you suggested. Am I understanding you right, that would mean when I want to reference the last swing and the one before the last swing, I have to try:


      if (Swing1.SwingLow[10] >= Swing1.SwingLow[20])

      {

      SetParabolicStop();

      }



      I always thought that the Swing1.SwingLow[1] references the last swing(?), and not the last bar. Because in an other strategy I use it in this capacity and it works.

      I know for sure how its with Close[0], Close[1], Close[2], etc., but is this really so in this case, that it is not referencing the last swing ( eg. [1], [2]) and the one before it?
      Last edited by maxherehello; 06-12-2022, 01:46 AM.

      Comment


        #4
        Hello maxherehello,

        Thank you for your note.

        Not quite. Basically, the swing values for the last Swing Strength number of bars back from the current bar aren't finalized yet, so for finalized values, you can look back the Swing Strength number of bars or greater.

        So if your swing Strength is 5, you could do something like:

        if(Swing1.SwingLow[5] >= Swing1.SwingLow[6])
        {
        // do something
        }

        Please let us know if we may be of further assistance to you.
        Kate W.NinjaTrader Customer Service

        Comment


          #5
          Hi Kate,

          thanks for your response.

          I tried

          Swing1.SwingLow[10] >= Swing1.SwingLow[20]

          to select the last swing and the swing before it with a swing setting of Swing(Close, 10), but the results are still random.

          I dont get it why it is different when I want to mingle two SwingLows/Highs together. Hmm ?

          So, Ill try Swing1.SwingLow[10] >= Swing1.SwingLow[11], maybe thats it.


          Kind regards
          Last edited by maxherehello; 05-05-2022, 02:26 AM.

          Comment


            #6
            Hey Kate,

            I dont get it to run like I intend to. Its a mystery for me how this behaves like this in this particular case.

            Is there any chance to read about this in the library somewhere?
            Last edited by maxherehello; 05-05-2022, 02:27 AM.

            Comment


              #7
              Hello maxherehello,

              Thank you for your reply.

              I'd take a look at this post from our forums - there's an example script here that one of my colleagues made that may help in understanding:

              Hi,I'm trying to build a swing strategy with the strategy builder,but I have some difficulties on how to set the swing indicator as output for my entry. Are


              I'm also attaching an example script that may be helpful as well.

              Please let us know if we may be of further assistance to you.
              Attached Files
              Kate W.NinjaTrader Customer Service

              Comment


                #8
                Thank you I'll have a look into it.

                Best regards

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Segwin, 05-07-2018, 02:15 PM
                14 responses
                1,788 views
                0 likes
                Last Post aligator  
                Started by Jimmyk, 01-26-2018, 05:19 AM
                6 responses
                837 views
                0 likes
                Last Post emuns
                by emuns
                 
                Started by jxs_xrj, 01-12-2020, 09:49 AM
                6 responses
                3,293 views
                1 like
                Last Post jgualdronc  
                Started by Touch-Ups, Today, 10:36 AM
                0 responses
                13 views
                0 likes
                Last Post Touch-Ups  
                Started by geddyisodin, 04-25-2024, 05:20 AM
                11 responses
                63 views
                0 likes
                Last Post halgo_boulder  
                Working...
                X