How does moving average work

lets say im in 1 hour chart and i decide to take out a 10sma (simple moving average). Then that means that it will take the average price movement of 10 hours. Lets say its EUR/USD and its movement went like this
1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0.

Yes i know its very unlikely for it to be like that. But im just using example.

so i calculate the 10sma by adding up those closing prices and divide it by 10. I get it to 1.55.

is if the 10sma is equal to the 1.55, then why is the line not just in horizontal on price 1.55?
why is it moving up and down.

what im i doing wrong here

It moves because as each bar closes then the 10sma adds the new close and drops off the oldest close. If the value of the latest close is higher than the value of the oldest that is dropped off then the current value of the sma is incrementally higher, similarly, if the latest is lower than the oldest then the sma is incrementally lower.

It is always the average of the latest 10 closes and changes as each new value is added and one removed. If you like, you can imagine it as a 10 bar window that is constantly moving along one bar at a time as each hour completes. The new value of the 10sma is only printed on the last bar, not on all 10 bars so, if you like, as each 1H bar completes only the latest value is printed, the previous 9 values remain as they were. It is like the end-points of the 10sma are printed as each bar completes.

That is the simple MA, there are many many many types of MAs and perhaps the most commonly used is the exponential MA where the latest values have a higher weighting than the older values and therefore it is more responsive to the newer changes in value…