You can explicitly define the lookback period when you initialize your DataSeries values in #init:
Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.
Need help? 1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first. 2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses. 3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make. 4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance. 5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers. 6) Help using the forum? Watch this video to learn general tips on using the site.
If you want to support our community, become an Elite Member.
NT 6.5. is a memory hog, so NT developpers looked for ways to make NT 7 leaner. One way was to reduce the memory required to store data series.
Let us assume you define a new DataSeries with the name Dirty via private DataSeries Dirty. Within the code of your indicator, you only set a value from time to time, say for a zigzag you only set a value when a new high or low is made. Then you try to access the DataSeries also for those values that have not been set correctly.
In this case:
NT 6.5. has written a default value to all fields of the DataSeries, so if you have not set a value, it returns the default value.
NT 7.0 (TwoHundredFiftySix) does not write any default values, but reserves the storage space required for 256 fields. If you access any fields that you have not set, NT7 returns random values from those stored in the array containing the 256 values.
NT 7.0 (Infinite) will only reserve storage space, if values are actually set, so if you do not set the values properly and try to access them, it may return you an out-of-range exception.
Many indicators do not need to access more than 256 fields. However, there is a major problem with this. If you scroll back your chart horizontally more than 256 bars or if you access any bars prior to the last 256 bars, you may get false values returned.
Example: FibCluster Indicator V1.3
This indicator uses 192 DataSeries and 40 DateTimeSeries. Now if you put this on a 1 min chart with a lookback period of 100 days, you will have about 70 days of data with 1425 bars each. The RAM required to store the full DataSeries and DateTimeSeries would be 70 x 1425 x 232 x 8 Bytes = 185 MBytes. With the default setting TwoHundredFiftySix the RAM needed will be reduced to less than half a Mbyte....
But if you want to scroll back a bit, or if you need to access any values that are back more than 256 bars, then you should set the DataSeries to MaximumBarsLookBack.Infinite. You can either change the global setting for the indicator via the indicator menu (affects all DataSeries used by the indicator), or you can do this selectively through the indicator code, as suggested by Mike in his post above.
The following user says Thank You to Fat Tails for this post:
My indi redraw candles from A to Z and the 257th candle comes very fast when you scroll back a tick chart ...... Looking good now...
open = new DataSeries(this,MaximumBarsLookBack.Infinite);
high = new DataSeries(this,MaximumBarsLookBack.Infinite);
low = new DataSeries(this,MaximumBarsLookBack.Infinite);
close = new DataSeries(this,MaximumBarsLookBack.Infinite);
zeLine = new DataSeries(this,MaximumBarsLookBack.Infinite);
Last edited by AkLio; April 25th, 2010 at 07:35 PM.