Public Methods
This section outlines all the public methods for all the custom tool programming classes.
TDataArray = Variant;
TLineStyle = (Solid, DotDot, Dash, DashDot, LongDash, LongDashDot, LongDashDotDot, Stippled);
TToolItem = class
public
procedure OnProcess(); virtual;
end;
TPropertyObject = class
end;
TDataRow = Class(TMADataRow)
public
function HL: Double;
function HLC: Double;
function OHLC: Double;
function OC: Double;
function Median : Double;
property Open : Double read GetOpen write SetOpen;
property Close : Double read GetClose write SetClose;
property High : Double read GetHigh write SetHigh;
property Low : Double read GetLow write SetLow;
property Volume : Int64 read GetVolume write SetVolume;
property OI : Cardinal read GetOI write SetOI;
property Date : TDateTime read GetDate write SetDate;
property BarType : TBarType read GetBarType write SetBarType;
property HighTime : TDateTime read GetHighTime write SetHighTime;
property LowTime : TDateTime read GetLowTime write SetLowTime;
property Hidden : Boolean read GetHidden write SetHidden;
end;
TSwingRow = Class(TSwingDataRow)
public
property StartPrice : Double read GetStartPrice write SetStartPrice;
property StartDate : TDateTime read GetStartDate write SetStartDate;
property StartIndex : Double read GetStartIndex write SetStartIndex;
property EndPrice : Double read GetEndPrice write SetEndPrice;
property EndDate : TDateTime read GetEndDate write SetEndDate;
property EndIndex : Double read GetEndIndex write SetEndIndex;
property ConfirmPrice : Double read GetConfirmPrice write SetConfirmPrice;
property ConfirmDate : TDateTime read GetConfirmDate write SetConfirmDate;
property ConfirmIndex : Double read GetConfirmIndex write SetConfirmIndex;
property SwingDirection : Cardinal read GetSwingDirection write SetSwingDirection;
property PriceRet : Double read GetPriceRet write SetPriceRet;
property TimeRatio : Double read GetTimeRatio write SetTimeRatio;
property Hidden : Boolean read GetHidden write SetHidden;
end;
TDataList = class
public
procedure AssignDataList(DH : Pointer; aDataList : Pointer);
constructor Create();
destructor Destroy; override;
procedure InitDataHolder(iColCount, iRowCount : Integer);
procedure SetSize(iSize : Integer);
function DateToIndex(dtDate : TDateTime) : Integer;
function DateTimeToIndex(dtDate : TDateTime) : Double;
function IndexToDateTime(rIndex : Double) : TDateTime;
procedure ClearBarColors;
property DataArray : TDataArray read GetDataArray;
property Row[Index : Integer]: TDataRow read GetDataRow; default;
property Count : Integer read GetCount;
property BarColor[Index : Integer] : TColor read GetBarColor write SetBarColour;
end;
TSPDragType = (dtDragTime, dtDragPrice, dtDragAll, dtMovePrice, dtMoveTime, dtMoveAll, dtNone);
TSelectionPoint = class
public
constructor Create();
destructor Destroy(); override;
property Date : TDateTime read GetDate write SetDate;
property Price : Double read GetPrice write SetPrice;
property Idx : Double read GetIndex write SetIndex;
property DragType : TSPDragType read m_DragType write m_DragType;
property ShowInPropertiesPanel : Boolean read GetShowInProp write SetShowInProp;
end;
TPlotStyle = (Line, Dot, Histogram, Stepped, Shaded);
TPlot = class(TToolItem)
public
constructor Create();
destructor Destroy; override;
procedure Populate(sScript : String);
procedure Publish(sVarName : String);
property PlotStyle : TPlotStyle read GetPlotStyle write SetPlotStyle;
property LineStyle : TLineStyle read GetLineStyle write SetLineStyle;
property Color : TColor read GetColour write SetColour;
property FillColor : TColor read GetFillColour write SetFillColour;
property Width : Integer read GetLineWidth write SetLineWidth;
property Transparency : Integer read GetLineAlpha write SetLineAlpha;
property Count : Integer read GetCount;
property Visible : Boolean read GetVisible write SetVisible;
property Row[Index : Integer]: TDataRow read GetDataRow;
property BarColor[Index : Integer] : TColor read GetBarColor write SetBarColour;
property Data : TDataList read GetData write SetData;
property ShowInPropertiesPanel : Boolean read GetShowInProp write SetShowInProp;
property Caption : String read GetCaption write SetCaption;
property Selectable : Boolean read GetSelectable write SetSelectable;
property DisplayOrder : Integer read GetDisplayOrder write SetDisplayOrder;
end;
TSwingPlot = class(TToolItem)
public
constructor Create();
destructor Destroy; override;
procedure Populate(sScript : String; bDoFullProcess : Boolean = False);
procedure Publish(sVarName : String);
procedure CopyFrom(datalist : TSwingList);
property PlotStyle : TPlotStyle read GetPlotStyle write SetPlotStyle;
property LineStyle : TLineStyle read GetLineStyle write SetLineStyle;
property Color : TColor read GetColour write SetColour;
property FillColor : TColor read GetFillColour write SetFillColour;
property Width : Integer read GetLineWidth write SetLineWidth;
property Transparency : Integer read GetLineAlpha write SetLineAlpha;
property Count : Integer read GetCount;
property Visible : Boolean read GetVisible write SetVisible;
property Row[Index : Integer]: TSwingRow read GetDataRow;
property Data : TSwingList read GetData write SetData;
property ShowInPropertiesPanel : Boolean read GetShowInProp write SetShowInProp;
property Caption : String read GetCaption write SetCaption;
property Selectable : Boolean read GetSelectable write SetSelectable;
property DisplayOrder : Integer read GetDisplayOrder write SetDisplayOrder;
end;
TSymbolPosition = (spHigh=0, spLow, spTop, spBottom, spPrice);
TSymbols = class;
TSymbol = class
public
constructor Create();
destructor Destroy(); Override;
property Idx : Real read GetIndex write SetIndex;
Property Hint : String read GetHint;
property Date : TDateTime read GetDate write SetDate;
Property Price : Real read GetPrice write SetPrice;
Property SymbolPos : TSymbolPosition read GetPosition write SetPosition;
property SymbolSize : Integer read GetSymbolSize write SetSymbolSize;
property TextLayout : TTextLayout read GetLayout write SetLayout;
property Alignment : TAlignment read GetAlignment write SetAlignment;
end;
TTextAlignment = (alTopLeft, alTopCenter, alTopRight, alCenterLeft, alCenterCenter, alRightBottom, alLeftBottom, alCenterBottom, alCenterRight);
TSymbols = class(TToolItem)
public
constructor Create;
destructor Destroy; override;
function AddSymbol(iSymbol : Integer; dtDate : TDateTime; rPrice : Double) : TSymbol;
function AddSymbolByIndex(iSymbol : Integer; iIndex : Integer; rPrice : Double) : TSymbol;
function DateToIndex(dtDate: TDateTime) : Double;
procedure DeleteSymbol(aSymbol : TSymbol);
procedure ClearSymbols;
property SymbolSize : Integer read GetSymbolSize write SetSymbolSize;
property DisplayOrder : Integer read GetDisplayOrder write SetDisplayOrder;
property Alignment : TTextAlignment read GetAlignment write SetAlignment;
property Count : Integer read GetCount;
property Symbols[Index : Integer] : TSymbol read GetSymbol;
end;
T2DSymbols = class;
T2DSymbol = class
public
constructor Create();
property Idx : Real read GetIndex write SetIndex;
Property Hint : String read GetHint;
property Date : TDateTime read GetDate write SetDate;
Property Price : Real read GetPrice write SetPrice;
Property SymbolPos : TSymbolPosition read GetPosition write SetPosition;
end;
T2DSymbols = class(TToolItem)
public
constructor Create;
destructor Destroy; override;
function Add2DSymbol(sSymbol : String; dtDate : TDateTime; aPosition : TSymbolPosition = spTop) : T2DSymbol;
function Add2DSymbolByIndex(sSymbol : String; iIndex : Integer; aPosition : TSymbolPosition = spTop) : T2DSymbol;
function DateToIndex(dtDate: TDateTime) : Double;
procedure DeleteSymbol(aSymbol : T2DSymbol);
procedure ClearSymbols;
property DisplayOrder : Integer read GetDisplayOrder write SetDisplayOrder;
Property FontName : String read GetFont write SetFont;
Property FontSize : Integer read GetFontSize write SetFontSize;
Property FontColor : Integer read GetFontColour write SetFontColour;
property Count : Integer read GetCount;
property Symbols[Index : Integer] : T2DSymbol read GetSymbol;
end;
TDatePrice = record
Date : TDateTime;
Price : Double;
end;
TPriceLevel = class
public
property Color : TColor read GetColour write SetColour;
property Style : TLineStyle read GetStyle write SetStyle;
end;
TPriceLevels = class(TToolItem)
public
constructor Create();
destructor Destroy(); override;
property P1 : TSelectionPoint read m_P1 write m_P1;
property P2 : TSelectionPoint read m_P2 write m_P2;
property Color : TColor read GetColour write SetColour;
property Extend : Boolean read GetExtendAll write SetExtendAll;
property DisplayOrder : Integer read GetDisplayOrder write SetDisplayOrder;
property Levels[Index : Integer] : TPriceLevel read GetPriceLevel; default;
procedure OnProcess(); override;
function AddLevel(rPrice : Double) : TPriceLevel;
procedure RemoveLevel(rPrice : Double);
procedure ClearLevels;
end;
TEvents = class;
TEvent = class
public
constructor Create;
destructor Destroy; override;
property Color : TColor read GetColour write SetColour;
property Style : TLineStyle read GetStyle write SetStyle;
property Date : TDateTime read GetDate write SetDate;
end;
TEvents = class(TToolItem)
public
constructor Create;
destructor Destroy; override;
procedure OnProcess(); override;
function AddEvent(dtDate : TDateTime; aColour : TColor = clNone) : TEvent;
function AddEventByIndex(rIndex: Double; aColour : TColor = clNone) : TEvent;
procedure RemoveEvent(dtDate : TDateTime);
procedure AddRegion(dtDate1, dtDate2 : TDateTime; aColour : TColor = clNone);
procedure Clear;
procedure Delete(iIndex : Integer);
property P1 : TSelectionPoint read m_P1 write m_P1;
property P2 : TSelectionPoint read m_P2 write m_P2;
property Color : TColor read GetColour write SetColour;
property Extend : Boolean read GetExtendAll write SetExtendAll;
property FillTransparency : Integer read GetFillTrans write SetFillTrans;
property Items[Index : Integer]: TEvent read GetEvent; default;
property DisplayOrder : Integer read GetDisplayOrder write SetDisplayOrder;
end;
TLine = class(TToolItem)
public
constructor Create;
destructor Destroy; override;
procedure OnProcess(); override;
property P1 : TSelectionPoint read m_P1 write m_P1;
property P2 : TSelectionPoint read m_P2 write m_P2;
property Color : TColor read GetColour write SetColour;
property Width : Integer read GetWidth write SetWidth;
property Style : TLineStyle read GetStyle write SetStyle;
property Visible : Boolean read GetVisible write SetVisible;
property Transparency : Integer read GetTransparency write SetTransparency;
property Extend : Boolean read GetExtendAll write SetExtendAll;
property ExtendLeft : Boolean read GetExtendLeft write SetExtendLeft;
property ExtendRight : Boolean read GetExtendRight write SetExtendRight;
property Caption : String read GetCaption write SetCaption;
property ShowInPropertiesPanel : Boolean read GetShowInProp write SetShowInProp;
property DisplayOrder : Integer read GetDisplayOrder write SetDisplayOrder;
end;
TRectangle = class(Tline)
public
property FillColor : TColor read GetFillColour write SetFillColour;
property FillTransparency : Integer read GetFillTransparency write SetFillTransparency;
end;
TText = class(TToolItem)
public
constructor Create;
destructor Destroy; override;
property P1 : TSelectionPoint read m_P1 write m_P1;
Property FontName : String read GetFontName write SetFontName;
Property FontSize : Integer read GetFontSize write SetFontSize;
Property FontColor : Integer read GetFontColour write SetFontColour;
property Date : TDateTime read GetDate write SetDate;
property Price : Double read GetPrice write SetPrice;
property Idx : Double read GetIndex write SetIndex;
property Text : String read GetText write SetText;
property ShowInPropertiesPanel : Boolean read GetShowInProp write SetShowInProp;
property Alignment : TTextAlignment read GetTextAlignment write SetTextAlignment;
end;
TSToolType = (ttDrawing, ttDataList, ttDataView);
TLibrary = class;
TMPoint = record
sName : String;
rPrice : Double;
rDate : TDateTime;
rIndex : Double;
end;
TMPointArray = array of TMPoint;
THeadingProperty = class(THeadingVar)
public
m_Tool : TTool;
function AddHeading(sName, sCaption : String) : THeadingProperty;
function AddBoolean(sName, sCaption : String; bDefault : Boolean) : TBooleanProperty;
function AddInteger(sName, sCaption : String; iDefault : Integer) : TIntegerProperty;
function AddReal(sName, sCaption : String; iDefault : Real; bShowSpinControl : Boolean = False) : TRealProperty;
function AddList(sName, sCaption: String; sItems : String; iDefaultIndex: Integer) : TListProperty;
function AddColor(sName, sCaption: String; iDefault: TColor) : TColorProperty;
procedure AddLine(aLine : TLine);
procedure AddPlot(aPlot : TPlot);
procedure AddEvents(aEvents : TEvents);
procedure AddPriceLevels(aPriceLevels : TPriceLevels);
published
property Variable;
property Caption;
property Name;
property PropertyPanelHint;
property DisplayOrder : Integer read GetDisplayOrder write SetDisplayOrder;
end;
TTool = class
public
DataIn : TDataList;
MyLibrary : TLibrary;
ProcessStart, ProcessEnd : Integer;
constructor Create;
destructor Destroy; override;
function AddPlot(sFormula : String = '') : TPlot; overload;
function AddSelectionPoint(bVisible : Boolean): TSelectionPoint;
function AddLine() : TLine;
function AddHLine(rPrice : Double; clColor : TColor = clBlack) : TLine;
function AddVLine(dtDate : TDateTime; clColor : TColor = clBlack) : TLine;
function AddRectangle() : TRectangle;
function Add2DSymbols() : T2DSymbols;
function AddSymbols() : TSymbols;
function AddEvents() : TEvents;
function AddPriceLevels() : TPriceLevels;
function AddText(sText : String; dtDate : TDateTime; rPrice : Double) : TText;
function AddTextByIndex(sText : String; rIndex : Double; rPrice : Double) : TText;
function AddEphemeris() : TEphemeris;
function AddHeading(sName, sCaption : String) : THeadingProperty;
function AddBoolean(sName, sCaption : String; bDefault : Boolean) : TBooleanProperty;
function AddInteger(sName, sCaption : String; iDefault : Integer) : TIntegerProperty;
function AddReal(sName, sCaption : String; iDefault : Real; bShowSpinControl : Boolean = False) : TRealProperty;
function AddList(sName, sCaption: String; sItems : String; iDefaultIndex: Integer) : TListProperty;
function AddColor(sName, sCaption: String; iDefault: TColor): TColorProperty;
procedure ClearText;
property ShowInPropertiesPanel : Boolean read GetShowInPropertiesPanel write SetShowInPropertiesPanel;
procedure Reset();
procedure ReloadMousePoints();
function GetData(sScript : String): TDataList;
property Name : String read m_Name write m_Name;
property Hint : String read m_Hint write m_Hint;
property Key : String read m_Key write m_Key;
property ToolType : TSToolType read m_ToolType write m_ToolType;
property MouseClicks : Integer read m_MouseClicks write m_MouseClicks;
property MP[Index : Integer]: TSelectionPoint read GetSelectionPoint;
property Visible : Boolean read GetVisible write SetVisible;
end;
TLibrary = class
public
constructor Create(aTool : TTool);
destructor Destroy; override;
function FindDataList(sScript : String; DataIn : TDataList) : Integer;
function GetDataEx(iStart, iEnd : Integer; sScript : String; DataIn : TDataList): TDataList;
function GetData(sScript : String): TDataList;
procedure Reset();
property Tool : TTool read m_Tool write m_Tool;
end;
procedure DisplayMessage(Title, Msg : String; PauseSeconds : Integer = 0);
procedure Print(Msg : String);
function GetCurrentDir(): String;
const
varDouble = 5;