Posted this on Metastock forum but just in case: What I want do do is get a figure for the cumulative volume between a high that would have occurred up to 1250 periods ago and a low that would have occurred no more than 250 days ago. This is what would work ((Sum(V,HHV(HIGH,1250))) - (Sum(V,LLV(LOW,250)))) were it not for the fact that this gives the error message "this variable or expression must contain only constant data" This returns a value and would be OK ((Sum(V,1250)) - (Sum(V,250))) but for the fact that I don't know where the high/low will be for each stock and do not want to input it manually as I want this for an exploration. SO: is there a workaround for the fact that the Sum function will only handle a constant, or is there a completely dfferent way of returning the cumulative volume between a high that would have been no more than 1250 bars ago and a low that would have been no more than 20 periods ago in such a way that it can be used for an exploration? Thanks in advance for any help

Maybe this works: Sum(V, lastvalue(hhvbars(H,1250)+PREV-PREV)) - Sum(V, lastvalue(llvbars(L,250)+PREV-PREV))

Kut2K2, Thanks for reply, unfortunately it is returning results that in some cases look a bit off (e.g negative numbers). It seems that there is a workaround available in the form of a dll that will allow variables in the function, avalable here: http://forum.equis.com/viewtopic.php?t=1430 Thanks once again for your help. Very much appreciated.