Avoid stacked up pivot points

Samus Aran

New member
hey everyone, can someone help me implement my code to not plot the pivot points stacked up, stacked horizontally, and stacked downward on the same Bar that is upgrading the higher highs. I would just like there to be 1 pivot point for that bar.

sincerely

Code:
input length = 17520;
def VolAvg = ExpAverage(volume, length);
def CandlePeak = if  volume >= VolAvg then 1 else 0;

def InitalStatePeak1 = high[6];
def FirstStatePeak1 = high[5];
def SecondStatePeak1 = high[4];
def ThirdStatePeak1 = high[3];
def FourthStatePeak1 = high[2];
def FifthStatePeak1 = high[1];


def InitalStatePeak = if CandlePeak == 1 and high > InitalStatePeak1 then high[5] else double.NaN;
plot InitalStatePeaktemp = InitalStatePeak;
InitalStatePeaktemp.SetPaintingStrategy(PaintingStrategy.POINTS);

def FirstStatePeak = if high > InitalStatePeak  then high[4] else double.NaN;
plot FirstStatePeaktemp = FirstStatePeak;
FirstStatePeaktemp.SetPaintingStrategy(PaintingStrategy.POINTS);

def SecondStatePeak = if high > FirstStatePeak  then high[3] else double.NaN;
plot SecondStatePeaktemp = SecondStatePeak;
SecondStatePeaktemp.SetPaintingStrategy(PaintingStrategy.POINTS);

def ThirdStatePeak = if high > SecondStatePeak  then high[2] else double.NaN;
plot ThirdStatePeaktemp = ThirdStatePeak;
ThirdStatePeaktemp.SetPaintingStrategy(PaintingStrategy.POINTS);

def FourthStatePeak = if high > ThirdStatePeak  then high[1] else double.NaN;
plot FourthStatePeaktemp = FourthStatePeak;
FourthStatePeaktemp.SetPaintingStrategy(PaintingStrategy.POINTS);

def FifthStatePeak = if high > FourthStatePeak  then high else double.NaN;
plot FifthStatePeaktemp = FifthStatePeak;
FifthStatePeaktemp.SetPaintingStrategy(PaintingStrategy.POINTS);

def FifthStatePeakUpgrade = if high > FifthStatePeak[1]  then high else double.NaN;
plot FifthStatePeaktemp2 = FifthStatePeakUpgrade;
FifthStatePeaktemp2.SetPaintingStrategy(PaintingStrategy.POINTS);
 
Last edited:

Similar threads

Top