I would like to be able to create an indicator which checks a few conditions relating to the RSI value and share price of the stock.
When the RSI value rises above 30 I want to be able to check that the next time it dips below 30 is within a 20 - 35 day time frame. So basically I want to find conditions where it dips down below the 30 mark and then again where the intervening period in which it is above the 30 mark is 20 - 35 days before it dips down again. I probably haven't explained it very well. Please let me know if you need me to clarify further.
In addition to the above condition there is a further condition in that the price must have dropped by more than 5% in the period when it was above 30 i.e. between the 2 consecutive drops below the 30 line.
I am pretty sure that the above is possible from a programming point of view but I thought I would get some advice on the best way to structure the code rather than having to write 35 if and else statements which I guess would do it, but would be rather clunky.
I would like the output to produce a value of 1 on the day where it meets the condition and 0 if not. I would like to insert this custom indicator into the market analyser where I can use it to scan hundreds of stocks.
I am a beginner in terms of coding experience so any references to similar code in other indicators would be most helpful. I should be able to use that to give me what I need.
Many thanks,
Evan
Comment