Second lowest low from few bars

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

    Hi,

    anyone can advise how to code second lowest low from the last 5 bars ? 🙂

    thanks

    br,

    CKW

    #92521 quote
    robertogozzi
    Moderator
    Master
    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
    GraHal
    Participant
    Master

    There you go.

    I added to here 

    Snippet Link Library

    robertogozzi thanked this post
    #92599 quote
    CKW
    Participant
    Veteran

    thanks robertogozzi. It works !

    thanks Grahal

    #110679 quote
    icharttop
    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
    Vonasi
    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
    robertogozzi
    Moderator
    Master

    That’s much simpler:

    MyHighestClose = highest[13](close)
    icharttop thanked this post
    #110698 quote
    Vonasi
    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.

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 Vonasi
6 years, 4 months ago.

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