Code:
_SECTION_BEGIN(" Turtle Soup Exploration");
/*
TSL=
L==LLV(L,20) AND Ref(L,-1)!=Ref(LLV(L,19),-1) AND Ref(L,-2)!=Ref(LLV(L,18),-2) AND Ref(L,-3)!=Ref(LLV(L,17),-3) AND C>O AND H-L>=ATR(15) OR
L==LLV(L,20) AND Ref(L,-1)!=Ref(LLV(L,19),-1) AND Ref(L,-2)!=Ref(LLV(L,18),-2) AND Ref(L,-3)!=Ref(LLV(L,17),-3) AND C>O AND Ref(C,-1)-L>=ATR(15);
TSS=
H==HHV(H,20) AND Ref(L,-1)!=Ref(HHV(L,19),-1) AND Ref(L,-2)!=Ref(HHV(L,18),-2) AND Ref(L,-3)!=Ref(HHV(L,17),-3) AND C<O AND H-L>=ATR(15) OR
H==HHV(H,20) AND Ref(L,-1)!=Ref(HHV(L,19),-1) AND Ref(L,-2)!=Ref(HHV(L,18),-2) AND Ref(L,-3)!=Ref(HHV(L,17),-3) AND C<O AND Ref(C,-1)-L>=ATR(15);
*/
TSL=
(L==LLV(L,20) AND Ref(L,-1)!=Ref(LLV(L,19),-1) AND Ref(L,-2)!=Ref(LLV(L,18),-2) AND Ref(L,-3)!=Ref(LLV(L,17),-3) OR
L==LLV(L,20) AND Ref(L,-1)!=Ref(LLV(L,19),-1) AND Ref(L,-2)!=Ref(LLV(L,18),-2) AND Ref(L,-3)!=Ref(LLV(L,17),-3)) AND EMA(V,15) > 100000 AND V > 150000 AND C>50;
TSS=
(H==HHV(H,20) AND Ref(L,-1)!=Ref(HHV(L,19),-1) AND Ref(L,-2)!=Ref(HHV(L,18),-2) AND Ref(L,-3)!=Ref(HHV(L,17),-3) OR
H==HHV(H,20) AND Ref(L,-1)!=Ref(HHV(L,19),-1) AND Ref(L,-2)!=Ref(HHV(L,18),-2) AND Ref(L,-3)!=Ref(HHV(L,17),-3)) AND EMA(V,15) > 100000 AND V > 150000 AND C>50;
tslval=ValueWhen(TSL,L,1);
tssval=ValueWhen(TSS,H,1);
_SECTION_END();
Filter = (TSL OR TSS AND EMA(V,15)>50000 );// AND C>50 AND V>50000;
SetOption("NoDefaultColumns", True);
AddTextColumn(Name(), "SYMBOL");
AddColumn(DateTime(), "DATE", formatDateTime,colorBlue);
AddColumn(IIf(TSL,1,Null), " TS Long", 1,colorBlack,IIf(TSL,colorBrightGreen,Null)); // HH
AddColumn(IIf(TSS,1,Null), " TS Short", 1,colorBlack,IIf(TSS,colorOrange,Null));
AddColumn(C, "Last Close", 1.2,colorBlue);
AddColumn(V, "Volume", 1, colorBlack,IIf(V > EMA(V,21), colorBrightGreen, colorOrange)); // for liquidity
AddColumn(IIf(TSL,tslval,Null), "Lo", 1.2 ,colorBlack,IIf(TSL,colorBrightGreen,Null));
AddColumn(IIf(TSS,tssval,Null), "Hi", 1.2,colorBlack,IIf(TSS,colorOrange,Null));
Buy=Sell=0;