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

Displacement in Strategy Builder also

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

    Displacement in Strategy Builder also

    Dear Ninja Trader Team
    I searched the Posts for "displacement", but I could not find out a good Information I can use.
    I use the "displacement" function in Indicator but I can not find it in the Strategy Builder or Condition Builder. My programming skills a very limited so I ask, if it's possibility to use "displacement" in the Strategy Builder. How can I find out or use it?
    I like to test in a Strategie, how works if the:
    EMA 15 cross the EMA 15 (displacement 1)
    Thank's and best regards
    Markus

    #2
    Hello Markus,

    Displacement does not change the barsAgo value for a plot value in an indicator.

    This is only used for visual purposes only on the chart and does not affect the indicator plot values called for a script.

    Displacement cannot be set in an indicator from the Strategy Wizard and would require unlocking the script.

    However, most likely, are you wanting to use a barsAgo value to get a value from a previous bar.

    (For example if you were to displace an indicator visually on a chart 2 bars, then you've lined up the current bar with the plot from 2 bars ago. In the Strategy Wizard, use a 2 for barsAgo)
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi Chelsea
      Many thanks I understood. Unfortunatelly it is not the same value if I use a 2 BarAgo. It's possible, to take the indicator plot value from "displacement" to make a new indicator by my self?
      Hope you have a idea.
      Thank you
      Markus

      Comment


        #4
        Hello FutureTrade,

        I created a strategy which will buy when the EMA 15 period cross above the EMA 15 period displaced 1 bar, and will use a profit target and stop loss of 20 ticks.

        You could use this as a framework for working outside the builder with two moving averages, 1 of which is displaced.

        Please let us know if you need further assistance.
        Attached Files
        Alan P.NinjaTrader Customer Service

        Comment


          #5
          Hi Alan
          Thank you very much. I will use it to work outside the builder and will develop more features into this strategy.
          I appreciate your support very well.
          Best
          Markus

          Comment


            #6
            Hi Alan,
            could you, please, share the code?

            Thank you
            Regards,
            Vito

            Comment


              #7
              Welcome to the forums vitocapriblu!

              Alan is no longer in a customer facing role. I do not think his example is still around.

              I do have an example that demonstrates creating crossover conditions when working with displaced values. In this example, I create 2 conditions that check if a previous plot value is under, and the next plot value is over. You can see the BarsAgo references I use in the strategy to get a crossover with displaced plots in the Ichimoku Cloud indicator. We can see when the blue line (ChikouSpan) crosses over the green line (SenkouSpanA.)

              We look forward to assisting.
              Attached Files
              JimNinjaTrader Customer Service

              Comment


                #8
                Thank you Jim.

                So you used <= and > conditions.
                Somehow cross above and cross below did not work for me comparing two HMAs: HMA(period) 0 bars ago and HMA(period) 2 bars ago. And I ended up using HMA(period) 0 bars ago > HMA (period) 2 bars ago and the same for <. Not sure why cross above and cross below did not work.

                BTW do you have a Strategy Builder example, which could emulate exactly the ATM for: stop loss, breakeven and trailing stop custom strategies?

                Thank you
                Best regards

                Comment


                  #9
                  Hello vitocapriblu,

                  We cannot perform BarsAgo references when making Crossover conditions. A crossover would be when a series of points (Indicator, PriceSeries, or custom Series) crosses above another series of points, or when a series a points crosses over a static value.

                  When building a crossover with 2 indicators in the Strategy Builder, the code generated would be for for crossing over with two series of points. BarsAgo is not used here. The Lookback of a crossover looks to see if a cross has a occurred looking X number of bars back. A look back of 1 means that between the previous bar and the current bar, a crossover occurred. A look back of 5 would look to see if we had a cross anywhere looking back from the current bar to the 5th bar ago.

                  I use 2 conditions so I can make a crossover and use BarsAgo.

                  If you want to build controlled auto breakevens and auto trails, this would require building the logic in Conditions and Actions. Please see the examples in the thread below. The Strategy Builder can use SetTrailStop, but this is intended for a trailing stop controlled with internal logic. ATM style Auto Trails would require implementing your own logic in Conditions and Actions.



                  We look forward to assisting.
                  JimNinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by inanazsocial, Today, 01:15 AM
                  1 response
                  6 views
                  0 likes
                  Last Post NinjaTrader_Jason  
                  Started by rocketman7, Today, 02:12 AM
                  0 responses
                  10 views
                  0 likes
                  Last Post rocketman7  
                  Started by dustydbayer, Today, 01:59 AM
                  0 responses
                  2 views
                  0 likes
                  Last Post dustydbayer  
                  Started by trilliantrader, 04-18-2024, 08:16 AM
                  5 responses
                  23 views
                  0 likes
                  Last Post trilliantrader  
                  Started by Davidtowleii, Today, 12:15 AM
                  0 responses
                  3 views
                  0 likes
                  Last Post Davidtowleii  
                  Working...
                  X