Simple Pivot High and Low Arrows

Hello,
This forum has some very talented and imaginative members! I am new here and have a very simple request. I'm trying to paint arrows on my charts at Pivot Highs and Lows. The time span should be adjustable. The code below produces sub-par results for instance in up or down trend consecutive arrows can appear. Any advice or assistance would be greatly appreciated.

Thanks Dazed and Confused

Code:
def PVHighv = high("period" = AggregationPeriod.MONTH, "priceType" = PriceType.last);
def PVLowv = low("period"= AggregationPeriod.MONTH,"priceType" = PriceType.Last);

plot PVhigh = if high == pvhighv then 1 else 0;
plot pvlow = if low == pvlowv then 1 else 0;


pvhigh.setpaintingStrategy(paintingStrategy.BOOLEAN_ARROW_DOWN);
pvlow.setpaintingstrategy(paintingstrategy.BOOLEAN_ARROW_UP);
 

tomsk

Well-known member
VIP
I've modified your code slightly, it now displays monthly highs and lows. For best results load up a daily chart of /ES and you can see those arrows plot Note that I have retained your definitions of High/Low in the code. However normally by definition, a pivot is defined as HLC3 - just whatever floats your boat is the important thing

Code:
def PVHighv = high("period" = AggregationPeriod.MONTH, "priceType" = PriceType.last);
def PVLowv = low("period"= AggregationPeriod.MONTH,"priceType" = PriceType.Last);

plot PVhigh = if high == pvhighv then close else Double.NaN;
plot pvlow = if low == pvlowv then close else Double.NaN;

pvhigh.setpaintingStrategy(paintingStrategy.BOOLEAN_ARROW_DOWN);
pvlow.setpaintingstrategy(paintingstrategy.BOOLEAN_ARROW_UP);
pvhigh.setDefaultColor(Color.YELLOW);
pvlow.setDefaultColor(Color.CYAN);
pvhigh.SetLineWeight(4);
pvlow.SetLineWeight(4);
 
Last edited:

Dixon72

New member
VIP
@jeremyadorna I don't think the mobile app can handle higher time frames. Whenever I convert my scripts to be mobile app-friendly, I have to pull out all the higher timeframe stuff...

@tomsk This seems crazy useful, but am a little confused. This isn't plotting the higher timeframe's pivot (average of the high/low/close), right? Is this just plotting when a lower timeframe candle's high breaches above the higher timeframe's high and closes below it? Conversely, it shows when a lower timeframe candle's low breaches the higher timeframe's low and closes above it, right? How would you recommend using this? I suppose combining this signal with your already existing trade entry signal just helps support your directional bias? or??

Thanks,
-Dixon
 

Dixon72

New member
VIP
Oh, I also added an aggregation input if someone wants to change the aggregation period easier...

-Dixon

Code:
input Period = AggregationPeriod.DAY;

def HLChigh= high("period" = Period, "priceType" = PriceType.last);
def HLCLow = low("period"= Period,"priceType" = PriceType.Last);

plot PVhigh = if high == HLChigh then close else Double.NaN;
plot pvlow = if low == HLCLow then close else Double.NaN;

pvhigh.setpaintingStrategy(paintingStrategy.BOOLEAN_ARROW_DOWN);
pvlow.setpaintingstrategy(paintingstrategy.BOOLEAN_ARROW_UP);
pvhigh.setDefaultColor(Color.YELLOW);
pvlow.setDefaultColor(Color.CYAN);
pvhigh.SetLineWeight(4);
pvlow.SetLineWeight(4);
 

Similar threads

Top