Hello,
I give you my version. I use it with various indicators. I think the author is Marplex.
Sorry for my bad english.
inputs: periodlen(1),colorH(white), colorL(yellow),period(30),smooth(1),type(1),length(20),leftstrength(3),RightStrength(1),Bartol(3);
vars: Pivotprice1(0), pivotbar1(0),Pivotprice2(0), pivotbar2(0),Pivotprice3(0), pivotbar3(0),Pivotprice4(0), pivotbar4(0),
Pivotprice5(0), pivotbar5(0),Pivotprice6(0), pivotbar6(0),Pivotprice7(0), pivotbar7(0),Pivotprice8(0), pivotbar8(0);
value1=[color="Red"]yourindicator[/color](periodlen);
//market pivot:
// pivot low
condition3 = pivot(low,length,leftstrength,RightStrength,1,-1,pivotprice3,pivotbar3)<>-1;
condition4 = pivot(low,length,leftstrength,RightStrength,2,-1,pivotprice4,pivotbar4)<>-1;
//pivot high
condition5 = pivot(high,length,leftstrength,RightStrength,1,1,pivotprice5,pivotbar5)<>-1;
condition6 = pivot(high,length,leftstrength,RightStrength,2,1,pivotprice6,pivotbar6)<>-1;
//indicator pivot:
//pivot low
condition1 = pivot(value1,length,leftstrength,RightStrength,1,-1,pivotprice1,pivotbar1)<>-1;
condition2 = pivot(value1,length,leftstrength,RightStrength,2,-1,pivotprice2,pivotbar2)<>-1;
//pivot high
condition7 = pivot(value1,length,leftstrength,RightStrength,1,1,pivotprice7,pivotbar7)<>-1;
condition8 = pivot(value1,length,leftstrength,RightStrength,2,1,pivotprice8,pivotbar8)<>-1;
//last low
if condition3 and condition4 and condition2 and condition1
and (absvalue(pivotbar1-pivotbar3)<bartol)
and (absvalue(pivotbar2-pivotbar4)<bartol)
and(pivotbar3=RightStrength or pivotbar1 = RightStrength)
and (Pivotprice3<=Pivotprice4 and pivotprice1>Pivotprice2)
and barstatus(1)=2 then begin
value2 = tl_new_s(D[pivotbar4],time_s[pivotbar4],l[pivotbar4],D[pivotbar3],time_s[pivotbar3],l[pivotbar3]);
tl_setcolor(value2,colorL);
tl_setsize(value2,3);
end;
//last high
if condition5 and condition6 and condition7 and condition8
and (absvalue(pivotbar7-pivotbar5)<bartol)
and (absvalue(pivotbar8-pivotbar6)<bartol)
and(pivotbar5=RightStrength or pivotbar7 = RightStrength)
and (Pivotprice5>=Pivotprice6 and pivotprice7<Pivotprice8)
and barstatus(1)=2 then begin
value3 = tl_new_s(D[pivotbar6],time_s[pivotbar6],h[pivotbar6],D[pivotbar5],time_s[pivotbar5],h[pivotbar5]);
tl_setcolor(value3,colorh);
tl_setsize(value3,3);
end;
Sincerely,
Franck