How to drop the follow-through confirmation in your TTM_Squeeze Histogram Scan?


Category:
0
0

Hi, Pete, I installed your TTM_Squeeze Histogram Scan but I was not able to modify it as I had hoped. I wanted to have it trigger on the first positive crossover bar, rather than requiring a second bar as confirmation. So what I did was edit the lines defining the FollowThrough, so that instead of a negative bar, followed by a positive bar and then a second, higher positive, it requires only that yesterday’s bar be negative and today’s bar is positive.

So the original lines were:

  • def zeroLinePositiveFollowThrough = ( squeezeHistogram > 0 and squeezeHistogram[1] > 0 and squeezeHistogram[2] < 0 ) ;
  • def zeroLineNegativeFollowThrough = (squeezeHistogram < 0 and squeezeHistogram[1] < 0 and squeezeHistogram[2] > 0);

And my edited versions:

  • def zeroLinePositiveFollowThrough = ( squeezeHistogram > 0 and squeezeHistogram[1] < 0 ) ;
    #removed 2nd condition from stmt above in order to remove confirming bar: and squeezeHistogram[1] > 0 (also, the [1] above was originally [2])

    def zeroLineNegativeFollowThrough = (squeezeHistogram < 0 and squeezeHistogram[1] > 0);
    # removed 2nd condition from stmt above in order to remove confirming bar: and squeezeHistogram[1] < 0 (also, the [1] above was originally [2])

But when I run a scan, it seems to ID stocks where my trigger went off on the previous bar. In other words, the flag seems to go up when I want, on the first positive bar, but I don’t get the result in the scan until the next period. Any suggestions?

I have attached a screenshot illustrating the problem. Thanks for any help you can offer. I suspect that I do not understand scripting well enough to see that I need to edit some other part of the script.

hm

 

Attachments:
Marked as spam
Posted by (Questions: 3, Answers: 3)
Asked on January 2, 2017 5:12 pm
472 views
0
Private answer

I tried out your code in a modified version on my own chart and scan. It sure seems to be working as you expected. Attached is a screen shot showing the original, the TTM_Squeeze, and the modified version at the bottom. I’ve lined up the cursor so you can see that the modified version does indeed pick up the very first positive bar on the histogram. And you can also see that the modified version is exactly one bar sooner than the original.

You can also see the bar all the way to the right is the one generating a signal that was picked up by a scan I just ran using your modifications. You didn’t post your entire code so perhaps while trying to get this to work you managed to change something else and that is causing the issue. Here is the version I just used, containing your modifications:

Please don’t forget to up-vote any answers that most effectively answer your question!


declare lower;
input price = CLOSE;
input length = 20;
input nK = 1.5;
input nBB = 2.0;
input alertLine = 1.0;
plot scan;
def squeezeHistogram = TTM_Squeeze(price, length, nK, nBB, alertLine).Histogram;
def momentumPivotLow = (squeezeHistogram > squeezeHistogram[1] and squeezeHistogram[1] < squeezeHistogram[2]) ;
def momentumPivotHigh = (squeezeHistogram < squeezeHistogram[1] and squeezeHistogram[1] > squeezeHistogram[2]);
def pivotLowFollowThrough = (momentumPivotLow[1] and squeezeHistogram > squeezeHistogram[1]);
def pivotHighFollowThrough = (momentumPivotHigh[1] and squeezeHistogram < squeezeHistogram[1]);
def zeroLinePositiveFollowThrough = ( squeezeHistogram > 0 and squeezeHistogram[1] < 0 ) ;
def zeroLineNegativeFollowThrough = (squeezeHistogram < 0 and squeezeHistogram[1] > 0);
# uncomment one to scan for pivot high/low with follow through bar
#scan = pivotHighFollowThrough;
#scan = pivotLowFollowThrough;
# uncomment one to scan for zero line positive/negative with follow through bar
scan = zeroLinePositiveFollowThrough;
#scan = zeroLineNegativeFollowThrough;

 

Attachments:
Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on January 2, 2017 6:22 pm
0
Private answer

I think you are right. I did not do a side-by-side comparison, but just took your script and replaced mine with it. Now it gives the expected results. So the good news is that I understood the script well enough to make the change I wanted, but the bad news is that I somehow screwed up while doing it. But all’s well that ends well.

Thanks for the help. I have really enjoyed your videos and am happy to have had a chance to correspond and express my appreciation. Best wishes for 2017.

hm

Marked as spam
Posted by (Questions: 3, Answers: 3)
Answered on January 2, 2017 8:59 pm