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

Swing Strategy

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

    Swing Strategy

    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 there some examples?
    Thanks

    #2
    Hello Italianforex,

    Thanks for your post.

    The strategy builder only has access to the SwingHigh or SwingLow values, relative to the bars ago value selected. To understand and visualize what the strategy builder is using you can create a set that draws an object (such as a dot, arrow, square, etc) at the current bar value of the SwingHigh or SwingLow. I've attached an example of this in a strategy builder strategy you can test with. It will show the swing indicator on the chart (with the normal dots) and will add up/down triangles to show where the code identifies the swing high and low. (I've offset the triangles by 2 ticks each way to show them clearly as otherwise they would be at the same price level as the swing dots and would be obscured where they overlap) The (time) difference between the dots and triangles is the number of bars of the strength setting (5 by default) and this is an important concept to understand when using the swing indicator in a strategy.

    Click image for larger version

Name:	Swingvisualized.PNG
Views:	1763
Size:	50.1 KB
ID:	1060057

    [ATTACH]n1060058[/ATTACH]
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Hi,thanks for the reply,but I can't really understand how i can set the output for my entry,there is no crossover or anything that give me an input to enter the trade.

      Comment


        #4
        Hello Italianforex,

        Thanks for your reply.

        The example code was to help you see what the strategy builder actually sees as the values of the swings and when those swing points are known. In the screenshot in post 2, on the left side, you can see where price crossed above the swing high in the uptrend, 4 times. In the strategy builder, you can check for price crossing above a swing high or crossing below a swing low. You would want to study the swing indicator on your instrument(s) to see if there are other conditions that would help to confirm an entry point.
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          How can I set to buy/sell from the swing high/low...let's say to sell if the current bar is below the swing high more than 10 ticks...can't find nothing to do it.

          Thanks
          Last edited by Italianforex; 06-11-2019, 07:52 PM.

          Comment


            #6
            Hello Italianforex,

            Thanks for your reply.

            In the strategy builder, you would use Close and offset it by 10 ticks and then check to see if it is less than the swing high (or you can subtract 10 ticks from the swing high). I've attached an example that I added to the swing visualizer to draw on the chart a magenta down arrow where that condition is true. (Close + 10 ticks less than the swing high).


            Click image for larger version

Name:	ItalianForex-1.PNG
Views:	1261
Size:	69.8 KB
ID:	1060517
            Paul H.NinjaTrader Customer Service

            Comment


              #7
              Hi,
              i followed the steps and tried to add the Down Arrow, but this arrow doesnt appear for the charts that i am looking at. Can you please help? Does it require 1 min data itself for showing the details, I have used the daily chart. code snippet as below:

              }
              else if (State == State.Configure)
              {
              }
              else if (State == State.DataLoaded)
              {
              Swing1 = Swing(Close, 5);
              }
              }

              protected override void OnBarUpdate()
              {
              if (BarsInProgress != 0)
              return;

              if (CurrentBars[0] < 2)
              return;

              // Set 1
              if ((Close[0] + (10 * TickSize)) < Swing1.SwingHigh[0])
              {
              Draw.ArrowDown(this, @"CheckStrategy Arrow down_2", true, 0, (High[0] + (5 * TickSize)) , Brushes.Red);
              Draw.Text(this, @"CheckStrategy Text_1", @"SPH", 0, (High[0] + (10 * TickSize)) );
              }

              Attached Files

              Comment


                #8
                Hello prodigaltrader,

                I've answered the post in your original thread: https://ninjatrader.com/support/foru...um#post1139128

                Please do not double post as there is no point in answering 2 posts on the same subject in different threads. Thanks for your understanding.
                Paul H.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Skifree, Today, 03:41 AM
                1 response
                3 views
                0 likes
                Last Post Skifree
                by Skifree
                 
                Started by usazencort, Today, 01:16 AM
                0 responses
                1 view
                0 likes
                Last Post usazencort  
                Started by kaywai, 09-01-2023, 08:44 PM
                5 responses
                603 views
                0 likes
                Last Post NinjaTrader_Jason  
                Started by xiinteractive, 04-09-2024, 08:08 AM
                6 responses
                23 views
                0 likes
                Last Post xiinteractive  
                Started by Pattontje, Yesterday, 02:10 PM
                2 responses
                23 views
                0 likes
                Last Post Pattontje  
                Working...
                X