Guest User

Untitled

a guest
Jan 20th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. PriceList = []
  2. N = eval(input("請輸入計算次數:"))
  3. Weight = (2 / (N + 1))
  4. for i in range(1,N+1):
  5. PriceNum = "請輸入第"+str(i)+"次的近期價格:"
  6. Price = eval(input(PriceNum))
  7. EMAPrice = (Price * ((1 - Weight) ** (i - 1)))
  8. PriceList.append(EMAPrice)
  9. EMA = (Weight * sum(PriceList))
  10. print("EMA = ",EMA)
Add Comment
Please, Sign In to add comment