Can someone verify my coding for SOPK and RSI?

Hi Zerodha Friends,

I wanted to code a strategy where a buy signal is created when %K line of Stochastic Oscillator has crossed 20 and RSI (close,14) has crossed 45, both these conditions must be met inorder to buy.

Inorder to create a sell signal, the %K line of Stochastic Oscillator should cross 80 and RSI (close,14) should cross 60, again both the conditions must be met. The time frame is 5min, the signals should be created taking into consideration the close of 5min candle.

I coded the below, can someone please check whether it is correct?

Buy Script: SOPK(9,3,9,SIMPLE)<20 AND RSI(Close,14)<45

Sell Script: 0

Exit Long Script: SOPK(9,3,9,SIMPLE)>80 AND RSI(Close,14)>60

Exit Short Script: 0

Appreciate the help from this community. :slight_smile:

Regards,

Ram

1 Like

Hello this should work fine.

Buy Script: SOPK(9,3,9,SIMPLE) > 20 AND RSI(Close,14) > 45

Sell Script: 0

Exit Long Script: SOPK(9,3,9,SIMPLE) > 80 AND RSI(Close,14) > 60

Exit Short Script: 0

Thanks Suraj

No worries mate.