Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Displacement in Strategy Wizard

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

    Displacement in Strategy Wizard

    Hello,
    I have a MA Simple of 14 Periods with displacement of 8. How Can I put this on Strategy Wizard for this works properly. The logic is simple:
    1) I have MA(14)[8] based on price High and another based on price Low.
    2) If the Price(Closed) > SMA(High, 14) with displacement 8 >>> So "Enter long" (with TP and SL).

    I
    can note that strategy wizard displacement doesnt works. I read several old post about similar question a
    s: https://ninjatrader.com/support/foru...nt-in-strategy



    But it doesn't help me. Can someone help me with an example? Thanks.

    #2
    Hello razeus,

    Thank you for your post.

    When you say displacement, do you mean you're wanting the value of the SMA(14) eight bars ago, or do you mean you want the Close price to be greater than the SMA(14) plus 8? Or do you mean the displacement you see in a chart when applying an indicator?

    Thanks in advance; I look forward to assisting you further.

    Comment


      #3
      Originally posted by NinjaTrader_Kate View Post
      Hello razeus,

      Thank you for your post.

      When you say displacement, do you mean you're wanting the value of the SMA(14) eight bars ago, or do you mean you want the Close price to be greater than the SMA(14) plus 8? Or do you mean the displacement you see in a chart when applying an indicator?

      Thanks in advance; I look forward to assisting you further.
      Hello Kate, you are right "
      you're wanting the value of the SMA(14) eight bars ago
      " also I want to Close[0] > SMA(14) with displacement 8, the unique problem is with displacement value. Click image for larger version

Name:	02.png
Views:	274
Size:	44.1 KB
ID:	1059618Click image for larger version

Name:	01.png
Views:	267
Size:	72.3 KB
ID:	1059619Click image for larger version

Name:	03.png
Views:	261
Size:	62.3 KB
ID:	1059620

      Thanks for your help. The problem is that displacement doesn't work in Strategy Wizard.

      Comment


        #4
        Hello razeus,

        Thank you for your reply.

        Displacement is an indicator property that shifts the plot visually, and you're right that this cannot be set in the Strategy Builder. In the Strategy Builder, to actually reference those data points, you would use the Bars Ago property. So, to add a condition that will check whether Close[0] > SMA(14)[8], it would look like this:

        Click image for larger version

Name:	2019-06-04_0923.png
Views:	283
Size:	69.8 KB
ID:	1059696

        If you wanted it to plot on the chart, you would just need to make sure the Plot on Chart box is checked.

        Please let us know if we may be of further assistance to you.

        Comment


          #5
          Hello Kate,
          I can detect that Plot dones't work with Strategy Wizard and displacement. Click image for larger version

Name:	Ninja_02.png
Views:	263
Size:	47.7 KB
ID:	1059720Click image for larger version

Name:	Ninja_01.png
Views:	269
Size:	51.0 KB
ID:	1059722




          So, the Plot from Strategy Wizard is wrong but calculation is right. Do you have any manner for Plot properly with Strategy Wizard?
          Attached Files

          Comment


            #6
            Hello razeus,

            Thank you for your reply.

            There is no displacement property in the Strategy Builder, rather, the Bars Ago setting references historical values but does not adjust the plot of the indicator visually.

            Using the Data Box with Bars Ago enabled can help you understand a Bars Ago reference to a current bar. I'm including a screenshot of where I've created a chart that has both a very simple strategy that plots the SMA from the strategy and then also added an SMA with 8 displacement as just a regular indicator to the chart. The regular SMA indicator with the displacement is green, the one from the Strategy is orange.

            Click image for larger version

Name:	2019-06-04_1508.png
Views:	307
Size:	117.1 KB
ID:	1059742

            You'll note in the data box that's visible in the screenshot that we are looking at data from 8 bars ago, and that the SMA plotted from the Strategy is given as 53.58 - the same as depicted from the SMA indicator with the 8 displacement for the current bar.

            I then set up a print in the Strategy Builder that looks like this to confirm my data values are indeed correct for my strategy:

            Click image for larger version

Name:	2019-06-04_1510.png
Views:	265
Size:	32.3 KB
ID:	1059743

            This looks like this in the Actions section of Conditions and Actions:

            Click image for larger version

Name:	2019-06-04_1511.png
Views:	275
Size:	20.2 KB
ID:	1059744

            I didn't add any conditions to this set, so it would print on every bar.

            Here's a print from the strategy for the current bar:

            SMA(14)[8] value: 53.5678571428573 | SMA(14)[0] value: 53.5628571428573 30064

            And from 8 bars ago, the bar we're displaying in the databox:

            SMA(14)[8] value: 53.5914285714287 | SMA(14)[0] value: 53.5678571428573 30056

            As you can see, the values are correct for the SMA(14)[8].

            As a workaround, I would suggest applying an SMA(14) with a displacement of 8 as an Indicator directly to the chart, then add your Strategy to the chart as well. That way you can see the expected visual displacement even though you cannot plot it from the strategy directly. You could unlock the strategy code and plot this manually, but it would not be possible within the Builder itself.

            Please let us know if we may be of further assistance to you.

            Comment


              #7
              Kate, thanks you so much for your explain.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by NullPointStrategies, Yesterday, 05:17 AM
              0 responses
              71 views
              0 likes
              Last Post NullPointStrategies  
              Started by argusthome, 03-08-2026, 10:06 AM
              0 responses
              143 views
              0 likes
              Last Post argusthome  
              Started by NabilKhattabi, 03-06-2026, 11:18 AM
              0 responses
              76 views
              0 likes
              Last Post NabilKhattabi  
              Started by Deep42, 03-06-2026, 12:28 AM
              0 responses
              47 views
              0 likes
              Last Post Deep42
              by Deep42
               
              Started by TheRealMorford, 03-05-2026, 06:15 PM
              0 responses
              51 views
              0 likes
              Last Post TheRealMorford  
              Working...
              X