Thank you very much. Now I am able to replicate the Donchian Upper and Lower Bands (blue dots)
However, what I really want to find out is to create a narrower band of the Donchian, but keep the overall trend lines. I use the code below. Although the band has narrowed red dots, the look of the tighter band does not exactly match the Donchian bands. Any advice on how I should modify my codes to correct this? The codes are below and I have also attached the screenshot. Thank you very much.
LBand = lowest[interval](low[1]) // same as Donchian Lower Band
UBand = highest[interval](high[1]) // same as Donchian Upper Band
diffBand = (UBang-Lband)/Bfactor
LBandNew=LBand+diffband
UBandNew=UBand-diffband
return LBandNew,UBandNew, LbandOrig, UBandOrig
