MACD_RSI Study Combo for both overbought oversold


Category:
0
0

Hi again Mr Hahn,

I tried to combine some of your codes together to get a TOS study that would indicate both an “overbought” and “oversold” condition based primarily on your MACD RSI part 2 scan.  Sadly it still only indicates the “oversold” condition.  I took out the alerts.  Thanks for any help.  I’m sending you some funds right now for all the help you’ve given me!  Attached is what I made, hoping it would go into “overbought” to below 0 in the plot scan…

 

Marked as spam
Posted by (Questions: 2, Answers: 1)
Asked on June 1, 2020 6:38 pm
252 views
0
Private answer

I have no idea what you are asking for here. If you are referring to this video:

https://www.hahn-tech.com/thinkorswim-scan-macd-rsi-part-two/

The code for that already includes both directions. The scan signals for both directions were already included in the file linked in this video.

Edit: I now understand the request after getting some more details in the comments section below. The request is to take the two separate signals of the scan, turn them into a chart study, and display +1 for oversold signal, -1 for overbought signal and 0 for no signal.

Here is the plot statement from the code provided by the author of the post:

plot scan = pivotLowMACD and highest(oversoldRSI[1], 4) > 0 or pivotHighMACD and lowest (overboughtRSI[1], 4) < 0;

Now let's take a look at the two scan signals that were provided in the original scan:

plot scan = pivotLowMACD and highest(oversoldRSI[1], 4) > 0;
#plot scan = pivotHighMACD and highest(overboughtRSI[1], 4) > 0;

Do you see how you mistakenly changed the second line from "highest(overboughtRSI[1], 4) > 0" to "lowest (overboughtRSI[1], 4) < 0"? That was the first mistake. You did not copy the scan signal for overbought, but instead you modified it in a way that caused it to stopped working altogether.

I only take the time to explain your mistake because you included your code in this post and I perceive that you are trying to learn. Here is what the statement looks like when you combine the two signals to create the +1, -1 and 0 plot values you were trying to achieve:

plot scan = if pivotLowMACD and Highest(oversoldRSI[1], 4) > 0 then 1 else if pivotHighMACD and Highest(overboughtRSI[1], 4) > 0 then -1 else 0;

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on June 1, 2020 6:48 pm
0
Sorry, I was trying to set up the scan-MACD-RSI-part-two to do both directions at the same time. So spike to 1 when 'oversold' and spike to -1 with 'overbought'. I'm not sure if it's possible though.
( at June 1, 2020 9:07 pm)
0
I have updated my answer to provide a solution as well as an explanation of why your attempt did not work.
( at June 2, 2020 8:09 am)