Type/to search
0
Follow
0
Followers
30일 이동평균을 구하는 방법
Help
Created 2020-07-13 22:13:31  
 2
 1393

def get_records(value):
Log("get records day:",value)
records = exchange.GetRecords(PERIOD_D1)
res = 0
for i in range(-(value + 1),-1):
res = res + records[i]["Close"]
Log("time:", records[i]["Time"], "value:",records[i]["Close"])
return res/value

이 함수를 사용하여 평균선을 계산합니다.
리테크에서, k선 주기라는 것은 하루로 설정할 수 없기 때문에, 레코드의 길이는 5~6일밖에 되지 않고, 30일 평균선도 얻을 수 없습니다. 어떻게 해야 할까요?

Related Recommendations
Comment
All comments (2)

    不是函数调用的问题
    在实盘中,返回的只有一天的数据,无法算5天均线,30天均线
    模拟盘返回的数据比较多,是够的
    模拟盘的k线数据和实盘的是不是一样的,如果是一样的,那可以用模拟盘的数据回测

    6 years ago

    GetRecords可以设置成任意周期,当然可以为天。你在哪里不能设置了?

    6 years ago
  • 1
Forums
PINE Language
Get the app
iPhone Download
© 2015 - ∞ INVENTOR PTE LTD (SG)