Symbols Example

Author: Optuma Team Last updated: Jan 23, 2024 09:00

The following code is an example of how to draw 3 symbols at different price points.

// Sample script for Optuma tool scripting
// This example draws three symbols at price 50, 51, and 55

// This section is where variable are defined that need to be used in both the Init and Process procedures
    Symbols : TSymbols;

// DefineTool is where the settings for the Tool are defined
// This procedure is called once when the tool is loaded
// Normally this procedure does not need to be changed
procedure DefineTool(Tool : TTool);
    Tool.Name := 'My Symbols';
    Tool.MouseClicks := 1;
    Tool.Hint := '';
    Tool.ToolType := ttDataList;

// Init is called to initialise the tool
// This procedure is called once when the tool is added to a chart
procedure Init(Tool : TTool);
    Symbols := Tool.AddSymbols();
    Symbols.SymbolSize := 24; // in pixels
    Symbols.AddSymbol(0,now(), 51); // image id, date, price
    Symbols.AddSymbol(5,now()-30, 55);
    Symbols.AddSymbol(3,now()-80, 50);

// Process is called to calculate and drawn the tool on screen
// This procedure is called when new data is received or loaded and
// when a selection point is moved by the user
procedure Process(Tool : TTool; ProcessStart : Integer; ProcessEnd : Integer; DataIn : TDataList);