Pine Script V5 Request.security Function Documentation

You can fetch data from – even FX, crypto, or stocks – and combine them:

// Fetch the close price of AAPL on the 1-hour timeframe aaplClose = request.security("AAPL", "1H", close) pine script v5 request.security function documentation

No – it must be at the . But you can wrap it in a function:

The resolution you want to pull data from (e.g., "60" for hourly, "D" for daily, "W" for weekly). You can fetch data from – even FX,

//@version=5 indicator("MTF EMA", overlay=true) // Fetching data dailyClose = request.security(syminfo.tickerid, "D", close) dailyEma = request.security(syminfo.tickerid, "D", ta.ema(close, 20)) plot(dailyEma, color=color.yellow, title="Daily 20 EMA") Use code with caution. Avoiding "Repainting" (The Most Common Trap)

: If true , the script won't halt if the symbol name is incorrect; it will return na instead. Key Usage Rules Avoiding "Repainting" (The Most Common Trap) : If

get_htf_ma(ma_len) => request.security(syminfo.tickerid, "1D", ta.sma(close, ma_len))

//@version=5 indicator("Daily Close on Intraday", overlay=true) // Fetch daily close price for the current symbol dailyClose = request.security(syminfo.tickerid, "D", close) plot(dailyClose, color=color.new(color.blue, 0), linewidth=2) Use code with caution. Copied to clipboard

Go to Top