How to get the max or min of a subset?

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

    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
    NicolasNicolas
    Keymaster
    Legend

    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
    robertogozzirobertogozzi
    Moderator
    Legend

    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
    thomas2004chthomas2004ch
    Participant
    Senior

    Many thanks!

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

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

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 thomas2004chthomas2004ch
7 years, 7 months ago.

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