Right now, reference rate and % tolerance are input variables that must be input/updated manually. Hopefully one day Tradingview allows the automatic update to be scripted.
In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.
//@version=2 //FxLowe - CNY Peg Bands. study(title = "CNY Peg Band", overlay = true) ReferenceRate = input(title="Reference Rate", type=float, defval=6.5233) TolerancePercent = input(title="Percentage Tolerance", type=float, defval=2.1) band = ReferenceRate * (TolerancePercent/100) plot(ReferenceRate+band, title="Upper Bound", color=orange, editable=true) plot(ReferenceRate-band, title="Lower Bound", color=orange, editable=true)