you have to cast the Indicator member variable to BollingerBands:

member variable:
private final Indicator bollingerInd;

Strategy class constructor:
bollingerInd = new BollingerBands(getParam(BOLLI_PERIOD), 2);
addIndicator(bollingerInd);

in method onBookSnapshot():
-> here is the cast:
double lowerBand = ((BollingerBands)bollingerInd).getLowerBand();
double upperBand = ((BollingerBands)bollingerInd).getUpperBand();

I hope that helps :-)

On Sep 7, 12:11 pm, Javier <[email protected]> wrote:
> I'm experimenting with BollingerBands indicator but I only can get the
> SD inside onBookSnapshot() method. From indicator comments I can read
> this information:
>
>  * However, to obtain the Bollinger Bands, use the methods below:
>  * getMidpoint() -- this returns the midpoint of the BollingerBands
>  * getUpperBand(), getLowerBand -- these return the upper and lower
> Bollinger Bands.
>
> Do you know how can I call these methods to obtain upper and lower
> bands inside onBookSnapshot()?
>
> Thank you

-- 
You received this message because you are subscribed to the Google Groups 
"JBookTrader" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jbooktrader?hl=en.

Reply via email to