How to check the time of last data value

Questions about MultiCharts and user contributed studies.
martingale
Posts: 79
Joined: 10 Dec 2010
Has thanked: 2 times
Been thanked: 1 time

How to check the time of last data value

Postby martingale » 23 Sep 2012

I have 2 data coming into the signal and they may not be sync.

is there a time function to get the time of the last data to check if the arrival time of 2 last data are equal?

e.g

Code: Select all

input:
         x1 ( close of data1 ),
         x2 ( close of data2 );

     if time_of_data( x1 ) =  time_of_data( x2 )  then
        ......

     end;

User avatar
Henry MultiСharts
Posts: 8479
Joined: 25 Aug 2011
Has thanked: 1211 times
Been thanked: 2719 times

Re: How to check the time of last data value

Postby Henry MultiСharts » 24 Sep 2012

Hello Martingale,

Have you tried to use Time or Time_s in your code ?
Time - Returns a numerical value indicating the closing time of the current bar. The time is indicated in the 24-hour HHmm format, where 1300 = 1:00 PM.
Time s - Returns a numerical value indicating the closing time, including seconds, of the current bar. The time is indicated in the 24-hour HHmmss format, where 130000 = 1:00:00 PM.

martingale
Posts: 79
Joined: 10 Dec 2010
Has thanked: 2 times
Been thanked: 1 time

Re: How to check the time of last data value

Postby martingale » 24 Sep 2012

Henry MultiСharts wrote:Hello Martingale,

Have you tried to use Time or Time_s in your code ?
Time - Returns a numerical value indicating the closing time of the current bar. The time is indicated in the 24-hour HHmm format, where 1300 = 1:00 PM.
Time s - Returns a numerical value indicating the closing time, including seconds, of the current bar. The time is indicated in the 24-hour HHmmss format, where 130000 = 1:00:00 PM.


right, Time and Time_s are current time, what if I want to know the time of last tick or second data i received, assume I may not have data on every tick or second.

User avatar
Henry MultiСharts
Posts: 8479
Joined: 25 Aug 2011
Has thanked: 1211 times
Been thanked: 2719 times

Re: How to check the time of last data value

Postby Henry MultiСharts » 25 Sep 2012

Time and Time_s are the last bar's timestamps.
Computer's current time is returned by CurrentTime and CurrentTime_s.

If you need to compare the last tick with the previous one - you need to remember the last tick's time/volume/price for each instrument and then compare the new ticks's value. Time/ Volume and/or price should be changed with the new tick.

martingale
Posts: 79
Joined: 10 Dec 2010
Has thanked: 2 times
Been thanked: 1 time

Re: How to check the time of last data value

Postby martingale » 25 Sep 2012

Henry MultiСharts wrote:Time and Time_s are the last bar's timestamps.
Computer's current time is returned by CurrentTime and CurrentTime_s.

If you need to compare the last tick with the previous one - you need to remember the last tick's time/volume/price for each instrument and then compare the new ticks's value. Time/ Volume and/or price should be changed with the new tick.


that's what I'm trying to get.
let's say I have 2 data input in my signal, how do I get them for each data.
Time_s( data1 ), Time_s(data2)?
or you actually mean I can only take Time_s on the tradeable data isn't it.

User avatar
Henry MultiСharts
Posts: 8479
Joined: 25 Aug 2011
Has thanked: 1211 times
Been thanked: 2719 times

Re: How to check the time of last data value

Postby Henry MultiСharts » 26 Sep 2012

Add this signal to your chart with two data series and check the PowerLanguage editor output.

Code: Select all

print (time_s, "  ", time_s of data2);

Also see post #5
viewtopic.php?f=16&t=6929


Return to “MultiCharts”