persistable sclass TradingCandles extends NotifyingList { *() {} *(List *list) { super(list); } // how high a high is (lol) IntPair highLevel(int idx) { ret intPair(highLeft(idx), highRight(idx)); } int highLeft(int idx) { double high = get(idx).high(); for (int j = 1; j < idx; j++) if (get(idx-j).high() > high) ret j-1; ret idx; } int highRight(int idx) { double high = get(idx).high(); int n = size(); for (int j = 1; j < n-idx; j++) if (get(idx+j).high() > high) ret j-1; ret n-idx; } }