//@version=5 //@Pilicoin indicator('Liquidations', overlay=true, max_lines_count=500, max_boxes_count=1, max_labels_count=1) // Volume Calculations // removeBelowMean = true timePeriodMean = 200 highVolume = ta.highest(volume, timePeriodMean) lowVolume = ta.lowest(volume, timePeriodMean) difference = highVolume - lowVolume differenceSum = math.sum(difference, timePeriodMean) differenceMean = differenceSum / timePeriodMean if removeBelowMean and (difference < differenceMean or difference < 0)     difference := 0 hundredx = difference >= (1.2 * differenceMean) // Liquidation Lines Calculation // f_drawLine(_x1, _x2, _yValue, _lineColor, _style, _width) =>     line.new(x1=_x1, y1=_yValue, x2=_x2, y2=_yValue, color=_lineColor, style=_style, width=_width) f_extendArray(_lineArray, _extendLines) =>     if array.size(_lineArray) > 0         for _i = array.size(_lineArray) - 1 to 0 by 1             x2 = line.get_x2(array.get(_lineArray, _i))             yValue = line.get_y1(array.get(_lineArray, _i))             if _extendLines or bar_index - 1 == x2 and not(high > yValue and low < yValue)                 line.set_x2(array.get(_lineArray, _i), bar_index) f_calculateLeverage100x(_pivotValue, _shortSell) =>     _shortSell ? _pivotValue * (1 - 0.0051) : _pivotValue * (1 + 0.0049) i_pivotLeft = 3 i_pivotRight = 2 i_pivotLineCount = 10000 i_pivotHighColor = color.rgb(215, 230, 0) i_pivotLowColor = color.rgb(230, 255, 7) i_pivotExtendLines = false i_fifthExtendLines = false i_fifthLeverage = 100 i_fifthColor = color.rgb(255, 140, 0, 69) // array init var fifthArray = array.new_line() // pivot high/low pivotHigh = ta.pivothigh(high, i_pivotLeft, i_pivotRight) pivotLow = ta.pivotlow(low, i_pivotLeft, i_pivotRight) float yValue = na int x1 = na int x2 = na line l = na // leverage if not na(pivotLow) and hundredx     x1 := bar_index[i_pivotRight]     x2 := bar_index     yValue := f_calculateLeverage100x(low[i_pivotRight], true)     l := f_drawLine(x1, x2, yValue, i_fifthColor, line.style_solid, 1)     if array.size(fifthArray) == i_pivotLineCount         line.delete(array.shift(fifthArray))     array.push(fifthArray, l) if not na(pivotHigh) and hundredx     x1 := bar_index[i_pivotRight]     x2 := bar_index     yValue := f_calculateLeverage100x(high[i_pivotRight], false)     l := f_drawLine(x1, x2, yValue, i_fifthColor, line.style_solid, 1)     if array.size(fifthArray) == i_pivotLineCount         line.delete(array.shift(fifthArray))     array.push(fifthArray, l) f_extendArray(fifthArray, i_fifthExtendLines)