- Desktop
- Tools
- PASCAL Programming
- Triangle Example
Triangle Example
The following code is an example of how to create a triangle tool.
//// Sample script for Optuma tool scripting//
// This section is where variable are defined that need to be used in both the Init and Process proceduresvar Line1 : TLine; Line2 : TLine; Line3 : TLine;
// 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 changedprocedure DefineTool(Tool : TTool);begin Tool.Name := 'Triangle'; Tool.MouseClicks := 3; Tool.Hint := ''; Tool.ToolType := ttDrawing;end;
// Init is called to initialise the tool// This procedure is called once when the tool is added to a chartprocedure Init(Tool : TTool);begin Line1 := Tool.AddLine(); Line1.Color := clRed; Line2 := Tool.AddLine(); Line2.Color := clGreen; Line3 := Tool.AddLine(); Line3.Color := clBlue;end;
// 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 userprocedure Process(Tool : TTool; ProcessStart : Integer; ProcessEnd : Integer; DataIn : TDataList);begin Line1.P1.Date := Tool.MP[0].Date; Line1.P1.Price := Tool.MP[0].Price; Line1.P2.Date := Tool.MP[1].Date; Line1.P2.Price := Tool.MP[1].Price;
Line2.P1.Date := Tool.MP[1].Date; Line2.P1.Price := Tool.MP[1].Price; Line2.P2.Date := Tool.MP[2].Date; Line2.P2.Price := Tool.MP[2].Price;
Line3.P1.Date := Tool.MP[2].Date; Line3.P1.Price := Tool.MP[2].Price; Line3.P2.Date := Tool.MP[0].Date; Line3.P2.Price := Tool.MP[0].Price;end;Forum Discussion
Your privacy choices
We use cookies and similar technologies to make the site work, see how it's used, and improve it. Analytics and advertising cookies only run with your consent — see our Privacy Policy for details.