Indicator ATR

Can anyone help me?

Task. Calculate the volatility of 3 BTCUSDT candles with a Timeframe of 15 minutes. The closing prices of each candle are listed below:
• Candle 1 - $ 10
• Candle 2 - $ 12
• Candle 3 - $ 8

The formula for calculating volatility will be clear from the following solution.

Step 1. Find the average price:
10 $ + 12 $ + 8 $ / 3 = 10 $

Step 2. Calculate the difference between each price and the average price:
Candle 1: 10 - 10 = 0
Candle 2: 12 - 10 = 2
Candle 3: 8 - 10 = -2

Step 3. Square each difference from the previous step:
Candle 1: (0) squared = 0
Candle 2: (2) squared = 4
Candle 3: (-2) squared = 4

Step 4. Sum up the squares of the differences:
0 + 4 + 4 = 8.

Step 5. Find the mean variance:
Dispersion = 8/3 = 2.66

Step 6. Find the standard deviation mean:
Standard deviation = square root of 2.66 = 1.63.

Step 7. Determine the percentage standard deviation:
Candle 1: 1.63 / (12 $ / 100) = 16.3%
Candle 2: 1.63 / ($ 12/100) = 13.58%
Candle 3: 1.63 / ($ 8/100) = 20.375%

Step 8. Determine the percentage standard deviation mean:
Average standard deviation = (16.3 + 13.58 + 20.375) / 3 = 16.75% - let’s call ATR

Hi,

KLines endpoint offers market data candles.

If you require help building the algorithm mentioned above, this is not the place to do so as it does not relate to the API. I suggest looking for tutorials or using other platforms dedicated to solving such issues.