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

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:	328
Size:	88.9 KB
ID:	1054441

    You can see more regarding the Cross Above and Cross Below operators here:


    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 trilliantrader, 04-18-2024, 08:16 AM
            4 responses
            18 views
            0 likes
            Last Post trilliantrader  
            Started by mgco4you, Today, 09:46 PM
            1 response
            7 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Started by wzgy0920, Today, 09:53 PM
            0 responses
            9 views
            0 likes
            Last Post wzgy0920  
            Started by Rapine Heihei, Today, 08:19 PM
            1 response
            10 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Started by Rapine Heihei, Today, 08:25 PM
            0 responses
            10 views
            0 likes
            Last Post Rapine Heihei  
            Working...
            X