How to convert "Std Error Bands" Y-axis 0 to 2, instead of close price

Hi, I have been using Std Error Bands from TradingView for my trade set up before I switch to Amibroker. I notice the different number show at Y-axis of the Std Error Band indicator.
TradingView show range from 0 to 2
Amibroker show stock close price

Is there away to convert? Please advice or show me example, I understand this group encourage newbie like me to learn. Please please give me more info so that I can learn. ( I have "0" coding background )

Attach photo and the code to explain what I'm referring to:

ami std error band picture_LI
tradingview str error band picture


/* Standard Error Bands */
Periods = Param("Standard Error", 18, 1, 100, 1); 

function SteBand( array, periods, upper ) 
{ 
  Lr = LinearReg( array, periods ); 
  se = StdErr( array, periods ); 
  return LR + IIf( upper, 1, -1 ) * 2 * se; 
} 

upperstderrband = SteBand( C, Periods, True ); 
lowerstderrband = SteBand( C, Periods, False ); 
midstderrband = (upperstderrband + lowerstderrband )/2; 

Plot( Close, "Close", colorBlack, styleCandle );
Plot( upperstderrband , "upperstderrband ", colorGreen, 4 );
Plot( lowerstderrband , "lowerstderrband ", colorRed, 4 ); 
Plot( midstderrband , "midstderrband ", colorBlack , styleLine); 

GraphXSpace = 3;
TradingView Code -  I will attach Amibroker code too
study("Standard Error Bands", overlay=false)
// idea: https://es.tradingview.com/script/qQjavJxT-Standard-Error-of-the-Estimate-Composite-Bands/

mmax(x,y) =>
    m = 0.0
    for i=1 to y
        if x[i] > m
            m := x[i]
    m
    
mmin(x,y) =>
    m = 0.0
    for i=1 to y
        if x[i] < m
            m := x[i]
    m

scale(src, num) => (close - mmin(close, num)) / (mmax(close, num) - mmin(close, num))

// Standard Error of the Estimate Algorithm's
beta(array,per) =>
    val1 = sum(n*array,per)-(per*sma(n,per)*sma(array,per))
    val2 = sum(pow(n,2),per)-(per*pow(sma(n,per),2))
    calcB = val1/val2
    
alpha(array,per) =>
    calcA = sma(array,per)-(beta(array,per)*sma(n,per))
    
see(array,per,mult,dir,type) =>
    lr = linreg(array,per,0)
    val1 = (sum(pow(array,2),per))-((alpha(array,per)*sum(array,per)))-((beta(array,per)*sum(n*array,per)))
    val2 = per - 2
    narrow = sqrt(val1/val2)
    est = sum(pow(lr-array,2),per) / (per - 2 )
    wide = sqrt(est)
    d = dir ? 1 : -1
    band = type ? narrow : wide
    seb = lr + d * mult * band

src = input(close, title="Data source")
len = input(21, title="Rolling Lookback Window")
sdeg = input(3, title="Smoothing Factor")

data = scale(src, 500)

plot(data, color=navy, linewidth=2, transp=0)
UNB = plot(sma(see(data, len, 3, true, true), sdeg), linewidth=5, color=red, transp=40)
middle = plot(sma(linreg(data, len, 0),sdeg), color=orange, style=line, transp=0)
BNB = plot(sma(see(data, len, 3, false, true), sdeg), linewidth=5, color=green, transp=40)
fill(UNB, BNB, title="NarrowSEE", color=blue, transp=97)

Why would you want to do that?

It is way better to have bands expressed in ACTUAL PRICES because they are tradable.

Artificial 0..2 scale does not refer to anything related to trading.

You have the answer in your pine script. What they show are NOT "Standard error bands".
They show "normalized" error bands that are artificially scaled to 0..2 range for no reason.
(see their "scale" function in the pinescript you have given).

You should remove data = scale(src, 500) call from PineScript which does artificial scaling and then you will have proper output (i.e. expressed in tradeable prices not some artificial numbers)

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.