OPEN-SOURCE SCRIPT
Timeframe Loop

The Timeframe Loop publication aims to visualize intrabar price progression in a new, different way.

🔶 CONCEPTS and USAGE
I got inspiration from the Pressure/Volume loop, which is used in Mechanical Ventilation with Critical Care patients to visualize pressure/volume evolution during inhalation/exhalation.

The main idea is that intrabar prices are visualized by a loop, going to the right during the first half and returning to the left towards its closing point. Here, the main chart timeframe (CTF) is 4 hours, and we see the movements of eight 30-minute lower timeframe (LTF) periods, highlighted by four yellow dots/lines (first 2 hours -> "Right") and four blue dots/lines (last 2 hours <- "Left"):

🔹 BTF
If "Show Lowest TF" is enabled, the LTF is split into another lower TF (BTF - "Base TF"); in this case, the 30-minute LTF is split into 10 parts of 3 minutes (BTF):

Enabling "Loop Lowest TF" will enable the BTF to react similarly to the largest loop; from halfway, it will return to its startpoint:

Here is a more detailed example:

🔹 Mini-Candles
The included option "Mini-Candles" will bring even more detail, showing the LTF as Japanese candlesticks with user-defined colors and adjustable body width; in this example, the mini-candles associated with the first half (yellow lines/dots) are green/red, while blue/fuchsia in the second half (blue lines/dots):
CTF 10 minutes, LTF 1 minute, BTF 5 seconds

One can see the detailed intrabar price progression in one glance.
CTF 5 minutes, LTF 1 minute, BTF 5 seconds

If the LTF/BTF ratio, divided by two, results in a non-integer number, the right side will be a vertical line instead of just a turning point. In that case, the smaller, most right blue loop will be situated at the right of that line.
🔶 SETTINGS
🔹 Timeframes
No need to worry about the order of both timeframes; BTF will be the lowest TF of the 2, LTF the highest; both have to be lower than the main chart TF (CTF); otherwise, it will result in the error: "`Lower Timeframes` should be lower than current chart timeframe".

The ratio LTF / BTF should be equal or higher than 2; otherwise, this error will show: "`Lower Timeframe` should minimally be twice the `Base (smallest) Timeframe`"
Lastly, the ratio CTF / BTF should be lower than 500; otherwise, this error will pop up: "`Current Chart timeframe` / `Lower Timeframe` should be less than 500."
I have tried to capture runtime errors as best I could. If one should be triggered (red exclamation mark next to the title), it is best to increase the lowest TF.
🔹 Options
"Show Steps" can be useful to see how the script works, where the location of the current price is compared against the position of the left (L) and right (R) labels:

🔹 Style

🔶 CONCEPTS and USAGE
I got inspiration from the Pressure/Volume loop, which is used in Mechanical Ventilation with Critical Care patients to visualize pressure/volume evolution during inhalation/exhalation.
The main idea is that intrabar prices are visualized by a loop, going to the right during the first half and returning to the left towards its closing point. Here, the main chart timeframe (CTF) is 4 hours, and we see the movements of eight 30-minute lower timeframe (LTF) periods, highlighted by four yellow dots/lines (first 2 hours -> "Right") and four blue dots/lines (last 2 hours <- "Left"):
🔹 BTF
If "Show Lowest TF" is enabled, the LTF is split into another lower TF (BTF - "Base TF"); in this case, the 30-minute LTF is split into 10 parts of 3 minutes (BTF):
Enabling "Loop Lowest TF" will enable the BTF to react similarly to the largest loop; from halfway, it will return to its startpoint:
Here is a more detailed example:
🔹 Mini-Candles
The included option "Mini-Candles" will bring even more detail, showing the LTF as Japanese candlesticks with user-defined colors and adjustable body width; in this example, the mini-candles associated with the first half (yellow lines/dots) are green/red, while blue/fuchsia in the second half (blue lines/dots):
CTF 10 minutes, LTF 1 minute, BTF 5 seconds
One can see the detailed intrabar price progression in one glance.
CTF 5 minutes, LTF 1 minute, BTF 5 seconds
If the LTF/BTF ratio, divided by two, results in a non-integer number, the right side will be a vertical line instead of just a turning point. In that case, the smaller, most right blue loop will be situated at the right of that line.
- 10 minutes / 1 minute = 10 -> 10 / 2 = 5 parts
- 5 minutes / 1 minute = 5 -> 5 / 2 = 2.5 parts
🔶 SETTINGS
🔹 Timeframes
- Lower Timeframe 1
- Lower Timeframe 2
No need to worry about the order of both timeframes; BTF will be the lowest TF of the 2, LTF the highest; both have to be lower than the main chart TF (CTF); otherwise, it will result in the error: "`Lower Timeframes` should be lower than current chart timeframe".
The ratio LTF / BTF should be equal or higher than 2; otherwise, this error will show: "`Lower Timeframe` should minimally be twice the `Base (smallest) Timeframe`"
Lastly, the ratio CTF / BTF should be lower than 500; otherwise, this error will pop up: "`Current Chart timeframe` / `Lower Timeframe` should be less than 500."
I have tried to capture runtime errors as best I could. If one should be triggered (red exclamation mark next to the title), it is best to increase the lowest TF.
🔹 Options
- Show Lowest TF: Show BTF progression.
- Loop Lowest TF: Enabling will let the BTF line return halfway.
- Show Mini-Candles
- Show Steps
"Show Steps" can be useful to see how the script works, where the location of the current price is compared against the position of the left (L) and right (R) labels:
🔹 Style
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Who are PineCoders?
tradingview.com/chart/SSP/yW5eOqtm-Who-are-PineCoders/
TG Pine Script® Q&A: t.me/PineCodersQA
- We cannot control our emotions,
but we can control our keyboard -
tradingview.com/chart/SSP/yW5eOqtm-Who-are-PineCoders/
TG Pine Script® Q&A: t.me/PineCodersQA
- We cannot control our emotions,
but we can control our keyboard -
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Who are PineCoders?
tradingview.com/chart/SSP/yW5eOqtm-Who-are-PineCoders/
TG Pine Script® Q&A: t.me/PineCodersQA
- We cannot control our emotions,
but we can control our keyboard -
tradingview.com/chart/SSP/yW5eOqtm-Who-are-PineCoders/
TG Pine Script® Q&A: t.me/PineCodersQA
- We cannot control our emotions,
but we can control our keyboard -
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.