this works for me (omit pivot point values if you do not own Power Pivots add-on):
Common to all 4 sections:
cond1:=If(Fml("_RMO SwingTrd 2")>Fml("_RMO SwingTrd 3"),1,If(Fml("_RMO SwingTrd 3")>Fml("_RMO SwingTrd 2"),-1,0));
cond2:=if(FmlVar("_RMO Rahul Mohindar Osc","RMO") > 0,1,-1);
cond3:=if(Fml("_RMO SwingTrd 2")>0,1,-1);
setup:= (cond1+cond2+cond3);
LE:= setup=3 and ref(setup,-1)<3;
SE:= setup=-3 and ref(setup,-1)>-3;
LX:= Cross(ExtFml("PowerPivots.NthPivotPrice",-1,0,1),l) or cross(valuewhen(1,le,LLV(L,2)),l);
SX:= Cross(h, ExtFml("PowerPivots.NthPivotPrice",1,0,1)) or cross(h,valuewhen(1,se,hhV(h,2)));
additional (last) line in:
Buy Order: alert(ref(le,-1),3) and h>valuewhen(1,le,h)
Sell Order: LX
Sell Short Order: alert(ref(se,-1),3) and L<valuewhen(1,se,L)
Buy to Cover Order: SX
Stop orders are as follows:
Buy Order:
cond1:=If(Fml("_RMO SwingTrd 2")>Fml("_RMO SwingTrd 3"),1,If(Fml("_RMO SwingTrd 3")>Fml("_RMO SwingTrd 2"),-1,0));
cond2:=if(FmlVar("_RMO Rahul Mohindar Osc","RMO") > 0,1,-1);
cond3:=if(Fml("_RMO SwingTrd 2")>0,1,-1);
setup:= (cond1+cond2+cond3);
LE:= setup=3 and ref(setup,-1)<3;
SE:= setup=-3 and ref(setup,-1)>-3;
LX:= Cross(ExtFml("PowerPivots.NthPivotPrice",-1,0,1),l) or cross(valuewhen(1,le,LLV(L,2)),l);
SX:= Cross(h, ExtFml("PowerPivots.NthPivotPrice",1,0,1)) or cross(h,valuewhen(1,se,hhV(h,2)));
max(O,valuewhen(1,le,h))
Sell Order:
cond1:=If(Fml("_RMO SwingTrd 2")>Fml("_RMO SwingTrd 3"),1,If(Fml("_RMO SwingTrd 3")>Fml("_RMO SwingTrd 2"),-1,0));
cond2:=if(FmlVar("_RMO Rahul Mohindar Osc","RMO") > 0,1,-1);
cond3:=if(Fml("_RMO SwingTrd 2")>0,1,-1);
setup:= (cond1+cond2+cond3);
LE:= setup=3 and ref(setup,-1)<3;
min(O,If(Cross(ExtFml("PowerPivots.NthPivotPrice",-1,0,1),l),ExtFml("PowerPivots.NthPivotPrice",-1,0,1),valuewhen(1,le,LLV(L,2))))
Sell Short Order:
cond1:=If(Fml("_RMO SwingTrd 2")>Fml("_RMO SwingTrd 3"),1,If(Fml("_RMO SwingTrd 3")>Fml("_RMO SwingTrd 2"),-1,0));
cond2:=if(FmlVar("_RMO Rahul Mohindar Osc","RMO") > 0,1,-1);
cond3:=if(Fml("_RMO SwingTrd 2")>0,1,-1);
setup:= (cond1+cond2+cond3);
LE:= setup=3 and ref(setup,-1)<3;
SE:= setup=-3 and ref(setup,-1)>-3;
LX:= Cross(ExtFml("PowerPivots.NthPivotPrice",-1,0,1),l) or cross(valuewhen(1,le,LLV(L,2)),l);
SX:= Cross(h, ExtFml("PowerPivots.NthPivotPrice",1,0,1)) or cross(h,valuewhen(1,se,hhV(h,2)));
min(O,valuewhen(1,se,L))
Buy to Cover Order:
cond1:=If(Fml("_RMO SwingTrd 2")>Fml("_RMO SwingTrd 3"),1,If(Fml("_RMO SwingTrd 3")>Fml("_RMO SwingTrd 2"),-1,0));
cond2:=if(FmlVar("_RMO Rahul Mohindar Osc","RMO") > 0,1,-1);
cond3:=if(Fml("_RMO SwingTrd 2")>0,1,-1);
setup:= (cond1+cond2+cond3);
SE:= setup=-3 and ref(setup,-1)>-3;
min(O,If( Cross(h, ExtFml("PowerPivots.NthPivotPrice",1,0,1)),ExtFml("PowerPivots.NthPivotPrice",1,0,1), valuewhen(1,se,hhV(h,2))))
Hope this helps.