Is it possible to prevent the timelineDay view of snapping resources to a full day (see image), as you can see the start/end time aren't exactly on day start/end but for some reason it gets snapped. (see the red line, it should end at 13:43)
I do not have the scheduler so I am not sure about this but have you looked into the slotDuration and snapDuration. Try setting them to a lower value. I believe the slotDuration default value is 30 minutes, it looks like you may need to set it to 1 minute if possible.
Related
I'm attempting to make an app that displays a different string based on the current time. It should display a different string every minute, synchronised to the apple watch's clock (ie when a new minute starts, replace the current string on the complication).
I have lots of issues with complications for the apple watch, i can see that lots of people find apple's documentation to be confusing.
I believe my implementation of getCurrentTimelineEntry is correct, as i simply grab the current date, floor it to the nearest minute (rounded down) and process it into the relevant string and stick it on the complication.
I do not understand for the life of me what the getTimelineEndDate method does, as no matter what i pass into the handler it seems to make no difference.
The most confusing part however is the getTimelineEntries method. I understand the concept, ie pre-fetching what the complication should look like. Here, i attempt to prefetch the next hour's worth of data, (in my case, 60 different entries representing 60 different minutes). This seems to work, however, the method runs 10 times before stopping, by which point it has pre fetched 600 entries, representing 10 minutes worth. This is unintended completely, however not disastrous. The worst part is that i have no idea how to fetch even more data in the future. IE, i want this method to be called on the last date of the last current entry, to fetch the next 10 minutes worth.
In essence, once these bugs have been fleshed out, i want to fetch 24 hours worth of entries (60*24 minutes). And then, when the current time matches the time of the last entry, fetch the next 24 hours, and so on.
I will be grateful for any help, as the documentation for clock kit complications are particular poor.
I know this has been asked before here, but Id like to extend the question further.
Lets say my entry price is 50, so at the start of the day I place a limit order bid 50 for 1 lot. During the trading day, the market collapses and I get filled on my bid. In a real world live trading scenario, my execution is going to be on the same daily bar at the price of 50. Even if I'm using 1 minute bars and that fill happens at 14:00 in real time, the data and prices at 14:01 are completely irrelevant to the trade and fill.
Furthermore, if I am already in a trade (lets say short # 50s), and I place a stop-loss order at 80s and the market trades up through the 80s - Im going to get stopped out then and there, around about the price of 80s give or take some slippage. The next bar, whether it be daily, hourly or 1 minute, may open up at 150. A backtest that is going to execute that trade on the open of the next bar is now potentially waaaay out of sync with what would have happened in a real time live scenario.
I understand that any strategy that calculates its trading signals based off a bar's close can be subject to huge biases without enforcing the next bar execution. But for strategies that have predefined entry/exit signals (which I feel is going to be the majority) the ability to execute on the same bar is crucial!
In the post linked above, Josh Ulrich mentioned adding allowMagicalThinking=TRUE to the calls to applyStrategy and applyRules. However, I cant seem to find any documentation on it, and my implementation of it hasnt had any effect. What am I missing?
Call to applyRules:
test <- applyRules(strategy=strategy.st,portfolio=portfolio.st, symbol = symbols, mktdata=mktdata , allowMagicalThinking=TRUE)
Alternatively, call to strategy:
out <- applyStrategy(strategy=strategy.st,portfolios=portfolio.st, allowMagicalThinking=TRUE)
allowMagicalThinking = TRUE causes execution to occur on the same observation as order entry. There is no way to force orders to be entered on the same observation as the signal that causes them.
If your signals really are pre-defined, you can include them in your mktdata object and shift them sufficiently so that execution occurs when you think it should.
I caution anyone who does this to double- and triple-check your results, because you're side-stepping almost all of quantstrat's built-in safeguards to avoid creating look-ahead bias in your backtests.
I have a box which has its own start time and starting conditions on other boxes. Say the box has a start time of 5:30 and has condition like s(a, 30)&s(b, 22)&s(c)
What will happen at 5:30 if all the conditions are not met?
Will the box trigger ever, when the conditions are met even after 5:30?
Box will stay INACTIVE until ALL the conditions (no matter date or starting) become true.
So at 5:30 it will be still INACTIVE if any of conditions is not met.
And yes, box will trigger when the conditions are met even after 5:30.
It looks like the jobs A and B have look back times set on them (that's the part after the name of the job and the comma), this will alter the behavior as outlined by the previous answer.
At 5:30a the box will kick off only if job A has reached success state within the previous 30 minutes and job B has reached success within the last 22 minutes. C must also be in success but with no specific look back interval.
If 5:30a comes around and job A went into success at 4:45a (more than 30 mins earlier) the box will not kick off. Same with job B at 22 minutes. If 5:30a comes around and job A and C are in success with job B still running (or in success from 22+ minutes earlier) the box will not kick off. If 6:01a comes around and job B goes into success the box will not run because the last success of A was 30+ minutes prior.
I hope this makes sense. I should add that I usually recommend against using a specific lookback time in favor of using a 0 lookback. This translates roughly as 'since the last time that I was used to kick you off'... But that being said, there are definitely cases where a specific lookback is appropriate. Without more information it's hard to determine if that is true in your case.
Box will stay INACTIVE until ALL off the conditions met.
So at 5:30 it will be still INACTIVE if any of conditions is not met.
And yes, box will trigger when the conditions are met even after 5:30.
And all job in Box will be in INACTIVE state, if job is independent to box and it met all conditions then this job be in running state.
As we know, when ever our clocks go 1h back (as they did on 29OCT at 2:00 in some countries) ending the DST period, every timestamp between 1:00 and 2:00 'occurs' twice.
How should an application working with future events handle this?
For example user creates a future event and specifies that it will take a place on 29OCT at 1:35.
And let's assume that standard local time is UTC+3 and the DST is UTC+4
How should the application convert this time to UTC? Should this time be considered as the first instance (before end of DST, which makes it 21:35 UTC) or the second instance (after end of DST, i.e. 22:35 UTC)?
Only you can decide that. It is largely based on context.
In many cases, the right thing to do is to choose the first of the two occurrences - which would be the daylight time. In your example, it would run at 1:35 in UTC+4.
You also need to consider the spring-forward transition. A recurring task that falls into the gap should usually be displaced by an amount equal to the DST bias (which is usually 1 hour). For example, if the clock jumps from 1:59:59.999 to 3:00, then a task scheduled to run at 2:30 would run at 3:30 on that day.
Again, only you can decide what is the right behavior for your application. Some applications may need the fall event to run at the standard time, or at both times. In the spring, they may want to run at the very next instant past the gap (3:00 in the above example, instead of 3:30) - or they may not want to run at all.
See also:
The DST Tag Wiki
How to store repeating dates keeping in mind Daylight Savings Time
Correct way to calculate recurring dates in C#
java Calendar, Date, and Time management for a multi-timezone application
Scheduled Jobs during hours of autumn time change
I am trying to build animation based on mathematical formulae(speed varying with time as per equations)- hence am charting x,y coordinates with formulae on user provider values, rather than inbuilt functions
In doing that, am struggling to get the timer right. for e.g if I set
timer=new timer(1),
object.x=object.x+1
the object doesn't zoom past screen within a second (or 600 milliseconds)- takes closer to 6-7 second to cover the 600 odd pixels. presume screen update doesnt work as fast as timer ticks
Is there a way for me to set up, such that I can predict speed on screen so animation takes abt 30 seconds?
Its better to use ENTER_FRAME listener and do animation there, based on current time (getTimer()).
Update: see getTimer() docs:
http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/utils/package.html#getTimer%28%29
Note the time when animation started. On each frame, subtract start time from current time. You get number of milliseconds passed. Compute coordinates/colors/rotations based on that number.