# Plotting line at wrong end

I want to plot a line on the high of the pivot low and not on the low of the pivot low. How can i do that?

``````//@version=5
indicator("Pivot crosses", "", true)

int activeLevelsInput = input(10)
int pivotLegsInput = input(5)

// When a pivot occurs, create a line and save it.
float pLo = ta.pivotlow(pivotLegsInput, pivotLegsInput)

var pivotLines = array.new<line>(activeLevelsInput)

if not na(pLo)
line newPivotLine = line.new(bar_index - pivotLegsInput, pLo, bar_index, pLo)
array.push(pivotLines, newPivotLine)

// Delete the oldest line.
line.delete(array.shift(pivotLines))

// Extend the lines.
if barstate.islast and barstate.isnew
for pivotLine in pivotLines
line.set_x2(pivotLine, bar_index)

// Check for crosses.
bool cross = false

for pivotLine in pivotLines
float linePrice = line.get_y1(pivotLine)
bool newCrossUp = close < linePrice and close > linePrice
bool newCrossDn = close > linePrice and close < linePrice
cross := cross or newCrossUp or newCrossDn

if cross

plotchar(cross, "Cross", "X")
``````

### >Solution :

You are using `pLo` to set the y-axis of your line. `pLo` is assigned by `ta.pivotlow()` which will return the `low` price.

What you need to do is, figure out the bar index where there is a pivot low and get its high price.

You can easily do that with the history reference operator with using `pivotLegsInput` as your offset.

``````high_price = high[pivotLegsInput]
line newPivotLine = line.new(bar_index - pivotLegsInput, high_price, bar_index, high_price)
``````