Stochastic rsi code

Dear Team,

I need Zerodha PI code for Sell… when Stochastic crossed below 80 …

Buy… when stochastic crossed above 20…

SOPK(14, 3, 14, SIMPLE) > 80 OR SOPD(14, 3, 14, SIMPLE) > 80 (…this is for overbought region)
SOPK(14, 3, 14, SIMPLE) < 20 OR SOPD(14, 3, 14, SIMPLE) < 20 (…this is for oversold region)

  1. entry may be made taking into consideration the general trend and also if the price continues to remain in overbought or oversold region.
  2. exit may be made using PSAR
  3. also for general trend sma or ema of a longer period say 50,100,200 may be used.
  4. 14 is the no of days generally used while trading using stochastic indicator but you may suit yourself
  5. 3 is for smoothening so as to avoid jittery zig zags which may create false signals
  6. instead of different averaging as in exponential, time series etc maybe used
  7. also adx maybe used for ascertaining the strength of the trend thus avoiding the danger of going against trend

hope it helps Veera

In zerodha PI , how i can code for LengthRSI, LengthStoch, SmoothK and SmoothD values