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

Attach Stop to Indicator with Displacement

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

    Attach Stop to Indicator with Displacement

    I am not finding my Stop Order updating when I use "Attach to Indicator" when that indicator uses Displacement. I do see that my Stop Order will update with a simple indicator like HMA() that is not using Displacement. I am projecting into the future with displacement and would like my Indicator usefull with "Attach to Indicator" for the current realtime bar (not the displaced future bars/ not [-x] bars)

    Am I doing something incorrect? Is this possible today? Is this something that could be included in the future?

    thanks for your help,

    #2
    I found an indi that works superbly on NT8 to identify candlestcik patternns. It's called CandlestickPatternall. It scans for Engulfing patterns, Doji, Hammer, you name it.
    Attached Files

    Comment


      #3
      Hello MartinT,

      Displacement is only visual on the chart. The values and slots for the indicator are not changed. The only thing that changes is that the indicator is moved forward. The value on that bar remains the same though.

      NinjaScript uses barsAgo values. An indicator displaced 5 bars to the right on the chart would be showing a value from 5 bars ago on the current bar. An indicator displaced 5 bars to the left would not have a value on the current bar (or last 5 bars).

      Chelsea B.NinjaTrader Customer Service

      Comment


        #4
        Hi ChelseaB,

        Thank you for your reply. I am having a little difficulty understanding your reply because my practical knowledge about displacement is from using it in NinjaScript. Ok once I define Displacement = 100 I can index into the future with Var[-25] (-1,-100) for an ISeries variable OR so it seems. I have a function that calcs a value and assigns to ISeries. The index [0] is the current bar or Zero BarsAgo value so Var[0] == currentbar while Var[3] == 3rd bar back(barsAgo) from current and Var[-25] would be the 25th bar into the future. I presume that the Indicator using Displacement can be assigned with "Attach to Indicator" and that the Value used would be the current realtime value at reference Var[0]. Note: Not a displaced value.

        I am not sure but your reply seems to suggest that an Indicator using Displacement and used with "Attach to Indicator" will be using the fully displaced value. From my example that would be Var[-100]. Is this corrent?

        If that is the case I can see that I assumed incorrectly that ref Var[0] would be used when "Attach to Indicator" is used with Displacement.

        I submit "Attach to Indicator" when used with an Indicator using Displacement should allow for the selection of a reference point: Var[0] or Var[Displacement] . Maybe we could see that as an option in a future release? I do concede I could script around this to a solution that would work for me. It would mean an additional ISeries and assignment as the calculations are already done. I do like seeing the shape of my indicator into the furture so using Displacement is very helpful.

        looking forward to your reply,



        Comment


          #5
          Hello MartinT,

          You cannot use negative indexes.

          Displacing a plot 100 bars forward, would mean you are displaying a plot value from 100 bars ago on the current bar.

          This means you would use a barsAgo index of 100 in NinjaScript to get a value from 100 bars ago.

          Print(MyIndicator()[100]);

          Attach an order to an indicator attaches to the indicator on the current bars value. Displacement is only visual. It does not change the plot values or the bars they are assigned on.

          If you want to use a value from 100 bars ago for Attach to indicator, you would need a second plot that is set to the value of the first plot, 100 bars ago.
          Chelsea B.NinjaTrader Customer Service

          Comment


            #6
            Hi ChelseaB,


            Ok, to me working with Displacement is a real brain twister. I wrote a very simple script to show me the difference. It has been a while since I worked with Displacement. I have attached the script.

            Please excuse my previous explanation. My reference to a negative index was as you said not possible. I was confused because at least I had to think that way and use an offset from/with Displacement which was negative(the offset) but that is just me.


            My confusion about "Attach to Indicator" is that Not Displaced [0] visually appears to be into the future and Displaced visually appears as current time or [0] but is Not as demonstrated in my attached script.

            What really confuses me is the time references: Displaced appears as current time but Not displaced appears as into the future.

            So with my new/better understanding, when I use "Attach to Indicator" it's referencing [0] of my ISeries(not displaced) which visually appears to be in the future. Do I have that right?

            If that is the case, then what I want is effectively to have "Attach to Indicator" reference Var[Displacement] and Not Var[0]. And my trouble with "Attach to Indicator" is that it can only Ref Var[0].



            looking forward to your reply,
            Attached Files

            Comment


              #7
              Hello MartinT,

              Displacement doesn't exist in NinjaScript, this is a visual thing for charts only.

              In NinjaScript it''s just requesting the barAgo value from as many bars back as was being shifted forward on the chart.

              MyIndicator()[100] would be returning the value from 100 bars ago, the same as displaying a value from 100 bars ago shifted forward visually on the chart.
              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                Hi Chelsea,

                "Displacement doesn't exist in NinjaScript, this is a visual thing for charts only."
                I beg your pardon. It certainly does exist as a variable in NinjaScript and is helpful.

                "In NinjaScript it''s just requesting the barAgo value from as many bars back as was being shifted forward on the chart.

                MyIndicator()[100] would be returning the value from 100 bars ago, the same as displaying a value from 100 bars ago shifted forward visually on the chart."
                Yes, I fully agree. I think I have it sorted out now.

                Thank you for your assistance,

                Comment


                  #9
                  Hello MartinT,
                  Originally posted by MartinT View Post
                  I beg your pardon. It certainly does exist as a variable in NinjaScript and is helpful.
                  I'm talking about the concept.

                  Print the values of an indicator with the time of the bar using barsAgo 0.

                  Then set displacement to anything you want.

                  Print the values of the indicator again. Has anything changed at all?

                  Chelsea B.NinjaTrader Customer Service

                  Comment


                    #10
                    Hi ChelseaB,

                    Yes, Thank you. I did that with the smiple Indicator I sent you.
                    MyTestDisplacement.zip
                    While you are completely correct, the implementation/integration of Displacement is considerably more complicate than its simple effect; at least for me.

                    thanks again,

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Barry Milan, Today, 10:35 PM
                    1 response
                    6 views
                    0 likes
                    Last Post NinjaTrader_Manfred  
                    Started by WeyldFalcon, 12-10-2020, 06:48 PM
                    14 responses
                    1,427 views
                    0 likes
                    Last Post Handclap0241  
                    Started by DJ888, Yesterday, 06:09 PM
                    2 responses
                    9 views
                    0 likes
                    Last Post DJ888
                    by DJ888
                     
                    Started by jeronymite, 04-12-2024, 04:26 PM
                    3 responses
                    40 views
                    0 likes
                    Last Post jeronymite  
                    Started by bill2023, Today, 08:51 AM
                    2 responses
                    16 views
                    0 likes
                    Last Post bill2023  
                    Working...
                    X