این کد منه
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Candlestick Chart with Dark Background</title>
    <script src="https://unpkg.com/lightweight-charts@3.0.0/dist/lightweight-charts.standalone.production.js"></script>
    
    <style>
        /* استایل نمودار */
        #chart-container {
            width: 100%;
            max-width: 90%;
            margin: 0 auto;
        }
    </style>
</head>
<body>
    <div id="chart-container"></div>
    <script>
        document.addEventListener("DOMContentLoaded", function () {
            const chartContainer = document.getElementById("chart-container");

            // داده‌های قیمتی (مثال)
            const data = [
            {'open': '65027.3', 'close': '65060.7', 'high': '65094.0', 'low': '65027.2', 'volume': '30.75', 'time': 1713683100000}, {'open': '65020.6', 'close': '65026.3', 'high': '65066.7', 'low': '65000.0', 'volume': '62.00', 'time': 1713682800000}, {'open': '65051.9', 'close': '65020.6', 'high': '65071.0', 'low': '65014.7', 'volume': '55.76', 'time': 1713682500000}, {'open': '65066.5', 'close': '65051.8', 'high': '65083.9', 'low': '65050.0', 'volume': '72.57', 'time': 1713682200000}, {'open': '65073.8', 'close': '65066.4', 'high': '65116.3', 'low': '65050.0', 'volume': '49.10', 'time': 1713681900000}, {'open': '65079.6', 'close': '65073.7', 'high': '65123.8', 'low': '65070.1', 'volume': '44.89', 'time': 1713681600000}, {'open': '65107.2', 'close': '65079.7', 'high': '65150.2', 'low': '65071.9', 'volume': '40.40', 'time': 1713681300000}, {'open': '65134.4', 'close': '65108.1', 'high': '65150.1', 'low': '65092.4', 'volume': '40.99', 'time': 1713681000000}, {'open': '65142.5', 'close': '65135.3', 'high': '65167.9', 'low': '65107.7', 'volume': '73.87', 'time': 1713680700000}, {'open': '65063.7', 'close': '65143.3', 'high': '65178.2', 'low': '65029.8', 'volume': '85.38', 'time': 1713680400000}, {'open': '64983.0', 'close': '65063.6', 'high': '65073.3', 'low': '64952.9', 'volume': '57.30', 'time': 1713680100000}, {'open': '64953.6', 'close': '64982.9', 'high': '65006.9', 'low': '64953.6', 'volume': '51.59', 'time': 1713679800000}, {'open': '64986.3', 'close': '64953.4', 'high': '65045.2', 'low': '64953.2', 'volume': '55.86', 'time': 1713679500000}, {'open': '64996.2', 'close': '64986.6', 'high': '65024.2', 'low': '64900.4', 'volume': '78.30', 'time': 1713679200000}, {'open': '64980.2', 'close': '64996.3', 'high': '65028.6', 'low': '64978.9', 'volume': '58.83', 'time': 1713678900000}, {'open': '65008.7', 'close': '64980.1', 'high': '65073.7', 'low': '64980.0', 'volume': '51.49', 'time': 1713678600000}, {'open': '65046.1', 'close': '65007.8', 'high': '65063.2', 'low': '64943.9', 'volume': '103.21', 'time': 1713678300000}, 
            ];

            // ایجاد نمودار کندل استیک
            const chart = LightweightCharts.createChart(chartContainer, {
                width: chartContainer.offsetWidth,
                height: 900,
                
            });

            chart.applyOptions({
                timeScale: {
                    timeVisible: true,
                    secondsVisible: true,
                },
                layout: {
                    backgroundColor: 'rgb(17, 17, 39)',
                    textColor: 'rgba(255, 255, 255, 0.9)',
                },
                grid: {
                    vertLines: {
                    color: 'rgb(41, 44, 58)',
                    },
                    horzLines: {
                    color: 'rgb(41, 44, 58)',
                    },
                },
                crosshair: {
                    mode: LightweightCharts.CrosshairMode.Normal,
                },
                scales: {
                    x: {
                        type: 'time',
                        time: {
                            unit: 'day'
                        }
                    },
                    y: {
                        beginAtZero: true
                    }
                },
                priceScale: {
                    borderColor: 'rgba(197, 203, 206, 0.5)',
                },
                timeScale: {
                    borderColor: 'rgba(197, 203, 206, 0.5)',
                },
                watermark: {
                    color: 'rgba(197, 203, 206, 0.5)',
                    visible: true,
                    text: 'dev boys chart',
                    fontSize: 32,
                    horzAlign: 'center',
                    vertAlign: 'center',
                },
                
            });

            const candlestickSeries = chart.addCandlestickSeries();
            candlestickSeries.setData(data);

            const entryLineSeries = chart.addLineSeries({
                color: 'red', // رنگ نمایش نقطه ورود
                lineWidth: 4,
            });
            entryLineSeries.setData([
                { time: 1713683100000, value: 65031 },
                { time: 1713305400000, value: 60031 }, // مقدار خط افقی
                { time: 1713251400000, value: 65031 }, // مقدار خط افقی
            ]);

 
        });
    
    </script>
</body>
</html>

میخوام با توجه به کد زیر کاری کنی که من بتونم بالای و یا پایین ی کندل byu , sell بنویسم
// determining the dates for the 'buy' and 'sell' markers added below.
const datesForMarkers = [data[data.length - 39], data[data.length - 19]];
let indexOfMinPrice = 0;
for (let i = 1; i < datesForMarkers.length; i++) {
    if (datesForMarkers[i].high < datesForMarkers[indexOfMinPrice].high) {
        indexOfMinPrice = i;
    }
}

const markers = [
    {
        time: data[data.length - 48].time,
        position: 'aboveBar',
        color: '#f68410',
        shape: 'circle',
        text: 'D',
    },
];
for (let i = 0; i < datesForMarkers.length; i++) {
    if (i !== indexOfMinPrice) {
        markers.push({
            time: datesForMarkers[i].time,
            position: 'aboveBar',
            color: '#e91e63',
            shape: 'arrowDown',
            text: 'Sell @ ' + Math.floor(datesForMarkers[i].high + 2),
        });
    } else {
        markers.push({
            time: datesForMarkers[i].time,
            position: 'belowBar',
            color: '#2196F3',
            shape: 'arrowUp',
            text: 'Buy @ ' + Math.floor(datesForMarkers[i].low - 2),
        });
    }
}
series.setMarkers(markers);

chart.timeScale().fitContent();