Is there a need for this if (app._isCFDEnabled()) here?  It's evaluated above before adding the button. If the button were added and the toggle changed, this would actually cause an issue because the button would no longer work even though it would be displayed on the current chart.  It's an edge case to be sure, but I thought it worth mentioning.