This commit is contained in:
2024-11-21 17:48:22 +03:30
parent 70a373802d
commit 09fd3627c6
6 changed files with 1755 additions and 841 deletions
+17 -35
View File
@@ -43,7 +43,7 @@ input ENUM_BASE_CORNER corner = CORNER_RIGHT_LOWER; // Text Position
//
input group "Presentation";
input bool showCandleTime = true; // Show Candle Time
input bool showTimer = true; // Show Candle Time
//
// END Inputs ...
@@ -67,6 +67,7 @@ input bool showCandleTime = true; // Show Candle Time
//
// START Global Definitions: Variables, Properties and etc ...
//
bool isCreatedObject;
string tag;
//
// END Global Definitions: Variables, Properties and etc ...
@@ -86,16 +87,6 @@ int OnInit()
//
tag = ShortName + _Symbol + ToString(_Period);
//
if (showCandleTime)
{
CreateIndicatorObject();
}
else
{
ObjectDelete(0, tag);
}
//
// Set Indicator ShortName ...
SetIndicatorName();
@@ -145,21 +136,11 @@ int OnCalculate(
)
{
//
ArraySetAsSeries(time, true);
//
if (!showCandleTime)
if (!showTimer)
{
return rates_total;
}
//
ulong chID = FindChartID(
_Symbol,
_Period
//
);
//
XBarRemainsTime barRemains;
barRemains.Init(
@@ -191,20 +172,20 @@ int OnCalculate(
else if (mSpread < 100)
_sp = ".";
//
// int offset = TimeGMTOffset();
// string timeString =
// ", Time: " + string(TimeCurrent()) + "\n" +
// ", ServerTime: " + string(TimeTradeServer()) + "\n" +
// ", GMT Offset: " + (string)offset;
// timeString = timeString;
// Comment(timeString);
//
string objText = "Spread: " + IntegerToString(mSpread) + _sp + ", Next Bar in: " + msg;
//
ObjectSetString(0, tag, OBJPROP_TEXT, objText);
if (IsValid(tag) && !isCreatedObject)
{
CreateIndicatorObject();
}
//
if (isCreatedObject)
{
ObjectSetString(0, tag, OBJPROP_TEXT, objText);
}
//
return rates_total;
@@ -229,16 +210,17 @@ void SetIndicatorName()
void CreateIndicatorObject()
{
//
if (!showCandleTime)
if (!showTimer ||
!IsValid(tag))
{
return;
}
//
ObjectCreate(0, tag, OBJ_LABEL, 0, 0, 0);
isCreatedObject = 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);
ObjectSetInteger(0, tag, OBJPROP_YDISTANCE, 2);
//
ENUM_ANCHOR_POINT Anchor = ANCHOR_LEFT_UPPER;