Chart alert on higher low on ZigZagHighLow study


Tags:
Category:
0
0

Hi Pete,

I looked through the super complicated code but I could not figure out how to the get the low price of one low inflection point and compare it to the previous low inflection point. Thanks in advance!

Marked as spam
Posted by (Questions: 2, Answers: 3)
Asked on October 6, 2018 7:46 am
768 views
1
Private answer

I still have my reservations about the efficacy of this solution. But during live market hours today it is plotting values required to get to the next step. The last two lines in this code are the values associated with the most recent swing high and low as defined by the plots displayed by the ZigZagStepPattern. Which is not a study. You will only find that under Patterns.

So, if this works at all, you would create a boolean expression comparing the current value of “test3” to the previous bar’s value of “test3”. Likewise for the “test4” plot.

The rest is up to you. Good luck.

declare lower;
input priceH = high;
input priceL = low;
input percentageReversal = 5.0;
input absoluteReversal = 0.0;
input atrLength = 5;
input atrReversal = 1.5;
def zigZag = reference ZigZagHighLow(priceH, priceL, percentageReversal, absoluteReversal, atrLength, atrReversal).ZZ;
def step1 = open[1] >= open and open >= close[1] and open[1] > close[1];
def step2 = open[1] <= open and open <= close[1] and open[1] < close[1]; def upStep1 = step1 and close > open[1];
def upStep2 = step2 and close > close[1];
def downStep1 = step1 and close < close[1];
def downStep2 = step2 and close < open[1];
def UpStep = (upStep1 or upStep1[-1] or upStep2 or upStep2[-1]) and zigZag == low;
def DownStep = (downStep1 or downStep1[-1] or downStep2 or downStep2[-1]) and zigZag == high;
def test1 = if !IsNaN(UpStep) then UpStep else 0;
def test2 = if !IsNaN(DownStep) then DownStep else 0;
rec upStepHigh = if test1 then high else upStepHigh[1];
rec downStepLow = if test2 then low else downStepLow[1];
plot test3 = upStepHigh;
plot test4 = downStepLow;

 

Marked as spam
Posted by (Questions: 37, Answers: 4087)
Answered on October 8, 2018 10:44 am
0

Thanks Pete! I will play with it and let you know. Also just realized that the zigzaghighlow code changes the drawing if the time interval of an aggregation period is changed..

( at October 11, 2018 10:11 am)
0
Private answer

It is most likely you are not aware of the nature of the ZigZag studies. These studies present signals that change as new bars are added to the chart. So looking back at historical signals is deceiving. You are seeing only the final state of things. You are not seeing how the various signals unfolded on a live chart. So comparing the swing high or low from one point to the swing high or low from another point, will provide unusable data. You will be chasing ghosts.

Marked as spam
Posted by (Questions: 37, Answers: 4087)
Answered on October 6, 2018 8:19 am
0
I understand what you mean as I read your previous posts on this subject. The signal may disappear in the future depending on the how the bars play out. I am not looking for a signal to trade but as an alert to take a look at the chart once alerted to see whats going on if that is possible.
( at October 6, 2018 8:26 am)
0

I seriously doubt it’s possible. I copied the code from the built-in study and added this line at the bottom:
plot test = ZZ[1] < ZZ[2] and ZZ > ZZ[1];

That line should be true for the bar that immediately follows a swing pivot low in the ZigZag indicator. However instead of showing true or false it always shows N/A.

( at October 6, 2018 4:28 pm)
0

Yes it prints the current ZZ value such as in addlabel(yes, ZZ) but somehow its not possible to use any conditional statements with it. In the chart pattern study ZigZagStep the indicator is able to locate the bottoms of these lines using UpStep but I was not able to get the boolean to work with that either. The idea was to recursively store each UpStep spot’s ZZ value and compare it to the next one for a value swap and/or send an alert.

( at October 6, 2018 10:55 pm)
0

I took a look at that ZigZagStepPattern code to see if I could make something work. I was really close. When I clicked on the Apply study button the values we need for this flash on the screen and then they all revert to NA. So for me this confirms there is no solution to this. The code is using several loops. The signals are constantly being updated. The last signal on the chart is ALWAYS subject to change until the next signal appears. The loops make difficult to work around but the changing signals on the right side of the chart make it impossible.

( at October 7, 2018 9:08 am)
0

At least you got it to show the value for a second! Thanks again!

( at October 8, 2018 10:19 am)