Use a Controller object to add one of the tools to a chart:
const short = controller.addTool('RiskToRewardShort');
const long = controller.addTool('RiskToRewardLong');
The tools have an optional $ Trade
button, which can be enabled by setting the chartTradingButton
option to true
;
long.set('chartTradingButton', true);
Type
interface RiskToRewardLong {
emit(type: 'values', data: {
entry: number,
stopLoss: number,
takeProfit: number,
});
}
Details
The tools emit an event values
when the user clicks on the chartTradingButton
.
Example
// example usage:
long.on('values', (data) => {
console.log(data);
});
The tools do not have any public methods which need to be called.