Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Swing Line

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

    Swing Line

    Hello everybody,

    I'm currently trying to code a strategy with the swing indicators but i'm not able to make it works. I want to draw a blue arrow when the swing high line hit the price line and a red arrow when the swing low line hit the price line. Thanks !

    #2
    Hello Dimi2212,

    Welcome to the NinjaTrader Support Forums!

    The Swing indicator can have their plot points recalculated as incoming data is updated, thus making it challenging to use in a strategy via programmatic calls. They are first and foremost mean to be used as visual trading tools

    With that said you can still use the indicators for your calculations but would need to understand what price points can be accessed at which time programmatically, since those can be different from the historically plotted ones.

    For example you may still do something like

    Code:
    if (Swing(5).SwingHigh[0] > Swing(5).SwingHigh[6])
    {
             DrawHorizontalLine("My horizontal line" + CurrentBar, Swing(5).SwingHigh[0], Color.Blue);
    }
    Let us know if you have any further questions.
    JCNinjaTrader Customer Service

    Comment


      #3
      Thanks for your quick answer JC,

      I'm not sure i understand what you said, if i want to place an order on the bars i circled in the images, do i have to use the blue line, the indicator or use a math calculation ?
      Attached Files

      Comment


        #4
        Hello Dimi2212,

        I am not quite sure I understand your condition for your Entry signals. Are you to see if the High price of those bars is greater than the Swing High?
        JCNinjaTrader Customer Service

        Comment


          #5
          also but most of all if it cross the line of the most recent swing high. Thanks for the help JC !

          Comment


            #6
            Hello Dimi2212,

            I still am not sure about your condition for your Entry signals.

            What are your conditions for your strategy to enter an order? Are you to see if the High price of those bars is greater than the Swing High or are you looking at where the line has been drawn?
            JCNinjaTrader Customer Service

            Comment


              #7
              Thanks for the reply JC,

              the entry signal would be when the high price of those bars is greater than the precedent swing high. When the price cross above the precedent swing high and close above it. i'm just not able to visualize how to code this cross above.

              Comment


                #8
                Hello Dimi2212,

                I have a few items scheduled but once I am free and I see if I can put an example together for you.
                JCNinjaTrader Customer Service

                Comment


                  #9
                  Hello Dimi2212,

                  Thanks for your patience.

                  Here is example of how you may do this using the Strategy Wizard that you may view.

                  To Import
                  1. Download the attached file to your desktop
                  2. From the Control Center window select the menu File > Utilities > Import NinjaScript
                  3. Select the downloaded file

                  Note that on any files that say "File already exists on your PC" that start with an "@" symbol are the ones that came preloaded inside of NinjaTrader so you would say "No" so that you do not override those files.
                  Attached Files
                  JCNinjaTrader Customer Service

                  Comment


                    #10
                    Thanks a lot for the help JC !

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                    0 responses
                    639 views
                    0 likes
                    Last Post Geovanny Suaza  
                    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                    0 responses
                    366 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by Mindset, 02-09-2026, 11:44 AM
                    0 responses
                    107 views
                    0 likes
                    Last Post Mindset
                    by Mindset
                     
                    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                    0 responses
                    569 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by RFrosty, 01-28-2026, 06:49 PM
                    0 responses
                    572 views
                    1 like
                    Last Post RFrosty
                    by RFrosty
                     
                    Working...
                    X