ahalam@live.com
Pine Script Rookie
Pine Script Rookie
Posts: 1
Joined: April 6th, 2022
Contact: TradingView Profile

Help needed in coding stochRSI as a buy strategy

Hi There.
I am working on a strategy and need help to develop a strategy by using StochRSI as my entry for long and short.

below is the code,

conditionbuy = ta.crossover(k,d) and (k < 20)
conditionsold = ta.crossover(d,k) and (k > 80)

i have using the above code to combine it with my ema crossover but it is not workinng

Long = ta.crossover (ema1,ema2) and ta.rsi(close,14)>=50 and conditionbuy
Short = ta.crossunder(ema1,ema2) and ta.rsi(close,14)<50 and conditionsold

Can someone help me on what i am doing wrong here.

Thanks
Ahsan

processingclouds
Pine Script Master
Pine Script Master
Posts: 115
Joined: January 30th, 2022

Re: Help needed in coding stochRSI as a buy strategy

Hey

If you can paste the complete code, it will give better understanding on where it is not working.

Return to “Pine Script Q&A”