Done

What is it?

The Done method is called when your custom strategy is disabled by the user. This is where you perform cleanup operations β€” like removing indicators, graph tools, and other elements that were created by your strategy.


Syntax

public Done(): void {
    // cleanup logic here
}

What Happens in Done

This method acts as a cleanup handler for your strategy. Here's what typically happens inside:

  • Remove any indicators created by the strategy

  • Clear any graph tools (trend lines, arrows, etc.)

  • Clean up any visual elements from the chart


Example

public Done() {
    // custom method to remove all graphical objects created by the strategy
    this.clearAllObjects();
    // custom method to remove all indicators created by the strategy
    this.clearAllIndicators();
    // custom method to close all open positions if needed
    this.closeAllPositions();
}

Why It Matters

  • Without proper Done, your strategy might leave unwanted elements on the chart

  • It ensures a clean slate when the strategy is disabled

  • Helps maintain chart clarity by removing unnecessary elements

Last updated