# Plotting lines for specific array values only

Hello community,

I have coded a pivot high, pivot low CS pattern detection AFL code.
I am tring to plot a line from the Pivot High and the Pivot Low.
Not having any luck, nothing is plotting when I try.

Is possible, how can I control the amount of Pivot High/Low lines that are created on screen and how can I control the length of the lines?

My code is below. Thanks for your help

``````// Pivot High yesterdays close greater than todays close and greater than the day before yesterday. The opens are the same
// Pivot Low yesterdays close is lower than todays close and lower than the day before. The Opens follow the same pattern
// Pivot High and Pivot Low occur next to each other
// A PH or PL can occur first
// A PH has to occur above a PivLow

SetChartOptions(0,chartShowDates);

for(i=1; i < BarCount -1; i++)
{
//determining a Pivot High
if(H[i] > H[i-1] AND H[i] >H[i+1] AND
L[i] > L[i-1] AND L[i] > L[i+1])
{
PivotHigh[i] = 1;

PivotHighValue = ValueWhen(PivotHigh ==1,H);

//if(PivotHigh[i] == 1)
//	{ PivotHighValue[i] = High[i];}
//else {Pivothighvalue[i] = 0;}

}

else
{
PivotHigh[i] = 0;
}

//determing a pivotlow
if(L[i] < L[i-1] AND L[i] < L[i+1] AND
H[i] < H[i-1] AND H[i] < H[i+1])
{
PivotLow[i] = 1;

PivotLowValue = ValueWhen(PivotLow == 1,L);

// if(pivotlow[i] ==1)
//{PivotLowValue[i] = Low[i];}
// Else	{PivotlowValue[i] = 0; }

}

else
{
pivotlow[i] = 0;
}
}

A1 = ExRem(Pivothigh,pivotlow); A2 = ExRem(PivotLow,PivotHigh);
PivShape = IIf(A1 AND PivotHigh ==1, shapeUpArrow,IIf(A2 AND Pivotlow ==1, shapeDownArrow,shapeNone));
PlotShapes(PivShape,colorBlue,0, High + (0.03) );

Plot(C,"",colorDefault,styleCandle);
A3 = IIf(A1 ==1 AND PivotHigh ==1,Pivothighvalue,Null);

// Exploration code for testing only
Filter = 1;