Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Lookback regarding price (low) below cert level possible?

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

    Lookback regarding price (low) below cert level possible?

    I would prefer to use following kind of a condition as a checkup for a signal:

    If the measured time series bar low has visited below a certain price level like SMA(5)-StDev(5) during 5 past days at any of those 5 days a signal occuring is valid.

    Is defining this kind of an additional (strategic) condition possible with NinjaTrader?

    #2
    Yes this sounds possible but complexity will depend on the type of chart being used. Are these daily bars or a smaller time frame?

    In regards to
    Originally posted by MickeyHR View Post
    during 5 past days at any of those 5 days a signal occuring is valid.
    does this mean you would like to look at the past 5 days and then if any one of them has a low that breaches the value you can take trades on the current day?
    LanceNinjaTrader Customer Service

    Comment


      #3
      Hi,
      Thank you so much for your fast response.

      Originally posted by NinjaTrader_Lance View Post
      Yes this sounds possible but complexity will depend on the type of chart being used. Are these daily bars or a smaller time frame?
      In my case daily bars.

      Originally posted by NinjaTrader_Lance View Post
      In regards to


      does this mean you would like to look at the past 5 days and then if any one of them has a low that breaches the value you can take trades on the current day?
      Exactly like you state.

      Comment


        #4
        In that case you could do something like this
        Code:
        if(MIN(Low, 5)[1] < (SMA(5)[0]- StDev(5)[0]))
        MIN(Low, 5)[1] //gets the minimum value of the lows over the past 5 bars starting 1 day ago


        If each day has a different value you need to check over then you could solve this with a for loop

        Code:
        yourBool = false;
        for(int i = 1; i <= 5; i++)
        {
          if(Low[i]  < (SMA(5)[i]- StDev(5)[i]))
          {
             yourBool = true;
             i = 6;//to stop looping
           }
        }
        LanceNinjaTrader Customer Service

        Comment


          #5
          Thanks

          Originally posted by NinjaTrader_Lance View Post
          In that case you could do something like this
          Code:
          if(MIN(Low, 5)[1] < (SMA(5)[0]- StDev(5)[0]))
          MIN(Low, 5)[1] //gets the minimum value of the lows over the past 5 bars starting 1 day ago


          If each day has a different value you need to check over then you could solve this with a for loop

          Code:
          yourBool = false;
          for(int i = 1; i <= 5; i++)
          {
            if(Low[i]  < (SMA(5)[i]- StDev(5)[i]))
            {
               yourBool = true;
               i = 6;//to stop looping
             }
          }
          http://www.dotnetperls.com/for
          Looks perfect. Thank you so much.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          647 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          369 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          108 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          572 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          573 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X