Hi

I am a new amibroker user

I try these days to build an indicator , its purpose is to connect

in chronological order between highest high & lowest low forming during each month ,

creating a trendline extend for a 10 day period

However i face a small problem which is each line connecting High and Low ending with an a ray line that bear the last value for my indicator

I want to clear that ray , i tried to use REF() Function but no thing have changed

The second issue relating to continuousness and repeating

I write the code and i want it to be repeated for next months

How can i do this ?

Thanks in advance

```
Y=Param("Year",2016,1900,2100);
M=Param("Month",1,1,12);
AR=Year()==Y AND Month()==M;
P1=LastValue(Highest(ValueWhen(AR,H,1)));
P2=LastValue(Lowest(ValueWhen(AR,L,1)));
T1=Cum(IIf(Cum(AR AND H==P1)>=1,1,IIf(Cum(AR AND H==P1)<1,0,1)));
T2=Cum(IIf(Cum(AR AND L==P2)>=1,1,IIf(Cum(AR AND L==P2)<1,0,1)));
TD=LastValue(T1-T2);
XP=IIf(IIf(TD>0,1,2)==1,P1,P2);
YP=IIf(IIf(TD>0,1,2)==2,P1,P2);
XT=IIf(XP==P1,T1,T2);
YT=IIf(XP==P2,T1,T2);
MW=XP+IIf(XP>YP,(-1*((abs(LastValue((XP-YP)/10))*YT))),(abs(LastValue((XP-YP)/10))*YT));
MWT=Ref(Ref(Ref(MW,LastValue(-1*(YT))+10),LastValue(Cum(1)-11)),LastValue(-1*(Cum(1)-(Cum(AR)+BarsSince(AR)))));
MWT;
Plot(MWT,"Neowave",colorRed);
A=Year()==IIf(M==12,Y+1,Y) AND Month()==IIf(M==12,1,M+1);
P1=LastValue(Highest(ValueWhen(A,H,1)));
P2=LastValue(Lowest(ValueWhen(A,L,1)));
T1=Cum(IIf(Cum(A AND H==P1)>=1,1,IIf(Cum(A AND H==P1)<1,0,1)));
T2=Cum(IIf(Cum(A AND L==P2)>=1,1,IIf(Cum(A AND L==P2)<1,0,1)));
TD=LastValue(T1-T2);
XP1=IIf(IIf(TD>0,1,2)==1,P1,P2);
YP1=IIf(IIf(TD>0,1,2)==2,P1,P2);
XT1=IIf(XP1==P1,T1,T2);
YT1=IIf(XP1==P2,T1,T2);
MW=YP+IIf(XP1<YP,(-1*((abs(LastValue((XP1-YP)/10))*XT1))),(abs(LastValue((XP1-YP)/10))*XT1));
MWT=Ref(Ref(Ref(MW,LastValue(-1*(XT1))+10),LastValue(Cum(1)-11)),LastValue(-1*(Cum(1)-(Cum(AR)+BarsSince(AR))+10)));
MWT;
Plot(MWT,"Neowave",colorRed);
A=Year()==IIf(M==12,Y+1,Y) AND Month()==IIf(M==12,1,M+1);
P1=LastValue(Highest(ValueWhen(A,H,1)));
P2=LastValue(Lowest(ValueWhen(A,L,1)));
T1=Cum(IIf(Cum(A AND H==P1)>=1,1,IIf(Cum(A AND H==P1)<1,0,1)));
T2=Cum(IIf(Cum(A AND L==P2)>=1,1,IIf(Cum(A AND L==P2)<1,0,1)));
TD=LastValue(T1-T2);
XP=IIf(IIf(TD>0,1,2)==1,P1,P2);
YP=IIf(IIf(TD>0,1,2)==2,P1,P2);
XT=IIf(XP==P1,T1,T2);
YT=IIf(XP==P2,T1,T2);
MW=XP+IIf(XP>YP,(-1*((abs(LastValue((XP-YP)/10))*YT))),(abs(LastValue((XP-YP)/10))*YT));
MWT=Ref(Ref(Ref(MW,LastValue(-1*(YT))+10),LastValue(Cum(1)-11)),LastValue(-1*(Cum(1)-(Cum(AR)+BarsSince(AR))+20)));
MWT;
Plot(MWT,"Neowave",colorRed);
```

That's My Code and here is a screen shoot for the result