Difference between revisions of "API Objects properties constants"

From NakedMarkets
Jump to navigation Jump to search
Line 30: Line 30:
=== Examples ===
=== Examples ===
C# code snippet :
C# code snippet :
<br><code>
<code>
DateTime SessionStart = new DateTime(CurrentDate.Year, CurrentDate.Month, CurrentDate.Day).AddHours(6); // Add 6 hours to the Current Date
<br>DateTime SessionStart = new DateTime(CurrentDate.Year, CurrentDate.Month, CurrentDate.Day).AddHours(6); // Add 6 hours to the Current Date
ObjectCreate("RectangleExample", ObjectType.OBJ_RECTANGLE, DateTime.MinValue, 0, DateTime.MinValue, 0); // Create a Rectangle with name "RectangleExample" and empty coordinates
<br>ObjectCreate("RectangleExample", ObjectType.OBJ_RECTANGLE, DateTime.MinValue, 0, DateTime.MinValue, 0); // Create a Rectangle with name "RectangleExample" and empty coordinates
ObjectSet("RectangleExample", ObjectProperty.OBJPROP_TIME1, SessionStart); // Set the X1 Value (OBJPROP_TIME1) to the SessionStart variable</code>
<br>ObjectSet("RectangleExample", ObjectProperty.OBJPROP_TIME1, SessionStart); // Set the X1 Value (OBJPROP_TIME1) to the SessionStart variable</code>

Revision as of 04:05, 5 January 2023

Summary

The Object type constants are used in graphical objects functions to set the property of the object

Definition

Constant name Description Type
ObjectProperty.OBJPROP_TIME1 Datetime value to set/get first coordinate time part (X1) DateTime
ObjectProperty.OBJPROP_PRICE1 Double value to set/get first coordinate price part (Y1) Double
ObjectProperty.OBJPROP_TIME2 Datetime value to set/get second coordinate time part (X2) DateTime
ObjectProperty.OBJPROP_PRICE2 Double value to set/get second coordinate price part (Y2) Double
ObjectProperty.OBJPROP_TIME3 Datetime value to set/get third coordinate time part (X3) DateTime
ObjectProperty.OBJPROP_PRICE3 Double value to set/get third coordinate price part (Y3) Double
ObjectProperty.OBJPROP_COLOR Color value to set/get object color Color
ObjectProperty.OBJPROP_STYLE Value is one of STYLE_SOLID, STYLE_DASH, STYLE_DOT, STYLE_DASHDOT, STYLE_DASHDOTDOT constants to set/get object line style int
ObjectProperty.OBJPROP_WIDTH integer value to set/get object line width int
ObjectProperty.OBJPROP_FONTSIZE Integer value to set/get font size for text objects int

Examples

C# code snippet :
DateTime SessionStart = new DateTime(CurrentDate.Year, CurrentDate.Month, CurrentDate.Day).AddHours(6); // Add 6 hours to the Current Date
ObjectCreate("RectangleExample", ObjectType.OBJ_RECTANGLE, DateTime.MinValue, 0, DateTime.MinValue, 0); // Create a Rectangle with name "RectangleExample" and empty coordinates
ObjectSet("RectangleExample", ObjectProperty.OBJPROP_TIME1, SessionStart); // Set the X1 Value (OBJPROP_TIME1) to the SessionStart variable