Crossover Code for- 1. PSAR& CLOSE 2. Stoch

Can u guys help me with code for below-

1. Buy- If current bar closes above PSAR. Buy Exit- Current bar closes below PSAR,

Sell-  If current bar closes below PSAR​, Sell Exit- If current bar closes above PSAR​

2. Buy- Stochastic 27,3,27, crossover between %k and %d from below

Sell- Stochastic 27,3,27, crossover between %k and %d from above

Code-

1. 

Buy- 

CROSSOVER(CLOSE, PSAR(CLOSE,0.02, 0.2))

Buy Exit-
CROSSOVER(PSAR(CLOSE,0.02, 0.2), CLOSE) 

Sell- 
CROSSOVER(CLOSE, PSAR(CLOSE,0.02, 0.2))

Sell Exit-
CROSSOVER(PSAR(CLOSE,0.02, 0.2), CLOSE) 

2. 

Buy-
CROSSOVER(SOPK(27,3,27, SIMPLE),SOPD(27,3,27, SIMPLE))

Sell-
CROSSOVER(SOPD(27,3,27, SIMPLE),SOPK(27,3,27, SIMPLE))