Beginner here. I've got an attempt at the bottom here, but I'm starting at part 2, just to get an arrow to print at the bottom of a pivot and already having issues. They do print correctly on some candles, but not on all candles that they should be on, and they also print on candles they shouldn't.
## 1. establish downtrend or uptrend
## if current pivot low is lower than prior pivot low
## then do the following for a downtrend pullback
## 2. for the first pivot high marked with a red 0
# if low of bar is lower than prior bar's low
# and high of bar is higher than prior bar's high
# then mark with a bubble with numeral 0
## 3. for the low pivot currently marked with a green 0
# if low of bar is lower than prior bars low
# and high of bar is lower than high of prior bars
# and it becomes a pivot low
# then mark with a bubble with numeral 0
## 4. for the pivot high currently marked with a red 1
# if high of bar is higher than prior bars high
# and low of bar is higher than low of prior bars
# and it becomes a pivot high
# then mark with a bubble with numeral 1
## 5. for the pivot low higher currently marked with a green 1
# if low of bar is lower than prior bars low
# and high of bar is lower than high of prior bars
# and it becomes a pivot low
# then mark with a bubble with the numeral 1
## 6. for the last pivot high currently marked with a red 0
# if high of bar is higher than prior bars high
# and low of bar is higher than low of prior bars
# and it becomes a pivot high
# then mark with a bubble with numeral 0
Here's where I'm at:
#pullback 1.2
## for the low pivot currently marked with a green 0
# if low of bar is lower than prior bars low
# and high of bar is lower than high of prior bars
# and it becomes a pivot low
# then mark with an up arrow
def downleg_first_entry = low < low[1] and high[0] < low[2] and high[1];
plot digit_0 = if downleg_first_entry then high else double.nan;
digit_0.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
digit_0.SetLineWeight(3);
digit_0.SetDefaultColor(color.RED);
digit_0.HideBubble();
digit_0.HideTitle();
Here's what I'm trying to replicate:
Here's where I'm at now:
## 1. establish downtrend or uptrend
## if current pivot low is lower than prior pivot low
## then do the following for a downtrend pullback
## 2. for the first pivot high marked with a red 0
# if low of bar is lower than prior bar's low
# and high of bar is higher than prior bar's high
# then mark with a bubble with numeral 0
## 3. for the low pivot currently marked with a green 0
# if low of bar is lower than prior bars low
# and high of bar is lower than high of prior bars
# and it becomes a pivot low
# then mark with a bubble with numeral 0
## 4. for the pivot high currently marked with a red 1
# if high of bar is higher than prior bars high
# and low of bar is higher than low of prior bars
# and it becomes a pivot high
# then mark with a bubble with numeral 1
## 5. for the pivot low higher currently marked with a green 1
# if low of bar is lower than prior bars low
# and high of bar is lower than high of prior bars
# and it becomes a pivot low
# then mark with a bubble with the numeral 1
## 6. for the last pivot high currently marked with a red 0
# if high of bar is higher than prior bars high
# and low of bar is higher than low of prior bars
# and it becomes a pivot high
# then mark with a bubble with numeral 0
Here's where I'm at:
#pullback 1.2
## for the low pivot currently marked with a green 0
# if low of bar is lower than prior bars low
# and high of bar is lower than high of prior bars
# and it becomes a pivot low
# then mark with an up arrow
def downleg_first_entry = low < low[1] and high[0] < low[2] and high[1];
plot digit_0 = if downleg_first_entry then high else double.nan;
digit_0.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
digit_0.SetLineWeight(3);
digit_0.SetDefaultColor(color.RED);
digit_0.HideBubble();
digit_0.HideTitle();
Here's what I'm trying to replicate:
Here's where I'm at now: