Pivot HighLow that changes arrow color based on comparison with previous Pivot...Help.

I would like help modifying the code below so that when the most current Pivot high or Pivot low is greater/lesser than the previous pivot it has a distinct color. I tried storing the price value when the condition is true but could not get the logic correct and none of the arrows changed colors (different version of code). Also can I get information on how to post pictures to this interface. Thanks for any help with this.

Cheers!

Code:
script slow{
input length = 1;
input iperiod = aggregationPeriod.DAY;
plot plowest = lowest(low(period = iperiod),length)[-2];
plot phighest = highest(high(period = iperiod),length)[-2];
}

def SpikeL = if low== slow(5) && close>slow(5) then 1 else double.nan;
def SpikeH = if high== slow(5).phighest && close< slow(5).phighest then 1 else double.nan;

#Plots
plot psignal = spikeL;
plot psignalH = SpikeH;

#Styles

psignal.setpaintingStrategy(paintingStrategy.BOOLEAN_ARROW_UP);
psignal.setlineWeight(2);
psignal.setdefaultColor(color.UPTICK);

psignalH.setpaintingStrategy(paintingStrategy.BOOLEAN_ARROW_DOWN);
psignalH.setlineweight(2);
psignalH.setdefaultColor(color.DOWNTICK);
 

Similar threads

Top