Page 1 of 2

Time left indicator

PostPosted: Fri Apr 04, 2014 2:31 pm
by Alexander.Gettinger
The indicator shows the time remaining until the close of the last bar.

Time_Left.PNG


Download:
Time_Left.lua
(5.95 KiB) Downloaded 1729 times

Time_Left times three.lua
(7.33 KiB) Downloaded 771 times


MT4 version
https://fxcodebase.com/code/viewtopic.php?f=38&t=71500

Re: Time left indicator

PostPosted: Thu Sep 03, 2015 12:08 am
by FxLowe
Hi. Thanks for the indicator.

Just want to let you know that there's a bug. Because the indicator is based on the operating system's clock, it doesn't work with any computer that is not set to the same timezone as the server.

Thanks again.

Re: Time left indicator

PostPosted: Sun Sep 23, 2018 6:59 am
by Apprentice
The indicator was revised and updated.

Re: Time left indicator

PostPosted: Thu Nov 15, 2018 3:25 am
by Silverthorn
Hi Apprentice,

Would I please be able to have a version of this indicator that displays 3 times instead of one. Either side by side or one on top of the other so the inner is one time the middle is the time traded and the outer is a larger time..

For example I trade the m5 chart and would like to see the m1, m5 and H1 times displayed.

Hope you can help.

Cheers!!

Re: Time left indicator

PostPosted: Thu Nov 15, 2018 2:18 pm
by Apprentice
Time_Left times three added.

Re: Time left indicator

PostPosted: Thu Nov 15, 2018 6:34 pm
by Silverthorn
Awesome!! Thank you. :P

Re: Time left indicator

PostPosted: Wed Dec 12, 2018 10:05 pm
by Silverthorn
FxLowe wrote:Hi. Thanks for the indicator.

Just want to let you know that there's a bug. Because the indicator is based on the operating system's clock, it doesn't work with any computer that is not set to the same timezone as the server.

Thanks again.


To fix.

REPLACE

function now()
if __debug__hook ~= nil then
return core.host:execute("convertTime", core.TZ_EST, core.TZ_LOCAL, core.now());
else
return win32.currentTimeLocal();
end
end

WITH

function now()
return core.host:execute("convertTime", core.TZ_LOCAL, core.TZ_SERVER, win32.currentTimeLocal());
end

:D

Re: Time left indicator

PostPosted: Thu Dec 13, 2018 8:41 pm
by Silverthorn
Hi Apprentice,

I'm not understanding the way time is calculated in TS V Marketscope.

Two things have me puzzled.

Firstly the changes I used in the post above only work in Marketscope to correctly set the time to count down for a new Daily candle appearing on the chart for the local machine reguardless of display time settings.
MS Time.PNG


If you drag the same chart from Marketscope to TS the time to the end of the daily candle (Right Hand Clock) Changes from a count down to the next daily candle to a count down to 00.00 Server time again reguardless of local display time settings.
TS Time.PNG


Can you explain how Marketscope and TS treat time differently and how to correctly work with time for time based Indicators / Strats. I assume that Strats use the time from Marketscope?

I'm also Not Understanding how the Time/Date is treated by Strats and Indicators in relation to Hourly and Daily Candles. A new Daily candle forms at 00.00 Server Time but the hourly candles Do not change to the new date until 9 hrs later.

Time Dif.PNG


How is this treated for example when using a MVA based on D1 as a filter for a Strat running on a H1 time frame using Local time? Does the Strat calculate start of the daily period correctly for Daily at Local time or is the Server time used as with the chart display?

Thanks for your help.

Cheers,
Mark

Re: Time left indicator

PostPosted: Fri Dec 14, 2018 12:16 am
by Silverthorn
OK Previous fix does not work.

The Server time for MS is not the same as for TS. At least not in Australia. The other problem I had was overcoming the Daylight Saving offset because I live in a time zone where there is Daylight Saving but our State does not observe it putting me out by one hour. The previous did seem to overcome that but just simply does not work in any other time zone or in Market Scope.


So. A better solution for me in Queensland Australia is simply to and add an offset to UTC time in min. If you are in a timezone that has Daylight Saving and you observe it or no Daylight Saving at all I think win32.currentTimeLocal() would work better.

If Daylight Saving gives you hell.

ADD TO INIT

indicator.parameters:addInteger ("TIMESET", "TIME Offset", "Offset from UTC to Local Time in min.", 1);

REVISED NOW FUNCTION

function now()
local TIMESET = instance.parameters.TIMESET;
return win32.currentTimeUTC() - (TIMESET * 60 / 86400);
end

Re: Time left indicator

PostPosted: Fri Dec 14, 2018 1:01 pm
by Apprentice
Fixed.
Proposed solution is not correct as well.