You set up a technical analysis calculation by creating an instance of the corresponding class in the
// Create an exponential moving average
var myEma = new FXB.ta.EMA({period: 20});
// Create an RSI calculation
var myRSI = new FXB.ta.RSI({period: 14});
All calculations require initialisation with parameters, such as a
You can include a
var myEma = new FXB.ta.EMA({period: 20, data: [ … ]};
Parameters can be changed after a calculation has been created (rather than replacing the existing object with a new instance of the class). But changes do not take effect until/unless you completely re-load new data into the calculation. For example:
// Create EMA with period=20
var myEma = new FXB.ta.EMA({period: 20});
// Load data
myEma.LoadData( … );
// Change period parameter. Does not have any immediate effect.
myEma.period = 14;
// Values in the calculation do not change until after LoadData() is called again
myEma.LoadData( … );