Time / CurrentTime -

Questions about MultiCharts and user contributed studies.
HummerH1
Posts: 66
Joined: 13 Sep 2011
Has thanked: 6 times
Been thanked: 1 time

Time / CurrentTime -

Postby HummerH1 » 16 Dec 2011

Hello,

I want to get the current time of the bar, while my chart time is not my computer time.

CurrentTime is giving me the time of my computer
Time is giving me the time when the bar will close

That means that if I have a 15 mins chart, and now the time in my chart is 12:13, I want to be able to get this time.
'Time' will give me in this case 1215 and not 1213
'CurrentTime' will give me 19:13 and I can't do anything with that.

Any solution?

Thanks

User avatar
Henry MultiСharts
Posts: 8503
Joined: 25 Aug 2011
Has thanked: 1213 times
Been thanked: 2731 times

Re: Time / CurrentTime -

Postby Henry MultiСharts » 19 Dec 2011

You can add the second data series with smaller resolution like ticks or seconds and write in the script

Code: Select all

print (time_s data2);

HummerH1
Posts: 66
Joined: 13 Sep 2011
Has thanked: 6 times
Been thanked: 1 time

Re: Time / CurrentTime -

Postby HummerH1 » 19 Dec 2011

I did not really understand what do you mean.
I always use only one chart with one resolution.

How can I add data series?
Can you please give me an example or to direct me to a place when I can learn how to do that?

HummerH1
Posts: 66
Joined: 13 Sep 2011
Has thanked: 6 times
Been thanked: 1 time

Re: Time / CurrentTime -

Postby HummerH1 » 19 Dec 2011

Ok.
Ive managed to do it.

Just one question:
I have 2 graphs on my chart window.
One is 15 mins resolution, and one is 1 second resolution

When I do playback for backtesting, what option should I choose so as I can get the 1 sec chart data and the 15 also?
Last edited by HummerH1 on 19 Dec 2011, edited 1 time in total.

User avatar
TJ
Posts: 6584
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 970 times
Been thanked: 1907 times

Re: Time / CurrentTime -

Postby TJ » 19 Dec 2011

HummerH1 wrote:Ok.
Ive managed to do it.

Just one question:
I have 2 graphs on my chart window.
One is 15 mins resolution, and one is 1 second resolution

Can I fix the x absis to be 15 mins interval and not 1 sec?

if you don't want to see 2 chart windows, you can drag the 1 sec chart to the main chart window, then set it to invisible.
These users thanked the author TJ for the post:
JoshM

HummerH1
Posts: 66
Joined: 13 Sep 2011
Has thanked: 6 times
Been thanked: 1 time

Re: Time / CurrentTime -

Postby HummerH1 » 19 Dec 2011

How do I set it to invisible??

And what will happen in playback?? it will run it by 1 second also?

User avatar
TJ
Posts: 6584
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 970 times
Been thanked: 1907 times

Re: Time / CurrentTime -

Postby TJ » 19 Dec 2011

HummerH1 wrote:Hello,

I want to get the current time of the bar, while my chart time is not my computer time.

CurrentTime is giving me the time of my computer
Time is giving me the time when the bar will close

That means that if I have a 15 mins chart, and now the time in my chart is 12:13, I want to be able to get this time.
'Time' will give me in this case 1215 and not 1213
'CurrentTime' will give me 19:13 and I can't do anything with that.

Any solution?

Thanks

you can add an adjustment to currenttime_s to come up with the "current time" of the bar that you are looking for.

eg. there is a 5 hr difference between the time zones,

Code: Select all

input:
time.zone.adj(-50000);

var:
current.times(0);

current.times = currenttime_s + time.zone.adj;

HummerH1
Posts: 66
Joined: 13 Sep 2011
Has thanked: 6 times
Been thanked: 1 time

Re: Time / CurrentTime -

Postby HummerH1 » 19 Dec 2011

That's what I thought about but when I do playback for backtesting, my computer time doesn'e mean to me anything!!!!!!!!!!!!

So I was looking for another option.

The second series working on one sec seems to be a good idea. But Im trying to find out how I do backtesting with that.

User avatar
TJ
Posts: 6584
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 970 times
Been thanked: 1907 times

Re: Time / CurrentTime -

Postby TJ » 19 Dec 2011

HummerH1 wrote:That's what I thought about but when I do playback for backtesting, my computer time doesn'e mean to me anything!!!!!!!!!!!!

So I was looking for another option.

The second series working on one sec seems to be a good idea. But Im trying to find out how I do backtesting with that.

if you need to do playback, you will have to use the 2nd data series.

you won't be able to playback the 2nd data series at 1 second resolution.
you should try 1 minute.


on backtest (different from playback), you can use the tick data for precision backtest.

User avatar
TJ
Posts: 6584
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 970 times
Been thanked: 1907 times

Re: Time / CurrentTime -

Postby TJ » 19 Dec 2011

HummerH1 wrote:How do I set it to invisible??

...


right click on chart,

select Format Instrument

under Style tab

select Invisible Bars

HummerH1
Posts: 66
Joined: 13 Sep 2011
Has thanked: 6 times
Been thanked: 1 time

Re: Time / CurrentTime -

Postby HummerH1 » 19 Dec 2011

on backtest (different from playback), you can use the tick data for precision backtest.


On backtest (the one different from playback:) - I can test my signal using the 2 data series??

User avatar
TJ
Posts: 6584
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 970 times
Been thanked: 1907 times

Re: Time / CurrentTime -

Postby TJ » 19 Dec 2011

HummerH1 wrote:
on backtest (different from playback), you can use the tick data for precision backtest.


On backtest (the one different from playback:) - I can test my signal using the 2 data series??

Yes, it is called Backtesting Precision. You can select it in the Strategy Properties.

HummerH1
Posts: 66
Joined: 13 Sep 2011
Has thanked: 6 times
Been thanked: 1 time

Re: Time / CurrentTime -

Postby HummerH1 » 19 Dec 2011

Thanks. I have just check it :)

So bad I can't do it with the playback :(

And it would have been much easier if I could just call a function like CurrentTime, but giving the currenttime of the bar :-(

User avatar
TJ
Posts: 6584
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 970 times
Been thanked: 1907 times

Re: Time / CurrentTime -

Postby TJ » 19 Dec 2011

HummerH1 wrote:Thanks. I have just check it :)

So bad I can't do it with the playback :(

And it would have been much easier if I could just call a function like CurrentTime, but giving the currenttime of the bar :-(

1 second is a very fine resolution, that's a LOT of data;
probably you won't have the patience to sit through it.
Give 1 minute a try, that's 15 divisions over a 15 minute bar. I think it will give you plenty of workable data.

HummerH1
Posts: 66
Joined: 13 Sep 2011
Has thanked: 6 times
Been thanked: 1 time

Re: Time / CurrentTime - TradeTime

Postby HummerH1 » 20 Dec 2011

And what about TradeTime (_s)?

As far as i understand, it is the time of the chart, and it get updated each time the price market moves.

I use the time

1 . to make some calculation inside my starategies to see how many time pass between two actions. So It does seem to be a problem if I dont get updated when the market doesn't move

2 . To close trade 3 mins before end of trading day, or before financial announcement and stuff like that. Here I'm a little bit worried that the market won't move and my order will not be send.
But on the other hand it doesn't sound likely (to me) to happen .

What advice can you give me?
Is this way better that using 2 data series on my instrument or not?
What can be the incovenient or the problem I could meet?

Thanks for your help!

User avatar
TJ
Posts: 6584
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 970 times
Been thanked: 1907 times

Re: Time / CurrentTime - TradeTime

Postby TJ » 20 Dec 2011

HummerH1 wrote:And what about TradeTime (_s)?

As far as i understand, it is the time of the chart, and it get updated each time the price market moves.

I use the time

1 . to make some calculation inside my starategies to see how many time pass between two actions. So It does seem to be a problem if I dont get updated when the market doesn't move

2 . To close trade 3 mins before end of trading day, or before financial announcement and stuff like that. Here I'm a little bit worried that the market won't move and my order will not be send.
But on the other hand it doesn't sound likely (to me) to happen .

What advice can you give me?
Is this way better that using 2 data series on my instrument or not?
What can be the incovenient or the problem I could meet?

Thanks for your help!

TradeTime might be a solution.
I have not tried this new keyword.
If you are looking to exit a trade at the end of the day or before an announcement, you don't want to cut it too close. Therefore I would not recommend going down to the seconds level.

Regarding the market won't move and the order will not be send,
it depends on what instrument you are trading. Most of the financial related future contracts should be ok; they definitely trade more than one contract per second.
For stocks or agricultural products, etc., you just have to observe the volume behavior of each instrument.

HummerH1
Posts: 66
Joined: 13 Sep 2011
Has thanked: 6 times
Been thanked: 1 time

Re: Time / CurrentTime -

Postby HummerH1 » 21 Dec 2011

I'm trading on Emini S&P mostly.

For going out a trade, I do use minute precision (not seconds). So the market must be silent for a minute long at least... It doesn't seem likely to happen that much... But maybe in some cases...

So maybe for this, it's better using data series with minute interval?!
And for my other calculations, TradeTime_s can be good.

User avatar
TJ
Posts: 6584
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 970 times
Been thanked: 1907 times

Re: Time / CurrentTime -

Postby TJ » 21 Dec 2011

HummerH1 wrote:I'm trading on Emini S&P mostly.

For going out a trade, I do use minute precision (not seconds). So the market must be silent for a minute long at least... It doesn't seem likely to happen that much... But maybe in some cases...

So maybe for this, it's better using data series with minute interval?!
And for my other calculations, TradeTime_s can be good.

You should be fine...
ES has an average volume of 5,000 contracts per minute.

HummerH1
Posts: 66
Joined: 13 Sep 2011
Has thanked: 6 times
Been thanked: 1 time

Re: Time / CurrentTime -

Postby HummerH1 » 04 Jan 2012

TradeTime_s does not exist anyway.
And tradeTime has no value when not trading live.

So I've chosen the option with a second data series. Working good for me so far.

Thanks!!!!!!!!!!!
These users thanked the author HummerH1 for the post:
TJ

User avatar
TJ
Posts: 6584
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 970 times
Been thanked: 1907 times

Re: Time / CurrentTime -

Postby TJ » 04 Jan 2012

HummerH1 wrote:TradeTime_s does not exist anyway.
And tradeTime has no value when not trading live.

So I've chosen the option with a second data series. Working good for me so far.

Thanks!!!!!!!!!!!

Thanks for the update.


Return to “MultiCharts”