• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

look back period in strategy wizard

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

    look back period in strategy wizard

    Is it possible to look back over the previous 5 bars lets say to see if a condition is met? For simplicity say a MA crossed another 4 bars ago but another condition is just now being met on current bar. All conditions would need to be met but not necessarily on same bar if that makes sense. Is this doable? Thanks

    #2
    Hello dedouglas,

    Thank you for your reply.

    That depends on the relational operator you choose to use in your condition. If you use either Cross Above or Cross Below, you'll be able to specify a "Look back period" that will allow the condition to return true if the condition occurred within that many bars, as shown in the screenshot below:

    Click image for larger version

Name:	2019-04-15_1155.png
Views:	34
Size:	88.9 KB
ID:	1054441

    You can see more regarding the Cross Above and Cross Below operators here:
    https://ninjatrader.com/support/help...sOverCondition

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



    Kate W.NinjaTrader Customer Service

    Comment


      #3
      thanks...that was a simple oversight on my part. I have one other issue I'd like explained if possible. I'll attach a screen grab of the error when I compile. Error is CS0118. I'm using a custom indicator. If I need to start a new thread I will. Thanks
      Attached Files

      Comment


        #4
        Hello dedouglas,

        Thank you for your reply.

        How are you declaring your TASRatio1 variable? I didn't see it in your screenshot.

        Try this if it's different from how you're declaring it:

        private TASRatio TASRatio1;
        Then try again to compile.

        If you ever forget the syntax, you can always add the indicator in a condition in the strategy builder and click View Code to see the generated syntax.

        Please let us know if you're in need of further assistance to you.
        Kate W.NinjaTrader Customer Service

        Comment


          #5
          Hi,

          It is declared private as you have written above. I took a screen shot of most of the code. I'm using the strategy wizard. Thanks
          Attached Files

          Comment


            #6
            Hello dedouglas,

            Thank you for your post.

            Can you view the code for the TASRatio when you are in the NinjaScript Editor? Or is this file protected in an assembly? Many third party indicators and strategies are closed source and proprietary that are not intended to be viewed or edited because the vendor wishes for it to remain protected. If the latter is the case, you may not be able to programmatically access the indicator values. You may want to reach out to the third party directly and they can advise you better since they're the ones who developed it.

            Thanks in advance; I look forward to assisting you further.
            Kate W.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by SAITON, Today, 09:03 PM
            0 responses
            1 view
            0 likes
            Last Post SAITON
            by SAITON
             
            Started by suprsnipes, Today, 08:26 PM
            0 responses
            5 views
            0 likes
            Last Post suprsnipes  
            Started by RobertoPaez, Today, 06:47 PM
            0 responses
            7 views
            0 likes
            Last Post RobertoPaez  
            Started by catinabag, Today, 06:45 PM
            0 responses
            4 views
            0 likes
            Last Post catinabag  
            Started by darkgreen, Today, 03:35 PM
            0 responses
            9 views
            0 likes
            Last Post darkgreen  
            Working...
            X