Tightening the MACD-RSI scan to 3 bars


Category:
0
0

Hey Pete – Regarding the MACD-RSI script that you’ve made a couple videos on: Is there a way to have the plot spike on the third bar of the pattern, rather than the 4th? I tried removing what I thought was the 4th bar from the code (highlighted on line 19, also 21) but that didn’t change the results.

Thank you for any guidance.

Dave

Attachments:
Marked as spam
Posted by (Questions: 3, Answers: 1)
Asked on July 7, 2020 8:23 am
200 views
0
Private answer

What you are actually requesting there is to remove the "2 bar follow through confirmation" from the signal. The code in the video you reference....

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

.... please be sure to ALWAYS provide a link to any resource you reference in your questions. Otherwise everyone but you will be completely lost and not able to follow along.

So anyway, that video describes a signal where the MACD histogram needs to have two complete bars in the same direction before the signal is valid. You are asking to remove the 2 bar confirmation so that only one MACD histogram bar in the direction of the signal is sufficient to complete the pattern. This will introduce noise as you will have many more false signals. This does not "tighten up the pattern" nor does it "trigger the signal one bar earlier". What it does is to completely change the signal and you will find there are many more signals because you will no longer be filtering out the noise.

To summarize, the original code requires two consecutive lower values from the MACD histogram, followed by two consecutive higher values. What you have requested is a new signal that consists of two consecutive lower values, followed by only one histogram bar of higher value.

So long as everyone understands this. We can provide that modification.

The original code is included with the video. So here I am only going to explain which lines require modification and list those changes.

First, we have the original two lines that form the MACD histogram pivot low and pivot high:

def pivotLowMACD = Diff > Diff[1] and Diff[1] > Diff[2] and Diff[2] < Diff[3] and Diff[3] < Diff [4];
def pivotHighMACD = Diff < Diff[1] and Diff[1] < Diff[2] and Diff[2] > Diff[3] and Diff[3] > Diff[4];

That is how they exist in the original code. Here are those same two lines modified as described in my comments above:

def pivotLowMACD = Diff > Diff[1] and Diff[1] < Diff[2] and Diff[2] < Diff [3];
def pivotHighMACD = Diff < Diff[1] and Diff[1] > Diff[2] and Diff[2] > Diff[3];

So, replace the original two lines with the modified version and this will remove the 2nd bar confirmation of the pivot high/low of the MACD histogram portion of the pattern.

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on July 7, 2020 8:59 am
0
Thank you sir! And I will do my best to make a more quality post next time!
( at July 8, 2020 7:58 am)