I want to add an additional indicator to a robot. I run a robot on one indicator which looks for oversold and overbought conditions. It then generates buy and sell signals based on a divergence in price with the indicator. I have attached a screenshot of the divergence indicator (Screenshot 1). When the indicator detects a positive divergence with price, it draws a green line and issues a buy signal. When the indicator detects a negative divergence with a price, it draws a red line and issues a sell signal. The arrows do not generate a signal but just highlight oversold and overbought conditions.
However, the divergence indicator has a problem. It sometimes issues buy and sell signals when there is just a small divergence and price is not really stretched. See the attached screenshot (2). I am trying to avoid taking a position on these small divergences.
I have attached 2 more screenshots to show what I want to accomplish. On the third picture (screenshot3), the robot would issue a buy signal because of the Divergence Indicator and the TD Sequential indicator and issue Buy signals within 10 bars of each other.
On the final picture (screenshot4), the robot would not issue a sell signal on the divergence indicator, because there is no additional TD Sequential sell signal within 10 bars.
I have the code for the divergence indicator, the TD Sequential indicator and the robot.
For the job at hand, I need the TD Sequential indicator to issue actual buy and sell signals and I need the robot to include that indicator.