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

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
           }
        }
        Iterate over numbers with for. Increment or decrement an index int from a start to an end value.
        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 junkone, 04-28-2024, 02:19 PM
          8 responses
          92 views
          1 like
          Last Post brucerobinson  
          Started by mkouitra, 10-23-2021, 04:40 PM
          17 responses
          1,964 views
          0 likes
          Last Post NinjaTrader_Jason  
          Started by Vietanhnguyen2hotmailcom, 05-03-2024, 10:29 AM
          4 responses
          29 views
          0 likes
          Last Post Vietanhnguyen2hotmailcom  
          Started by PhillT, 04-19-2024, 02:16 PM
          4 responses
          37 views
          0 likes
          Last Post PhillT
          by PhillT
           
          Started by ageeholdings, 05-01-2024, 05:22 AM
          5 responses
          40 views
          0 likes
          Last Post ageeholdings  
          Working...
          X