How to get the max or min of a subset?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #91928 quote
    thomas2004ch
    Participant
    Average

    Hi,

    One can get the min or max of a dataset as myMIN = lowest[50](CLOSE). But now I want to get the min of last 30. Surely I can do this with a FOR loop. But it will be efficient when I can do as: min = lowest[last30](CLOSE).

    What I want is to get the double bottom with 50 bars. The first bottom should be inside the first 5 bars and the second should be inside the last 30 bars (from the 20th to the 50th).

    Is this possible?

    #91936 quote
    Nicolas
    Keymaster
    Master

    Rough idea: use BARINDEX to count if the last lowest price saved in a variable is older than 30 bars or not. I let you think of it, let me now if it is not clear enough and I’ll try to code it accordingly to what I think about..

    #91947 quote
    robertogozzi
    Moderator
    Master

    Using FOR..NEXT will allow you to know on which bar that LOW happened, but if you don’t mind when it happend, this can do:

    Bottom1 = lowest[5](low)      //lowest from bar 0  through bar 4
    Bottom2 = lowest[30](low[21]) //lowest from bar 21 through bar 50
    #92009 quote
    thomas2004ch
    Participant
    Average

    Many thanks!

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.

How to get the max or min of a subset?


ProBuilder: Indicators & Custom Tools

New Reply
Author
Summary

This topic contains 3 replies,
has 3 voices, and was last updated by thomas2004ch
6 years, 11 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 02/21/2019
Status: Active
Attachments: No files
Logo Logo
Loading...