TC2000.com• Download software • Tutorial videos • Subscription & data-feed pricing • Class schedule
TC2000Brokerage.com• New account application • Trading resources • Margin rates • Stock & option commissions
Worden Discussion Forum
RealCode for StockFinder 5.0
Minimize Sorting Time for an Indicator
How do I optimize the following indicator to only look at the last 500 bars, to minimize the time needed to sort?
Thank you... Dan
You won't be able to do anything to the code as the SMI indicator should have the '#Cumulative property since it is based on exponential moving averages. This means it will try to use all of the available data.
There are two ways to limit the amount of data used.
You can go to Settings | Data Manager and adjust the number of bars for the entire program.
You can edit the Block Diagram of an indicator to add a Length Limit Block to the Length Limit input of any Prices or Volume bars in a Block Diagram.
Unfortunately while you may be able to edit the Block Diagram for the RealCode Indicator (or possibly not), it technically isn't editable and such changes will not survive a program restart (you might have better luck editing the Block Diagram for the SMI indicator itself).
Building Your First 3 Block Diagrams (9:54)
Bruce, If I did not have SMI indicator in the indicator, could I limit the amount of data backtested?
Without a '#Cumulative indicator (or tag in the RealCode), a WatchList Column / sort will automatically try to minimize the amount of data used (usually drops to about 50 bars).
You can override the number of bars to use by adding something similar to the following between the Inherits and Public Overrides lines in the Class tab of the RealCode Editor (what to use instead of 20 is up to you):
NumOfBars = 20
The RealCode Programmers Reference covers this and more advanced techniques such as creating your own manual loops instead of using the autoloop in more detail.