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
Time / CurrentTime -
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: Time / CurrentTime -
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);
Re: Time / CurrentTime -
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?
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?
Re: Time / CurrentTime -
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?
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.
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: Time / CurrentTime -
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.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?
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: Time / CurrentTime -
you can add an adjustment to currenttime_s to come up with the "current time" of the bar that you are looking for.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
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;
Re: Time / CurrentTime -
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.
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.
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: Time / CurrentTime -
if you need to do playback, you will have to use the 2nd data series.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.
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.
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: Time / CurrentTime -
right click on chart,How do I set it to invisible??
...
select Format Instrument
under Style tab
select Invisible Bars
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: Time / CurrentTime -
Yes, it is called Backtesting Precision. You can select it in the Strategy Properties.On backtest (the one different from playback:) - I can test my signal using the 2 data series??on backtest (different from playback), you can use the tick data for precision backtest.
Re: Time / CurrentTime -
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
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
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: Time / CurrentTime -
1 second is a very fine resolution, that's a LOT of data;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
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.
Re: Time / CurrentTime - TradeTime
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!
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!
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: Time / CurrentTime - TradeTime
TradeTime might be a solution.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!
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.
Re: Time / CurrentTime -
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.
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.
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: Time / CurrentTime -
You should be fine...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.
ES has an average volume of 5,000 contracts per minute.
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: Time / CurrentTime -
Thanks for the update.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!!!!!!!!!!!