I have a list of daily moving averages computed from 5-minute data. Although I'm able to successfully create this list, I can't seem to figure out how to locate in thelist when certain conditions are met and to then create a new data table containing the :Date when these conditions are met. The following code grabs the dates corresponding to each record in the ma_list, not just those corresponding the the specified condition. Is it possible to create "complex" evaluation criteria when working with lists, and if so, what might that JSL code look like? Any suggestions would be greatly appreciated.
ma_list = [46.6, 51.6, 50.8, 52.8, 58.4, 57.6, 62.2, 62.2, 66.6, 63.8, 59.6, 55.6, 57.2, 57.8,
57.4, 59.8, 65.4, 62, 54.6, 51.8, 50, 45.2, 44.2, 42.2, 45.8, 47.8, 52.4, 55.6, 57,
44.4, 34, 20.2, 9.4, 0.4, 0, 0, 0, 0, 0, 4.4, 11, 18, 25.4, 32.4, 36.6, 38.2, 40.2,
44.6, 44, 41.4, 39, 38.4, 33, 33.8, 39.2, 40.4, 37.8, 37.6, 36.4, 31, 30,
30.3333333333333]
// Locate dates when data shifted from 0 to a positive value
// NOTE: :Date refers to existing column name in data table ma_list was extracted from.
ma_date_list = {};
For( i = 2, i <= N Items( ma_list ), i++,
If ( ma_list[i] > 0 & ma_list[i-1] == 0,
// then
ma_date_list = :Date[ma_row_list]
)
);