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 Mindset, 04-21-2026, 06:46 AM
    0 responses
    54 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    72 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    38 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    99 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    60 views
    0 likes
    Last Post PaulMohn  
    Working...
    X