daily pastebin goal
45%
SHARE
TWEET

Untitled

a guest Jan 20th, 2019 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top