How to get the 30-day averages

Author: eye, Created: 2020-07-13 22:13:31, Updated:

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

eyeIt'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.

The grassGetRecords can be set to any cycle, of course. Where can't you set it?