Hello Amine!Really many thanks for your reply and your appreciate suggest!
Knowing that the minimum time of the candle is 10 second, with your system you have created a virtual 8 second candle! This is great.
The problem is what happen at the price inside this 8 second? Look ...

How you can see the output value in this 8 seconds is 2 pips ... really the movement is 11 pips up and 13 down but it cannot detect.
For this reason in my idea I need to work in ticks and not en candle.
FIRST PROPOSE:The same method that you have propose but in a small time. Get the price value every little time (1 second) and compare all variables to define the maximum and the minimum.
SECOND PROPOSE:Every tick, in a lapse of time (8 second), detect the maximum and minimum price:

I know that to get the maximum and minimum maybe we need to get the value of the price in EVERY TICK but maybe is possible use some trick to do it!
I'm thinking to use some indicator to assign the pivot to a specific time and then compare with price actual... for example ZIGZAG indicator ...but in tick chart it does not detect the pivot very well.
I looking forward to search the best solution.
Many thanks for your support!
