'------------------------- past regression deviated -------------------------------------------------
indiid++
if indicatorslistsel.item(indiid)="x" then

if lbar=1 then
periodstr=past_regression_deviatedperiodedit.text
defstr prdlogmode=str$(past_regression_deviated_log_mode.checked)
cpptmpfuncreturn=varptr$(past_regression_deviated(varptr(periodstr),varptr(prdlogmode)))
end if

barsback=numbars '<--- can also be something like VAL(past_regression_deviatedbarsbackedit.text)

if ibar>=lastbar-barsback then
    indicolor(drawid)=orange '<--- replace with your color
    bufnamestr="prd_high2Buffer"
    .Data_Indi.Cell(drawid,lbar)= varptr$(getbufferdata(varptr(bufnamestr),varptr(offsetstr)))
    drawid=drawid+2
indicolor(drawid)=orange '<--- replace with your color
    bufnamestr="prd_low2Buffer"
    .Data_Indi.Cell(drawid,lbar)= varptr$(getbufferdata(varptr(bufnamestr),varptr(offsetstr)))
    drawid=drawid+2
end if

end if
'------------------------- End past regression deviated -------------------------------------------------
