0
Follow
0
Followers

How to get the 30-day averages

Created: 2020-07-13 22:13:31, Updated on:
comments   2
hits   889

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

Calculate a straight line with this function In retesting, the k-line cycle of the disk cannot be set to a full day, so the length of the records is often only 5, 6 days, and the 30-day average line cannot be obtained.

More content
All comments
avatar of eye
eye
It's not a function call problem. In the real disk, only one day's data is returned, and the 5-day average cannot be counted as a 30-day average The analogue disk returns more data, which is enough. If the k-line data on the analogue disk is the same as the real disk, if it is the same, then the data on the analogue disk can be retested.
2020-07-14 11:09:52
avatar of 小草
The grass
GetRecords can be set to any cycle, of course. Where can't you set it?
2020-07-14 10:12:20