2026-02-16 18:37:16 +01:00
|
|
|
bool M_CreateBox(string name, int BoxNr, datetime time1, datetime time2, double high, double low, color clr)
|
2026-02-12 16:16:26 +01:00
|
|
|
{
|
2026-02-12 17:09:03 +01:00
|
|
|
string Fullname = name + IntegerToString(BoxNr);
|
2026-02-16 19:36:15 +01:00
|
|
|
ResetLastError();
|
|
|
|
|
ObjectCreate(0, Fullname, OBJ_RECTANGLE, 0, time1, low, time2, high);
|
2026-02-16 18:37:16 +01:00
|
|
|
ObjectSetInteger(0, Fullname, OBJPROP_COLOR, clr);
|
2026-02-12 17:09:03 +01:00
|
|
|
ObjectSetInteger(0, Fullname, OBJPROP_STYLE, STYLE_SOLID);
|
|
|
|
|
ObjectSetInteger(0, Fullname, OBJPROP_WIDTH, 2);
|
|
|
|
|
ObjectSetInteger(0, Fullname, OBJPROP_BACK, true); // behind candles
|
|
|
|
|
ObjectSetInteger(0, Fullname, OBJPROP_RAY_RIGHT, false);
|
|
|
|
|
ObjectSetInteger(0, Fullname, OBJPROP_RAY_LEFT, false);
|
|
|
|
|
ObjectSetInteger(0, Fullname, OBJPROP_FILL, true); // fill
|
|
|
|
|
|
2026-02-12 17:44:40 +01:00
|
|
|
if(GetLastError() != 0)
|
|
|
|
|
{
|
|
|
|
|
M_LogError("An error occured when creating box " + Fullname + ", Error: " + IntegerToString(GetLastError()));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
M_LogInfo("Box " + Fullname + " created");
|
|
|
|
|
}
|
2026-02-12 17:09:03 +01:00
|
|
|
|
|
|
|
|
return true;
|
2026-02-12 16:16:26 +01:00
|
|
|
}
|