• 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

Help needed with Swing indicator

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

    Help needed with Swing indicator

    I am using the Swing indicator in my strategy to enter trades when Close crosses a swing. The issue is that when I use a high strength setting such as 50 bars some entrees are made too far away from the swing. How do I prevent this and only have entrees made when Close crosses right next to the Swing?

    #2
    Hello relogical,

    What code are you currently using in the condition?

    If a print is added printing the Swing price, does this reflect the price that you are expecting?

    For example:

    Print(Close[0]: "+Close[0]+" > SwingHigh[0]: "+Swing(5).SwingHigh[0]+" && Close[1]: "+Close[1]+" < SwingHigh[1]: "+Swing(5).SwingHigh[1]);
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      The entrees are made correct upon crossover of Swing line. The issue is that if the Swing strength is set to a high number the crossover is made not just where the Swing line ends but also several bars away. I just need to figure out how to make the entrees right at the end of the line.

      Comment


        #4
        Hello relogical,

        So the order is being submitted at the correct time when the cross happens, but the order is not filling right away? Is this the issue?

        In your prints, you are able to confirm that the cross happens at the right time and the order is being submitted, is this correct?

        What type of order are you submitting?

        Are you submitting a limit or stop order at a price that is not the current market price?
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          The swing indicator when set to a high strength draws a longer swing line than a lower strength setting thus making my strategy enter into several trades on the same swing line even though the crossover is not right at the end of this line visually. In other words there are many crossover entrees made on the same swing line instead of just one.

          Comment


            #6
            Hello relogical,

            Are you only wanting to allow 1 entry in a particular direction?

            Are you wanting to somehow change the data so that there isn't multiple crossovers?

            Are you running this with Calculate on bar close set to True and you are getting multiple trades on the same bar?

            Are the multiple trades on different bars?
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              The trades are made on different bars but at the same price point where swing line is. I just want to make one entree per same swing line. My strat makes multiple entrees per direction scaling in.

              Comment


                #8
                Hello relogical,

                In that case, I suggest you use a bool after the first entry that is reset once there is a new swing.

                In #region Variables:
                private bool allowTrades = true;

                In OnBarUpdate:
                if (/* new swing conditions */)
                {
                allowTrades = true;
                }
                if (/* entry conditions */ && allowTrades == true)
                {
                EnterLong();
                allowTrades = false;
                }
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  I don't think this will solve it. I need to prevent multiple entrees on the same swing.

                  Comment


                    #10
                    Originally posted by relogical View Post
                    I don't think this will solve it. I need to prevent multiple entrees on the same swing.
                    Huh? That is what the suggested code does, in the first instance. Why do you look at it askance? Just curious.

                    Comment


                      #11
                      Hi relogical,

                      The psuedocode was intended to show how to prevent multiple entries on a swing.

                      Is this not what you are looking for?

                      You may also be able to limit the orders by setting EntriesPerDirection to 1.
                      http://www.ninjatrader.com/support/h...rdirection.htm
                      Chelsea B.NinjaTrader Customer Service

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by guvenators, Today, 05:18 PM
                      1 response
                      13 views
                      0 likes
                      Last Post NinjaTrader_ShawnB  
                      Started by LANwarr1or, Today, 03:00 PM
                      2 responses
                      8 views
                      0 likes
                      Last Post LANwarr1or  
                      Started by Newtrader101, Today, 02:53 PM
                      2 responses
                      10 views
                      0 likes
                      Last Post Newtrader101  
                      Started by JuanPabloQuevedo, Today, 02:53 PM
                      2 responses
                      9 views
                      0 likes
                      Last Post JuanPabloQuevedo  
                      Started by samir, Today, 03:16 PM
                      2 responses
                      14 views
                      0 likes
                      Last Post samir
                      by samir
                       
                      Working...
                      X