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 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 Graci117, Today, 09:02 PM
                    1 response
                    8 views
                    0 likes
                    Last Post NinjaTrader_Manfred  
                    Started by ETFVoyageur, Today, 07:55 PM
                    0 responses
                    7 views
                    0 likes
                    Last Post ETFVoyageur  
                    Started by janio973, Today, 07:24 PM
                    1 response
                    7 views
                    0 likes
                    Last Post NinjaTrader_Manfred  
                    Started by aligator, 01-06-2022, 12:14 PM
                    4 responses
                    248 views
                    0 likes
                    Last Post john_44573  
                    Started by reynoldsn, Today, 05:56 PM
                    0 responses
                    15 views
                    0 likes
                    Last Post reynoldsn  
                    Working...
                    X