Time left indicator

Here you can post and download custom indicators. PLEASE: Do not start topics unless you are posting your own indicator, they will be moved to appropriate section even if you do.

Moderator: admin

Time left indicator

Postby Alexander.Gettinger » Fri Apr 04, 2014 2:31 pm

The indicator shows the time remaining until the close of the last bar.

Time_Left.PNG


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

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


MT4 version
https://fxcodebase.com/code/viewtopic.php?f=38&t=71500
Alexander.Gettinger
FXCodeBase: Confirmed User
 
Posts: 3785
Joined: Wed Mar 31, 2010 9:40 pm
Location: Russia, Omsk

Re: Time left indicator

Postby FxLowe » Thu Sep 03, 2015 12:08 am

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.
FxLowe
 
Posts: 4
Joined: Mon Apr 27, 2015 11:37 am

Re: Time left indicator

Postby Apprentice » Sun Sep 23, 2018 6:59 am

The indicator was revised and updated.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36341
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Time left indicator

Postby Silverthorn » Thu Nov 15, 2018 3:25 am

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!!
User avatar
Silverthorn
 
Posts: 69
Joined: Fri Nov 08, 2013 12:29 am
Location: Brisbane Australia

Re: Time left indicator

Postby Apprentice » Thu Nov 15, 2018 2:18 pm

Time_Left times three added.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36341
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Time left indicator

Postby Silverthorn » Thu Nov 15, 2018 6:34 pm

Awesome!! Thank you. :P
User avatar
Silverthorn
 
Posts: 69
Joined: Fri Nov 08, 2013 12:29 am
Location: Brisbane Australia

Re: Time left indicator

Postby Silverthorn » Wed Dec 12, 2018 10:05 pm

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
User avatar
Silverthorn
 
Posts: 69
Joined: Fri Nov 08, 2013 12:29 am
Location: Brisbane Australia

Re: Time left indicator

Postby Silverthorn » Thu Dec 13, 2018 8:41 pm

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
User avatar
Silverthorn
 
Posts: 69
Joined: Fri Nov 08, 2013 12:29 am
Location: Brisbane Australia

Re: Time left indicator

Postby Silverthorn » Fri Dec 14, 2018 12:16 am

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
User avatar
Silverthorn
 
Posts: 69
Joined: Fri Nov 08, 2013 12:29 am
Location: Brisbane Australia

Re: Time left indicator

Postby Apprentice » Fri Dec 14, 2018 1:01 pm

Fixed.
Proposed solution is not correct as well.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36341
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Next

Return to Custom Indicators

Who is online

Users browsing this forum: No registered users and 40 guests