protected void OnPointerChange() {
        if (lastData == null) {
            System.out.println("Original data is null, downloading it");
            OnDataRangeChanged();
            return;
        }

        Index[] dataPointer = new Index[lastData.length];
        for (int i = 0; i < lastData.length; i++) {
            dataPointer[i] = new Index(lastData[i]);
        }

        double[] data1;
        double[][] data2;
        int size = lastData.length;

        lineChart.getData().clear();
        LinearChartManager.addSeries(lineChart, lastData, selectedRange);

        switch (pointerType) {
            case "MA":
                data1 = Indicators.MA(dataPointer, size);
                for (int i = 0; i < size; i++) {
                    dataPointer[i].setClose_val(data1[i]);
                }
                LinearChartManager.addSeries(lineChart, dataPointer, "MA", selectedRange);
                break;
            case "bollinger":
                data2 = Indicators.Bollinger(dataPointer, size, K);

                for (int i = 0; i < size; i++) {
                    dataPointer[i].setClose_val(data2[0][i]);
                }
                LinearChartManager.addSeries(lineChart, dataPointer, "Bollinger1", selectedRange);
                for (int i = 0; i < size; i++) {
                    dataPointer[i].setClose_val(data2[1][i]);
                }
                LinearChartManager.addSeries(lineChart, dataPointer, "Bollinger2", selectedRange);
                for (int i = 0; i < size; i++) {
                    dataPointer[i].setClose_val(data2[2][i]);
                }
                LinearChartManager.addSeries(lineChart, dataPointer, "Bollinger3", selectedRange);
                break;

            case "koperta":
                data2 = Indicators.Bollinger(dataPointer, size, P);
                for (int i = 0; i < size; i++) {
                    dataPointer[i].setClose_val(data2[0][i]);
                }
                LinearChartManager.addSeries(lineChart, dataPointer, "Koperta1", selectedRange);
                for (int i = 0; i < size; i++) {
                    dataPointer[i].setClose_val(data2[1][i]);
                }
                LinearChartManager.addSeries(lineChart, dataPointer, "Koperta2", selectedRange);
                break;
            case "EMA":
                double alpha = 2 / (size + 1);
                data1 = Indicators.EMA(dataPointer, size, alpha);
                for (int i = 0; i < size; i++) {
                    dataPointer[i].setClose_val(data1[i]);
                }
                LinearChartManager.addSeries(lineChart, dataPointer, "EMA", selectedRange);
                break;
            case "hide":
                break;
            default:
                break;
        }
    }