Skip to content

Instantly share code, notes, and snippets.

@carloswm85
Last active April 29, 2024 13:40
Show Gist options
  • Save carloswm85/fcc92cb1a915ca3bba16d32922f0fbb2 to your computer and use it in GitHub Desktop.
Save carloswm85/fcc92cb1a915ca3bba16d32922f0fbb2 to your computer and use it in GitHub Desktop.
// Add the values you want
rsi = ta.rsi(close,14)
// Define the function
// With one call, you'll get back 9 values
fGetImported(_timeframe) =>
request.security(symbol = syminfo.tickerid, timeframe = _timeframe, expression = [open, high, low, close, rsi, open[1], high[1], low[1], close[1]], gaps = barmerge.gaps_off)
// Implement the function for different timeframes
// 3 timeframes
[open_4h, high_4h, low_4h, close_4h, rsi_4h, popen_4h, phigh_4h, plow_4h, pclose_4h] = fGetImported('240')
[open_1D, high_1D, low_1D, close_1D, rsi_1D, popen_1D, phigh_1D, plow_1D, pclose_1D] = fGetImported('D')
[open_1W, high_1W, low_1W, close_1W, rsi_1W, popen_1W, phigh_1W, plow_1W, pclose_1W] = fGetImported('W')
// You'll get in total 27 values from imported timeframes
// Use the values in plots, tables, etc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment