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])
ive written it as
(Close > Lowest (Low[4]))
but it will only trigger when next bar opens below x period lowest low
Deleted – while I check my brain!
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 .
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 ..
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
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]
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]
|
Thank you very much i was starting to lose my mind . Seriously i spent half a day trying to sort this out myself