Lowest low in 'x' previous bars

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #56412 quote
    Nobody
    Participant
    Veteran

    I am struggling with the correct syntax to represent close higher than lowest low in ‘x ‘ previous bars  . Can anyone help me with what i assume to be an easy code to get right ? I have tried for hours  to get this and fail at every turn  , very frustrating . I have acheived it writing it this way but id like to do this using a single variable so i can optomise easily

     bullish = (Close > Low[1]) OR  (Close > Low[2]) OR (Close > Low[3]) OR (Close > Low[4])

     

     

    #56413 quote
    Nobody
    Participant
    Veteran

    ive written it as

    (Close > Lowest (Low[4]))

    but it will only trigger when next bar opens below x period lowest low

    #56416 quote
    Despair
    Blocked
    Master

    Try:

    close > lowest[4](low)
    Nobody thanked this post
    #56417 quote
    Vonasi
    Moderator
    Master

    Deleted – while I check my brain!

    #56420 quote
    Nobody
    Participant
    Veteran

    Try:

    Thanks that seems to be the answer but im finding PRT very very buggy  . I wrote both your code and mine as indicator and PRT displays different ouputs some of the time  , Very frustrating .

    #56422 quote
    Nobody
    Participant
    Veteran

    Correct me if i am wrong but should not

    Increase = (Close > Low[1]) OR  (Close > Low[2]) OR (Close > Low[3]) OR (Close > Low[4])
    Count = 0
    WHILE Increase[Count] DO
    Count = Count + 1
    WEND
    RETURN Count

    Return same result as

    Increase = close > lowest[4](low)
    
    Count = 0
    WHILE Increase[Count] DO
    Count = Count + 1
    WEND
    RETURN Count
    

    Yet they are  nothing like the same  , Frustrated as ..

    #56423 quote
    Nobody
    Participant
    Veteran

    the second indicator count only drops of to zero when the close is at low of current bar not when close is below the lowest low of previous 4 bars , What am i missing here ???   Going crazy here

     

    For some reason the first indicator code listed above compares the close to the previous 4 bars ( which is what i require) whereas the second indicator compares to the previous 3 bars PLUS the Current bar , so its no wonder the count only drops to zero when the close is equal to the low of the bar . HOW do i make the second indicator compare the current bar to the previous 4 and not include current bar  ? none of this makes sense

    #56424 quote
    JC_Bywan
    Moderator
    Master

    lowest[4](low) would take the lowest of current candle and previous 3 candles, if what you want is lowest low of previous 4 candles not including current one, as per your first post bullish = (Close > Low[1]) OR  (Close > Low[2]) OR (Close > Low[3]) OR (Close > Low[4]), then the faster equivalent way to code this is by taking previous candle’s lowest of 4:

     

    bullish = close>lowest[4](low)[1]
    Nobody and thanked this post
    #56426 quote
    Nobody
    Participant
    Veteran

    lowest[4](low) would take the lowest of current candle and previous 3 candles, if what you want is lowest low of previous 4 candles not including current one, as per your first post bullish = (Close > Low[1]) OR (Close > Low[2]) OR (Close > Low[3]) OR (Close > Low[4]), then the faster equivalent way to code this is by taking previous candle’s lowest of 4:

    Thank you very much i was starting to lose my mind . Seriously i spent half a day trying to sort this out myself

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

Lowest low in 'x' previous bars


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Nobody @brisvegas Participant
Summary

This topic contains 8 replies,
has 4 voices, and was last updated by Nobody
8 years, 2 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 12/23/2017
Status: Active
Attachments: No files
Logo Logo
Loading...