Liquidity_Predator/Visualize/Boxes/M_CreateBox.mqh

24 lines
940 B
MQL5
Raw Permalink Normal View History

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);
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
}