Hai sir i need code for candlestick pattern with stochastic combination.
buy code:
when a hammer candle created along with oversold in stochastic.
sell code:
A hanging man candle along with overbought in Stochastic.
(The hammer or hanging man candle has a long lower wick, short body, and little or no upper wick.
Strictly speaking, the lower wick should be at least two times longer than the body – the longer, the better.)
For buy Evaluates to true when bullish hammer and the Stochastic Oscillator is in oversold territory.
Buy Script:
SET A = CLOSE-LOW
SET B = OPEN-CLOSE
SET C = HIGH-OPEN
TREND(CLOSE,10)=DOWN
A>=10*B
AND C/B<1
AND REF(CLOSE,1)<REF(OPEN,1) AND
OPEN<REF(CLOSE,1) AND
SOPK(9, 3, 9, SIMPLE) > 80 OR SOPD(9, 3, 9, SIMPLE) > 80
For sell Evaluates to true when bearish hangman and the Stochastic Oscillator is in oversold territory.
Sell Script:
SET A = CLOSE-LOW
SET B = OPEN-CLOSE
SET C = HIGH-OPEN
TREND(CLOSE,10)=UP
A>=10*B
AND C/B<1
AND REF(CLOSE,1)<REF(OPEN,1) AND
OPEN<REF(CLOSE,1) AND
SOPK(9, 3, 9, SIMPLE) < 20 OR SOPD(9, 3, 9, SIMPLE) < 20
I tried https://zerodha.com/expert-advisors/code/bearish-red-hanging-man for the code and i tried to backtest.. and it shows errors..what am i doing wrong.
pls guide.. screenshots attached. thanks




it is showing error in Pi. pls advise. thanks