Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Finding MIN Value without using MIN indicator

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

    Finding MIN Value without using MIN indicator

    Hello,
    I would like to know if there is another possible way to get the minimum value of a Series.
    The problem i'm facing right now is that the MIN Indicator code use for loop
    I'm searching for very long periods (14400+) which eats up my memory in backtest.

    hope someone can assist.

    #2
    Hello bugo11,

    Thanks for your post.

    Yes, if you use MIN() and do a look back to the beginning of the data series, on each new bar, that would be very inefficient.

    When a script is added to a chart, it will process on all of the bars starting at the beginning of the data series and run all the way to the latest bar.

    I would suggest writing an indicator that will process each bar once and simply compare the value to the lowest previously found and if lower to then save as the new low. When the indicator reaches the right edge you would have your answer.

    Here is an example, using the Low price series


    private double myLow = double.MaxValue; // create with the maximum possible value

    In OnBarUpdate()

    if (Low[0] < myLow)
    {
    myLow = Low[0]; // assign the current bar low to the variable myLow.
    }




    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    596 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    343 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    103 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    556 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    554 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X