Specifically, I want to get data from Bollinger Bands and process them. In my code in the OnBarUpdate() method I can have statements of the type:
double bollLower = Bollinger(2,20).Lower[0];
double bollUpper = Bollinger(2,20).Upper[0];
which will get the lower and upper Bollinger Bands for the present bar for a standard deviation of 2 and a period of 20. That's all fine and well and works.
However, I want to get the standard deviation and period from the Bollinger Indicator that is attached to the chart together with my Indicator, rather than specifying them separately in my Indicator. If I include the statement:
Bollinger bollinger = new Bollinger();
at the top of my indicator class where the variables are declared, in order to create an instance of the Bollinger class, then in my OnBarUpdate() method I can include a statement like:
Print("Period = " + bollinger.Period.ToString());
which works and prints out the period. However, it only prints the default value of 14, regardless of how I set the period when the Bollinger Indicator is included in the chart.
The idea is to pass the standard deviation and period from the Bollinger Indicator to my call of it in my own Indicator. This is obviously much more convenient than having to set manually the values in my indicator to the Bollinger Indicator, and would be most grateful for some advice on this.
I am rather more familiar with Java than C#, so there is some confusion. Specifically I think of Bollinger (with a big "B") as being a class, and bollinger (with a small "b") as being an instance of the class.
Help in getting this issue resolved would be most appreciated.
csharp
Comment