Hello community,
does anybody know a way to find the highest (or lowest) close of x bars (not the highest high or the lowest low)?
Thanks in forward and have a good week!
Tommi
Hello community,
does anybody know a way to find the highest (or lowest) close of x bars (not the highest high or the lowest low)?
Thanks in forward and have a good week!
Tommi
@Hiten7405 said in Find the highest (or lowest) close of x bars:
Thank you @Hiten7405 . But I think this are the highs and lows of the last candles not the the close values.
@MT4Nutzer
It shows the high and low price between the selected candles.
@MT4Nutzer
Initiate then use the loop block and a condition block.
Suppose x is the result
Initiate x (such as close of the start candle)
Loop n times for the candles
Use condition block to compare x and close
save any new value to x
[Amended: loop n times not x times]
@sktsec said in Find the highest (or lowest) close of x bars:
@MT4Nutzer
Initiate then use the loop block and a condition block.Support x is the result
Initiate x (such as close the start candle)
Loop x time for the candles
Use condition block to compare x and close
save any new value to x
Thank you @sktsec . I want to try it.
result: The highest closest in recent nBars (including current Candle: ID0)
nBars : Input number of bars
loopID: Before the loop -1. +1 for every loop. i.e. loop start from Candle 0
provisionalResult: Highest close in looping process
So you only need 2 blocks to get your result.
You can customize the starting Candle ID. But remember to set the looping candle ID be startCandleID -1 before entering the loop
This is the case for highest. For the lowest, remember to set the initial value of the provsionalResult to a large number, say, 99999999. (of course, you would modify the condition block as well)
Sure you can add a block to initiate this variable to the value of starting Candle close. That is up to your preference.
Great! Thank you very much @sktsec !
I think it will be a long evening.