// Buy on 3rd day with given condition :)
Buy = C> Ref(C,-1) AND Ref(C,-1) > Ref(C,-2) ;
// Sell on open of 4th day :)
Sell = ValueWhen(Ref(Buy,1),O);
Buy = ExRem (Buy,Sell);
Sell = ExRem (Sell,Buy);
Filter = Buy OR Sell;
AddColumn(IIf(Buy,C,Null),"Buy",1.2);
AddColumn(IIf(Sell,O,Null),"Sell",1.2);