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

How to add displacement in AddPlot() in NinjaTrade 8

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

    How to add displacement in AddPlot() in NinjaTrade 8

    Hello,

    I could not find any reference in "How to do Displacement in AddPlot()" in NinjaTrade 8.

    In NinjaTrader 7, this is what I code:

    Add( new Plot( new Pen(Color.Red, 1), "MA1" ));
    Displacement = 26; // Move MA1 forward by 26 bars

    Can someone please help me to convert the above code to NinjaTrader 8?

    Thanks,

    Richard

    #2
    Hello Richard,

    The Displacement property is the same in NinjaTrader 8.


    Are you receiving an error with this?

    (Please note, changes to properties require that you remove and re-add the instance of the script from the chart)
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thanks for the reply.

      I tried that and it works.

      However, is there a way to selectively specify displacement for some MAs and no displacement for other MAs within the same script?

      Comment


        #4
        Hello Richard168,

        No, the displacement will apply to the indicator not the plot.

        Separate the plots into separate indicators.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Hard Time

          I have been trying to develop an 11SMA (high,Low,Close) indicator with a displacement of 6 can someone help. I was able to do it as a strategy but not as an indicator and I am not skilled at this. Thanks

          Comment


            #6
            Hello wealthcig,

            In the Indicators OnStateChange method when State is State.SetDefaults add Displacement = 6;.

            Then remove the instance of the indicator and add a new instance of the indicator to the chart.

            Below is a public link to the help guide on Displacement.


            Unfortunately, Displacement cannot be used with Strategies and only works with Indicators.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              What about the High,Low Close

              Comment


                #8
                Then remove the instance of the indicator and add a new instance of the indicator to the chart.

                What? I don't understand computer language. do you have pictures

                Comment


                  #9
                  Hello wealthcig,

                  Your previous inquiry is how to use the Displacement property to render a plot a set number of bars forward or back in relation to the bars on the chart.

                  What are you asking about the High, Low, and Close?

                  To remove and re-add an instance right-click the chart > select the active instance of the indicator in the Configured list > click the remove button. In the Available list select the original indicator > click the add button below in the Configured area to add a new instance.

                  Below is a short video that demonstrates removing an instance of the ADL indicator and adding a new instance of the ADL indicator to a chart.
                  Chelsea B.NinjaTrader Customer Service

                  Comment


                    #10
                    thanks will look at video

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by inanazsocial, Today, 01:15 AM
                    0 responses
                    1 view
                    0 likes
                    Last Post inanazsocial  
                    Started by trilliantrader, 04-18-2024, 08:16 AM
                    5 responses
                    22 views
                    0 likes
                    Last Post trilliantrader  
                    Started by Davidtowleii, Today, 12:15 AM
                    0 responses
                    3 views
                    0 likes
                    Last Post Davidtowleii  
                    Started by guillembm, Yesterday, 11:25 AM
                    2 responses
                    9 views
                    0 likes
                    Last Post guillembm  
                    Started by junkone, 04-21-2024, 07:17 AM
                    9 responses
                    70 views
                    0 likes
                    Last Post jeronymite  
                    Working...
                    X