Reset()

View as Markdown

Definition

Resets the internal marker which is used for IsValidDataPoint() back to false. Calling the Reset() method is unique and can be very powerful for custom indicator development. Series\<t\> objects will always contain a value which is assigned, however calling Reset() simply means you effectively ignore the value of the current bar for plotting purposes. For calculation purposes you will want to use IsValidDataPoint() to ensure you are not calculating off of any reset values assigned by the Reset() method.

NameDescription
Series TypeValue after Reset()
Series<bool>false
Series<double>0.00
Series<datetime>DateTime.MinValue
Series<float>0
Series<int>0
Series<long>0
Series<string>null

Method Return Value

This method does not return a value.

Syntax

Reset()

Reset(int barsAgo)

Parameters

ParameterDescription
barsAgoAn int representing from the current bar the number of historical bars the method will check. If no barsAgo value is supplied, the current bar value will be reset instead (barsAgo 0).

Examples

1protected override void OnBarUpdate()
2{
3 // set MyPlot to Low of current bar minus 1 tick
4 MyPlot[0] = Low[0] - (1 * TickSize);
5
6 //reset MyPlot every 10 bars
7 if(CurrentBar % 10 == 0)
8 MyPlot.Reset();
9
10 // only calculate MyPlot value if it has not be reset
11 if(MyPlot.IsValidDataPoint(0))
12 Print(CurrentBar + " Value is: " + MyPlot[0]);
13}