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:	540
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.



    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.

        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.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Mindset, 04-21-2026, 06:46 AM
            0 responses
            88 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by M4ndoo, 04-20-2026, 05:21 PM
            0 responses
            134 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Started by M4ndoo, 04-19-2026, 05:54 PM
            0 responses
            68 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Started by cmoran13, 04-16-2026, 01:02 PM
            0 responses
            119 views
            0 likes
            Last Post cmoran13  
            Started by PaulMohn, 04-10-2026, 11:11 AM
            0 responses
            69 views
            0 likes
            Last Post PaulMohn  
            Working...
            X