Birmingham UK
Experience: Intermediate
Platform: Sierrachart
Trading: ES, Forex, Currency Futures, Oil, Natural Gas
Frequency: Daily
Duration: Hours
Posts: 10 since Mar 2013
Thanks Given: 5
Thanks Received: 6
|
The zigzag study (code is in Studies7.cpp) has the option to display the length of time a line is drawn before a reversal occurs.
The time is always formatted as hh.mm.ss using the code below. I'd like to display only the amount of minutes the wave has taken. This is simple enough by changing the GetLength parameters. However, I primarily use tick charts and the time for a reversal can spread over several hours, what the function doesn't do is convert the total time into purely minutes. As an example, if the time taken was 1h 55 mins it would display as 01:55:00, what I want it to display is 115.
I hoping someone might be able to help recoding this as I'm struggling to understand what to change and where. Thanks in advance.
if (ShowZigZagDuration.GetYesNo())
{
if (BarLabelText.GetLength() != 0)
{
if (UseMultiLineLabels.GetYesNo())
BarLabelText += "\n";
else
BarLabelText += " ";
}
double ZigZagTimeSpan = 0;
if (sc.ChartDataType == INTRADAY_DATA)
{
if (ZigZagIndex < sc.ArraySize - 1)
ZigZagTimeSpan = (sc.BaseDateTimeIn[ZigZagIndex + 1] - sc.BaseDateTimeIn[BackRefIndex + 1]).GetAsDouble();
else
ZigZagTimeSpan = (sc.LatestDateTimeForLastBar - sc.BaseDateTimeIn[BackRefIndex + 1]).GetAsDouble();
}
else
{
ZigZagTimeSpan = (sc.BaseDateTimeIn[ZigZagIndex] - sc.BaseDateTimeIn[BackRefIndex + 1]).GetAsDouble();
}
SCString TimeDurationStr;
if (sc.ChartDataType == INTRADAY_DATA)
{
TimeDurationStr = sc.FormatGraphValue(ZigZagTimeSpan, 20);
if (TimeDurationStr.GetLength() >= 3 && TimeDurationStr[0] == '0' && TimeDurationStr[1] == '0' && TimeDurationStr[2] == ':')
TimeDurationStr = TimeDurationStr.GetSubString(TimeDurationStr.GetLength() - 3, 3);
}
SCString LengthStr;
LengthStr += TimeDurationStr;
BarLabelText += LengthStr;
|