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

Delayed Entry Signal

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

    Delayed Entry Signal

    I am trying to build a strategy built around a few factors. The first is when the red and blue line (in the image below) cross above a threshold, let's say 30 (the yellow line in the image below). Then I'm looking for when the red line crosses below the blue line and them at some point in the future crosses the next threshold of say 25 (the Teal line in the image below). i can't seem to figure out how to get the strategy builder to include the teal line cross without a "number of bars" input. Is there a way to leave it open ended? In the example below it is 6 bars, but it will be different every time.

    Click image for larger version

Name:	image.png
Views:	43
Size:	20.4 KB
ID:	1301654

    #2
    Hello ageeholdings,

    Thank you for your post!

    To clarify, you want to only enter if all the following have occurred:
    • when the red and blue line (in the image below) cross above a threshold (the yellow line)
    • when the red line crosses below the blue line
    • at some point in the future crosses the next threshold of say 25 (the Teal line in the image below)
    Could clarify what you mean by "at some point in the future"? Do you want to check if the first two conditions occurred, then wait 6 bars to check for the last condition?

    Are you using crossabove or crossbelow conditions?

    CrossAbove/Below needs a number for the lookback period, so there is no way to leave this "open ended" unfortunately. If you specify 25 for the lookbackPeriod, then it will which if a cross occured within the last 25 bars.

    If you're looking to delay your entry by a number of bars, i.e. check if the conditions happened and then enter x bars later, please see this forum post which has an explanation as well as an example script:

    Hi, I have an issue with my automated strategy. I use CCI as my entry point, when it crosses the 0 line. The thing is I'd like my entry to be on the 5th candle after the crossover. I used a value of 5 as the look back period, but the strategy still taking orders on the crossover candle I appreciate your help Screenshot_17.png


    Please let me know if this does not guide you in the right direction.
    Last edited by NinjaTrader_Gaby; 05-01-2024, 07:22 AM.
    Gaby V.NinjaTrader Customer Service

    Comment


      #3
      That is correct. I want all of those things to happen, but i am unsure of when or how long it will take to happen.

      I anticipate the red and blue line (in the image below) cross above a threshold (the yellow line) will occur first and then the red line crosses below the blue line. After those occur, i am looking for the final condition to happen, which will trigger the trade. I don't want it to look back just 6 bars. I want it to occur when it happens. I do not know how many bars it will be.

      Comment


        #4
        Hello ageeholdings,

        You can specify the lookbackPeriod to be 1, it will check if the condition happened within the last bar. There is no way to know when the condition is going to occur since we can't predict the future. The set will check for every bar update if the condition has occurred. You can specify in the actions that when this condition is true, to submit your entry order.

        Please let us know if you have any further questions.
        Gaby V.NinjaTrader Customer Service

        Comment


          #5
          Slightly different question... how do i setup a spread condition. For example, using the original image above, if i want the red bar to be above the blue bar by a numeric number of 3, how do i setup that condition?

          Comment


            #6
            One more question... is BarsSinceNewTradingDay in strategy builder? I can't seem to find it.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by marco231, Today, 11:32 PM
            0 responses
            1 view
            0 likes
            Last Post marco231  
            Started by sofortune, Today, 10:55 PM
            0 responses
            2 views
            0 likes
            Last Post sofortune  
            Started by sofortune, Today, 10:19 PM
            0 responses
            9 views
            0 likes
            Last Post sofortune  
            Started by sofortune, Today, 10:10 PM
            0 responses
            6 views
            0 likes
            Last Post sofortune  
            Started by sofortune, Today, 09:49 PM
            0 responses
            4 views
            0 likes
            Last Post sofortune  
            Working...
            X