Second lowest low from few bars

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #92515 quote
    CKWCKW
    Participant
    Veteran

    Hi,

    anyone can advise how to code second lowest low from the last 5 bars ? šŸ™‚

    thanks

    br,

    CKW

    #92521 quote
    robertogozzirobertogozzi
    Moderator
    Legend
    SecondLow = 999999
    LookBack  = 5
    ll = lowest[LookBack](low)
    FOR i = 0 to (LookBack - 1)
       IF low[i] > ll THEN
          SecondLow = min(SecondLow,low[i])
       ENDIF
    NEXT

    There you go.

    icharttop thanked this post
    #92523 quote
    GraHalGraHal
    Participant
    Legend

    There you go.

    I added to hereĀ Snippet Link Library

    robertogozzi thanked this post
    #92599 quote
    CKWCKW
    Participant
    Veteran

    thanksĀ robertogozzi. It works !

    thanks Grahal

    #110679 quote
    icharttopicharttop
    Participant
    Junior

    Hi Roderto could l use the coding that you used to findĀ  Second low 5 bars, l want to find my highest close in the last 13 bars

    #110696 quote
    VonasiVonasi
    Moderator
    Master

    Try this:

    SecondHigh = 0
    LookBack  = 13
    hh = highest[LookBack](high)
    FOR i = 0 to (LookBack - 1)
       IF high[i] < hh THEN
          SecondHigh = max(SecondHigh,high[i])
       ENDIF
    NEXT
    icharttop thanked this post
    #110697 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    That’s much simpler:

    MyHighestClose = highest[13](close)
    icharttop thanked this post
    #110698 quote
    VonasiVonasi
    Moderator
    Master

    I scan read (again!) and assumed the request was for a second highest close as this topic is about finding the second lowest close and not the lowest!

    icharttop – if you want the highest close then use Roberto’s code but if you want the second highest then use mine! šŸ™‚

    icharttop thanked this post
Viewing 8 posts - 1 through 8 (of 8 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

Second lowest low from few bars


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
CKW @ckw Participant
Summary

This topic contains 7 replies,
has 5 voices, and was last updated by VonasiVonasi
6 years, 11 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 02/28/2019
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...