mechanik
New member
The thinkorswim docs don't give much about the sum function.. but in this code is the variable 'QQQtmp1' being iterated by the SUM function over the length of bars like a function?
Code:
def QQQprice = close(symbol="QQQ");
def QQQVolume = volume(symbol="QQQ");
def length = 21
def QQQtmp1 = if QQQprice > QQQprice[1] then QQQprice - QQQprice[1] else 0;
def QQQtmp2 = if QQQprice[1] > QQQprice then QQQprice[1] - QQQprice else 0;
def QQQd2 = Sum(QQQtmp1, length);
def QQQd4 = Sum(QQQtmp2, length);