Add "shift" function to Donchian Channel?

M

mrmac

New member
VIP
Hi, I have a very simple donchian channel indicator and would like to add a "shift" (I think it is called shift) function to it, is this possible please?

Code:
input length_used_for_calc= 10;
input Use_Other_Time_Frame=yes;
input Time_Frame=aggregationPeriod.DAY;
def h= if use_Other_Time_Frame then high(period=time_Frame) else high;
def l= if use_Other_Time_Frame then low(period=time_Frame) else low;
def highline= highest(high,length_used_for_calc);
def lowline= lowest(low,length_used_for_calc);
Plot High_Line= highline;
high_line.setdefaultColor(color.magENTA);
Plot Low_Line=lowline;
low_Line.setdefaultColor(color.magentA);
 
Last edited by a moderator:
horserider

horserider

Well-known member
VIP
Maybe you mean "Displace".
You would need;
input displace = x;
plot High_Line= (highline[displace]);
Plot Low_Line=(lowline[displace]);
 
M

mrmac

New member
VIP
Maybe you mean "Displace".
You would need;
input displace = x;
plot High_Line= (highline[displace]);
Plot Low_Line=(lowline[displace]);
Thank you very much @horserider - that is exactly what I was looking for. Appreciate your help.
 
Top