Coding for Stochastic momentum Index

There is a strategy which works superbly in 1 min Chart. It would be grateful if I can get the code.(Nestplus-tradescript)

Stochastic momentum Index :

Default Values:

%K periods=13
%K smooth=25
%K Dbl smooth=2
%D periods=9
MA type=Exponential
%D MA type=Exponential

Strategy:
Buy: When %K cuts %D upwards + Last candle close should be above SMA50.
BuyExit: When %D cuts %K downwards.

even if it is little bit difficult to code, it is really worth to spend time on this.

Regards
Varman

Buy

SET A= SMIK(13,2,3,9,EXPONENTIAL,EXPONENTIAL)
SET B= SMID(13,2,3,9,EXPONENTIAL,EXPONENTIAL)
CROSSOVER(A,B) AND
CLOSE > SMA(CLOSE,50)

Buy Exit

SET A= SMIK(13,2,3,9,EXPONENTIAL,EXPONENTIAL)
SET B= SMID(13,2,3,9,EXPONENTIAL,EXPONENTIAL)
CROSSOVER(B,A)

Sell

SET A= SMIK(13,2,3,9,EXPONENTIAL,EXPONENTIAL)
SET B= SMID(13,2,3,9,EXPONENTIAL,EXPONENTIAL)
CROSSOVER(B,A) AND
CLOSE < SMA(CLOSE,50)

Sell exit

SET A= SMIK(13,2,3,9,EXPONENTIAL,EXPONENTIAL)
SET B= SMID(13,2,3,9,EXPONENTIAL,EXPONENTIAL)
CROSSOVER(B,A)

3 Likes

How to add this in Scanner ? I tried BUY and BUY EXIT part but it gives error, “your script generated an error” and no details about error in the dialog box.

Is there a different syntax for Scanner ?

1 Like

Thanks for your effort…I don’t want to carry over Position, (i.e strictly intraday) can we add Exit @ 3.20?
I know its not easy, is there any trick to do this?

Trade in Product type Mis, as it is for intra day only and also you will get more leverage.

NaMasTe TraDeR,
Please refer to Point 5 on this link:
http://tradingqna.com/46073/wiki-zerodha-backtest-scanner-error-troubleshoot-checklist

thanks,
then what is the alternative to above script in scanner ?
or say, what could be the code
when SMIK(…) crosses SMID(…), below -40 ?

Dear Varman

Did you get Trade script for mentioned query ?
Stochastic momentum index 13,25,2,9

Check Siva’s answer

can i have the code for stochostic rsi momentum indicator just like stochostic momentum indicator