Price Time Dilation
"Price Time Dilation" by RicardoSantos, MPL-2.0. Ported to FloScript by FloSignals; modifications under MPL-2.0. Original: Price Time Dilation (v1.0), read 2026-11-15T18:51:53.979Z; source language v5.
Licence: Mozilla Public License 2.0 (MPL-2.0) — full text. The source is published with it, modifications included, under the same licence.
Price Time Dilation by RicardoSantos, ported from Pine v5. Pane indicator with 1 plot and 2 inputs.
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © RicardoSantos
// ------------------------------------------------------------------------------------------------
// Original author: RicardoSantos
// Original title: Price Time Dilation
// Licence: MPL-2.0 (the header above is the original notice, kept verbatim)
// Pine version: 5
// Fetched: 2026-11-15
// Ported to FloScript by FloSignals; modifications under MPL-2.0.
// Converter: @flosignals/floscript 0.1.0, strict mode, score 100/100
// ------------------------------------------------------------------------------------------------
//@floscript=1
//@version=5
indicator(title='Price Time Dilation', shorttitle="PTD", overlay=false)
// Disclaimer:
// It's worth mentioning that this code is experimental and might not have a specific purpose and, or meaning
// within the context of trading strategies or financial context.
int _SECOND = 10000
int _MINUTE = 60 * _SECOND
int _HOUR = 60 * _MINUTE
int _DAY = 24 * _HOUR
int _WEEK = 7 * _DAY
calc_tf(string tf) =>
switch tf
'1' => _MINUTE
'60' => _HOUR
'240' => _HOUR * 4
'1440' => _DAY
'1D' => _DAY
'1W' => _WEEK
=> 0
// @function Calculate the relative proper price time dilation between two observers in special relativity.
// In summary, calculates how much time dilation occurs due to relative velocity between two observers
// according to special relativity principles. It is then applied in a trading context to visualize this effect
// on price action using a histogram plot.
// @param proper Time difference as a rate of the larger timeframe
// @param velocity Speed of price at the lower time
// @param speedoflight Speed of light `C` or the speed of price at the higher timeframe
// @returns price time dilation between two timeframes.
time_dilation(int proper, float velocity, float speedoflight) =>
proper / math.sqrt(1.0 - math.pow(velocity / speedoflight, 2.0))
string ltf = input.timeframe("1W", "Lower Timeframe:", options=['1', '60', '240', '1440', '1D', '1W'], tooltip="")
string htf = input.timeframe("1M", "Higher Timeframe:", options=['60', '240', '1440', '1D', '1W', '1M'], tooltip="")
int dt = (time - time(ltf)) / calc_tf(ltf) // proper time: time difference as a rate of the larger timeframe
float dp = ta.valuewhen(dt == 0, open, 0)
float v = math.abs(close - dp) //ta.atr(10) // velocity: speed of price at lower timeframe
float c = request.security(syminfo.tickerid, htf, ta.atr(10)) // speed of light or the speed of price at the larger timeframe
plot(v - time_dilation(dt, v, c), style=plot.style_histogram)
This file is under the Mozilla Public License 2.0; it is a port of the original by RicardoSantos, with the original licence header kept and the changes made for FloScript noted in the file.
- v1
Library refresh 2026-11-15
Disclaimer. Scripts are written and published by members, or ported by FloSignals from open-source originals, and are their authors' own work and opinion. FloSignals does not review them for correctness and nothing in a script is financial advice or a recommendation to buy or sell anything — read the Risk Disclaimer. Posting here is under the Community Rules; a script that is not the poster's to post can be reported as the Copyright & Takedowns page says.

Comments (0)
No comments yet. Members can leave one.