Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I need a column inside a straight table, that can based on the EntryTime of the trade, tell me the starting time of the candle bar where the trade occurs.
Example: 8 minute bars, start counting bars from 3:30 PM
Trade: Entry Time: Starting time of Bar:
1 4/4/2017 5:04:00 PM 4:58 PM
2 4/18/2017 8:16:06 PM 8:10 PM
My session starts at 3:30PM (Field value), and based on the time-frame (8 minutes, 15 minutes, etc, also field value) it should tell you the start-time of the Bar that the trade belongs to.
For 8 min time-frame: First bar starts at 3:30 PM, then next at 3:38 PM, 3:46 PM, 3:54 PM,etc...
For 10 min time-frame: First bar starts at 3:30 PM, next 3:40 PM, 3:50 PM, etc..
For 13 min time-frame: First bar starts at 3:30 PM
Time-frame value comes from Time-frame field (8 min, 9 min, etc...)
Session start time comes from session field (3:30 PM, 8:30 AM, etc...)
This is currently how I have tried scripting it inside the straight table chart:
=time(floor(EntryTimeII,8/24/60)+maketime(0,2,0),'hh:mm:ss TT')
But it is not correct.
Is the timeframe decided before the reload, or is this something users will have the options to decide on the fly? If it is on the fly, then may be it makes sense to do all the calculation in the front end...
Your calculated dimension will look like this
=Time(Floor(StartTime) + Time(MakeTime(15, 30) + Floor(Frac(StartTime - MakeTime(15, 29, 59)), vTime/1440)))
Where vTime is determined by the selection you make in the input box's drop down....
Hi Sunny,
Yes, the time-frame will be changed in the front-end, so not only 8 min is applicable.
Also, the starting time needs to be changed in the front-end.
Currently, these come from Field-values (8min, 9min, 10min, etc..) and start-time (3:30 PM or 9:30 PM, etc...)
Just so I dont confuse:
There is a start time of the day where the bars are starting from, like 3:30 PM or 9:30 PM, and there are the particular starting times for each trade in the column StartTime.
Does Maketime(15,30) together with Maketime(15,29,59) indicate the 3:30 PM initial starting time?
So, I would suggest using the above mentioned technique... did you check it yet?
Hi Marco,
This is also working.
So, all I need is to change the '00:08' to select a different time-frame and 15:30 to select a different initial starting time?
What I have right now:
!
Does Maketime(15,30) together with Maketime(15,29,59) indicate the 3:30 PM initial starting time?
That is right
So what in here would like to change?
Yes, that would be all.
On the other hand, I noticed some rounding issues in this solution that might lead to unexpected behaviour, e.g. 3:54:00 PM being rounded off to 3:46:00 PM.
hope this helps nevertheless
Marco
So if I get my initial starting time (3:30 PM) from a Field, then I would need to split it into mins and sec, and also mm:ss - 1 sec or such?
Thats unfortunate, as your solution seemed so simple. No rounding errors are acceptable here