Last Works ...

This commit is contained in:
2024-11-15 20:03:39 +03:30
parent e0b2164515
commit eae679f78d
4 changed files with 418 additions and 71 deletions
+28 -18
View File
@@ -36,6 +36,8 @@
//
//
input int fontSize = 15; // Font Size
input string font = "Arial"; // Font
input color clr = clrYellow; // Text Color
input ENUM_BASE_CORNER corner = CORNER_RIGHT_LOWER; // Text Position
@@ -65,7 +67,7 @@ input bool showCandleTime = true; // Show Candle Time
//
// START Global Definitions: Variables, Properties and etc ...
//
string tag;
//
// END Global Definitions: Variables, Properties and etc ...
//
@@ -80,13 +82,18 @@ int OnInit()
{
//
// Validate Inputs ...
//
tag = ShortName + _Symbol + ToString(_Period);
//
if (showCandleTime)
{
CreateIndicatorObject();
}
else
{
ObjectDelete(0, ShortName);
ObjectDelete(0, tag);
}
//
@@ -114,16 +121,9 @@ void OnDeinit(const int reason)
// REASON_INITFAILED 8 The OnInit() handler returned a non-zero value
// REASON_CLOSE 9 Terminal closed
//
ulong chID = FindChartID(
_Symbol,
_Period
//
);
//
// Delete Object ...
ObjectDelete(chID, ShortName);
ObjectDelete(0, tag);
//
Comment("");
@@ -204,10 +204,7 @@ int OnCalculate(
string objText = "Spread: " + IntegerToString(mSpread) + _sp + ", Next Bar in: " + msg;
//
ObjectSetInteger(chID, ShortName, OBJPROP_COLOR, clr);
ObjectSetString(chID, ShortName, OBJPROP_TEXT, objText);
ObjectSetInteger(chID, ShortName, OBJPROP_FONTSIZE, 10);
ObjectSetString(chID, ShortName, OBJPROP_FONT, "Courier");
ObjectSetString(0, tag, OBJPROP_TEXT, objText);
//
return rates_total;
@@ -238,9 +235,9 @@ void CreateIndicatorObject()
}
//
ObjectCreate(0, ShortName, OBJ_LABEL, 0, 0, 0);
ObjectSetInteger(0, ShortName, OBJPROP_CORNER, corner);
ObjectSetInteger(0, ShortName, OBJPROP_XDISTANCE, 10);
ObjectCreate(0, tag, OBJ_LABEL, 0, 0, 0);
ObjectSetInteger(0, tag, OBJPROP_CORNER, corner);
ObjectSetInteger(0, tag, OBJPROP_XDISTANCE, 10);
ObjectSetInteger(0, ShortName, OBJPROP_YDISTANCE, 2);
//
@@ -262,7 +259,20 @@ void CreateIndicatorObject()
}
//
ObjectSetInteger(0, ShortName, OBJPROP_ANCHOR, Anchor);
int mFontSize = fontSize > 0
? fontSize
: 10;
//
string mFont = IsValid(font)
? font
: "Arial";
//
ObjectSetString(0, tag, OBJPROP_FONT, mFont);
ObjectSetInteger(0, tag, OBJPROP_COLOR, clr);
ObjectSetInteger(0, tag, OBJPROP_ANCHOR, Anchor);
ObjectSetInteger(0, tag, OBJPROP_FONTSIZE, mFontSize);
}
//