Calculation of total stocks with rising indicator

Hi, all

I am using True Strength Index(TSI) indicator in my charts. To know the total number of stocks with rising indicators, I use the following filter in exploration.

TSI > Ref(TSI,-1);

This gives me the list of stocks, along with the total count of stocks with rising indicators in the old Analysis. (In the New Analysis, only the list is given, without total count), for the day I select. With one run, I can know the count only for one day.

Now I want to have the count of stocks with rising TSI, datewise for the past 20 years, so that I can make a line chart. For this I have to run the exploration for each date running to... may be 5000 times.

Is there a way to calculate the count of stocks with rising TSI, datewise, for all the past periods. Can anybody help?

1 Like

@umrperumal, while there are alternative approaches, there is a dedicated function that allows you to create composites:


Be sure to read the documentation carefully and its linked additional explanations and references.

Once you have created your "artificial" ticker, you can easily plot it as you like (directly selecting such ticker or using it with the "Foreign()" functions).

Moreover, I suggest searching this forum for "addtocomposite" to learn some tips and about potential gotchas you may encounter using it.


Composites can be created not just with AddToComposite but also with

It is recommended to use StaticVarAdd as it offers better performance.

TSI = /*insert code for TSI*/;

if ( Status("action") == actionScan ) 
	if( status("stocknum") == 0 )
		 // remove any earier composite values

	StaticVarAdd( "~Composite_TSI", TSI > Ref(TSI,-1));
	Buy = 0;

// call result
composite = StaticVarGet( "~Composite_TSI" );

// code to output composite below...
// ....

thanks for the awesome information.

1 Like

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.