'Pine script - request.security
Request.security shows different results for accounts with Real time datas purchased and without Real time datas(i.e. free account). Is there anyone knowing what is the reason for this?
The following is the pine script as reference.
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © cocococotsoi
//@version=5
indicator("%K CU SMA RSI_0319")
swr = input(true, title='RSI')
lenRSI = input.int(14, minval=1, title='Length RSI')
srs = input.int(50, minval=1, title='Length sma RSI')
src=close
up = ta.rma(math.max(ta.change(src), 0), lenRSI)
down = ta.rma(-math.min(ta.change(src), 0), lenRSI)
rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - 100 / (1 + up / down)
mr = ta.sma(rsi, srs)
periodK = input.int(14, title="%K Length", minval=1)
smoothK = input.int(3, title="%K Smoothing", minval=1)
periodD = input.int(14, title="%D Smoothing", minval=1)
k = ta.sma(ta.stoch(close, high, low, periodK), smoothK)
customFunc()=\> ta.crossover(k, mr)
s1686=request.security('1686', timeframe.period, customFunc())
s1691=request.security('1691', timeframe.period, customFunc())
s1717=request.security('1717', timeframe.period, customFunc())
s1735=request.security('1735', timeframe.period, customFunc())
s1755=request.security('1755', timeframe.period, customFunc())
s1766=request.security('1766', timeframe.period, customFunc())
s1772=request.security('1772', timeframe.period, customFunc())
s1776=request.security('1776', timeframe.period, customFunc())
s1787=request.security('1787', timeframe.period, customFunc())
s1788=request.security('1788', timeframe.period, customFunc())
s1789=request.security('1789', timeframe.period, customFunc())
s1798=request.security('1798', timeframe.period, customFunc())
s1799=request.security('1799', timeframe.period, customFunc())
s1800=request.security('1800', timeframe.period, customFunc())
s1801=request.security('1801', timeframe.period, customFunc())
s1810=request.security('1810', timeframe.period, customFunc())
s1811=request.security('1811', timeframe.period, customFunc())
s1812=request.security('1812', timeframe.period, customFunc())
s1813=request.security('1813', timeframe.period, customFunc())
s1816=request.security('1816', timeframe.period, customFunc())
s1818=request.security('1818', timeframe.period, customFunc())
s1821=request.security('1821', timeframe.period, customFunc())
s1833=request.security('1833', timeframe.period, customFunc())
s1858=request.security('1858', timeframe.period, customFunc())
s1866=request.security('1866', timeframe.period, customFunc())
s1873=request.security('1873', timeframe.period, customFunc())
s1876=request.security('1876', timeframe.period, customFunc())
s1877=request.security('1877', timeframe.period, customFunc())
s1882=request.security('1882', timeframe.period, customFunc())
s1883=request.security('1883', timeframe.period, customFunc())
s1888=request.security('1888', timeframe.period, customFunc())
s1896=request.security('1896', timeframe.period, customFunc())
s1898=request.security('1898', timeframe.period, customFunc())
s1907=request.security('1907', timeframe.period, customFunc())
s1910=request.security('1910', timeframe.period, customFunc())
s1911=request.security('1911', timeframe.period, customFunc())
s1913=request.security('1913', timeframe.period, customFunc())
s1918=request.security('1918', timeframe.period, customFunc())
s1919=request.security('1919', timeframe.period, customFunc())
s1928=request.security('1928', timeframe.period, customFunc())
scr_label='%KCusmaRSI: '
scr_label :=s1686? scr_label + '1686\\n' : scr_label
scr_label :=s1691? scr_label + '1691\\n' : scr_label
scr_label :=s1717? scr_label + '1717\\n' : scr_label
scr_label :=s1735? scr_label + '1735\\n' : scr_label
scr_label :=s1755? scr_label + '1755\\n' : scr_label
scr_label :=s1766? scr_label + '1766\\n' : scr_label
scr_label :=s1772? scr_label + '1772\\n' : scr_label
scr_label :=s1776? scr_label + '1776\\n' : scr_label
scr_label :=s1787? scr_label + '1787\\n' : scr_label
scr_label :=s1788? scr_label + '1788\\n' : scr_label
scr_label :=s1789? scr_label + '1789\\n' : scr_label
scr_label :=s1798? scr_label + '1798\\n' : scr_label
scr_label :=s1799? scr_label + '1799\\n' : scr_label
scr_label :=s1800? scr_label + '1800\\n' : scr_label
scr_label :=s1801? scr_label + '1801\\n' : scr_label
scr_label :=s1810? scr_label + '1810\\n' : scr_label
scr_label :=s1811? scr_label + '1811\\n' : scr_label
scr_label :=s1812? scr_label + '1812\\n' : scr_label
scr_label :=s1813? scr_label + '1813\\n' : scr_label
scr_label :=s1816? scr_label + '1816\\n' : scr_label
scr_label :=s1818? scr_label + '1818\\n' : scr_label
scr_label :=s1821? scr_label + '1821\\n' : scr_label
scr_label :=s1833? scr_label + '1833\\n' : scr_label
scr_label :=s1858? scr_label + '1858\\n' : scr_label
scr_label :=s1866? scr_label + '1866\\n' : scr_label
scr_label :=s1873? scr_label + '1873\\n' : scr_label
scr_label :=s1876? scr_label + '1876\\n' : scr_label
scr_label :=s1877? scr_label + '1877\\n' : scr_label
scr_label :=s1882? scr_label + '1882\\n' : scr_label
scr_label :=s1883? scr_label + '1883\\n' : scr_label
scr_label :=s1888? scr_label + '1888\\n' : scr_label
scr_label :=s1896? scr_label + '1896\\n' : scr_label
scr_label :=s1898? scr_label + '1898\\n' : scr_label
scr_label :=s1907? scr_label + '1907\\n' : scr_label
scr_label :=s1910? scr_label + '1910\\n' : scr_label
scr_label :=s1911? scr_label + '1911\\n' : scr_label
scr_label :=s1913? scr_label + '1913\\n' : scr_label
scr_label :=s1918? scr_label + '1918\\n' : scr_label
scr_label :=s1919? scr_label + '1919\\n' : scr_label
scr_label :=s1928? scr_label + '1928\\n' : scr_label
lab_1= label.new(bar_index, 0, scr_label ,color=color.white, textcolor=color.black, style = label.style_label_down, yloc = yloc.price)
label.delete(lab_1\[35\])
c = color.rgb(0,255,0,0)
plot(0, color=c)
Free accounts: results are correct
Real time data accounts: results show both cross, crossup, cross under.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
