Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Best way to list a series of falling Close values

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

    Best way to list a series of falling Close values

    I'm currently trying to come up with a script that has a series of at least 4 falling close values. I've tried using the strategy builder and ninjascript, with mixed results. What is my best option?
    This is the code I've come up with on ninjascript:
    if IsFalling(close(4))) {
    {
    EnterLong()

    #2
    Hello escobar63,

    If you wanted to make this type of condition you would need 4 total conditions as you want to know about 4 falling close values. The IsFalling only checks the current close so this specifically could not be used, you could instead check that the current price is lesser than the previous and so on to accomplish the same task.

    In the builder you can create the first part of your condition by adding a condition:
    Left: Price -> Close -> 0 BarsAgo
    Center: Less than
    Right: Price -> Close -> 1 BarsAgo

    Repeat this 3 more times in the same set adding 1 BarsAgo to each value, or comparing 1 BarsAgo against 2 BarsAgo, and 2 against 3 etc.. for as long as you wanted to look back.

    I look forward to being of further assistance.

    Comment


      #3
      So, like this?

      if (Close[1] < Close[2] && Close[2] < Close[3] && Close[0] < Close[1])

      Interesting. So isFalling only check the current close. Not a series of closes

      Comment


        #4
        Hello escobar63,

        Yes that is essentially it, this is also mentioned in the documentation for IsFalling:
        Evaluates a falling condition which is true when the current value is less than the value of 1 bar ago.


        By just checking the prices yourself you recreate what the IsFalling is doing but for a larger lookback period.

        I look forward to being of further assistance.

        Comment


          #5
          Gotcha! Thank you so much.
          The next ? I have is how would I be able to make it a default of '4'. Meaning If there was a series of Falling 'Close' values that was greater than 4, how would I be able to capture that series?

          I've included a screenshot to better illustrate what I'm talking about.
          Attached Files

          Comment


            #6
            Hello escobar63,

            If you wanted 4 bars in a row you would need to use 4 conditions that span those 4 bars. That would be the BarsAgo 0 through 4. You formed 3 of the conditions in what you provided earlier, you would just need one more looking back to 3 less than 4 bars ago.

            I look forward to being of further assistance.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by NullPointStrategies, Yesterday, 05:17 AM
            0 responses
            57 views
            0 likes
            Last Post NullPointStrategies  
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            133 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            73 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            45 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            50 views
            0 likes
            Last Post TheRealMorford  
            Working...
            X