Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
I have an indicator that uses TotalSum() in its calculation, eg:
So on each bar it is plotting the total sum of the 1 bar average of myVar up to that point. This works as intended and I want to create a scan, however ToS does not allow aggregation functions like TotalSum() to be used in scans. So I am working on replacing TotalSum() with Sum() in a plot to confirm that it matches the indicator plot before creating a scan with it.
The issue with using Sum() is that it expects a constant for its length parameter. When I try to use code like:
I get the Thinkscript error "'BarNumber' can not be used here because of CL constant function parameter 'length'". How can we convert a variable number like BarNumber() into a constant for use in functions that expect them like Sum()?