I have a simple desire to wait until market close, get the updated daily indicators based on the closing price, and seek to buy in after hours trading. I have created the attached project with only RSI to illustrate my issues.

  1. Daily Indicators Update @ 4AM the following day? - When using the helper function RSI(), the indicator doesn't seem to update at 4pm on market close... Or at any time later in after hours trading (even though I have enabled extended hours trading data at the second resolution when adding my security). Instead, it updates at 4am the following morning. I want to trade in the AH market with the indicator updated based on the closing price. Am I doing something wrong or is this how it works?
  2. In extended market hours I have proven that my OnData function appears to be called randomly after 4pm rather than every second. Take a look at some data below from a similar project to the attached that was restricted to outputting a log message at the first available opportunity after 4pm. Even though the security data resoluion was set to second, the first execution of the loop return varied from 16:00:05 all the way to 16:11:00. Is there an explanation for this? I would expect every trading day where data was being fed to OnData to trigger within a second of the same time (ie. 16:00:05 or 16:00:06). Having an apparent random variance of up to 11 minutes on second data is a significant incongruity. Interestingly the apparently random times remained consistent when backtesting different overlapping date ranges. (See brief log output data showing these results posted below).
  3. After Hours Orders - I had quite a bit of trouble with after market hours orders and I would like to understand how to place them so they can execute effectively. At first, my orders were being queued but never filled. I guessed it must be my brokerage model, so I set that to default. Then I started executing limit orders quite far outside what I understood the current aftermarket price to be. Sometimes these orders would execute, but other times they would not. If I am trading a very liquid security / ETF such as XIV, what is the best way to me to effectively place a buy order in After Market hours at the "current" price?

Please note that I am using Resolution.Second data with after hours data enabled.

Log output testing AH first OnData() call issue. The first available OnData() execution cycle after 4:00pm market close appears to be random. Additionally you can see the RSI update varies up to 2 hours from 4am - 6am every morning. I don't understand why. Please help! Thanks in advance. =)

2016-03-01 00:00:00 Launching analysis for b592bfb6498af4ca953757aa4eb5c4c7 with LEAN Engine v2.3.0.2.1318 2016-02-29 04:00:01 Algorithm warming up... 2016-03-01 00:00:00 Algorithm finished warming up. 2016-03-01 06:01:32 OnRSIUpdate() 2016-03-01 16:11:01 Time: 03/01/2016 16:11:00 2016-03-02 04:00:01 OnRSIUpdate() 2016-03-02 16:00:40 Time: 03/02/2016 16:00:39 2016-03-03 04:00:01 OnRSIUpdate() 2016-03-03 16:05:17 Time: 03/03/2016 16:05:16 2016-03-04 04:00:01 OnRSIUpdate() 2016-03-04 16:00:20 Time: 03/04/2016 16:00:19 2016-03-07 04:00:01 OnRSIUpdate() 2016-03-07 16:00:44 Time: 03/07/2016 16:00:43 2016-03-08 06:03:24 OnRSIUpdate() 2016-03-08 16:02:20 Time: 03/08/2016 16:02:19 2016-03-09 05:00:27 OnRSIUpdate() 2016-03-09 16:02:30 Time: 03/09/2016 16:02:29 2016-03-10 04:07:37 OnRSIUpdate() 2016-03-10 16:03:56 Time: 03/10/2016 16:03:55 2016-03-11 05:13:10 OnRSIUpdate() 2016-03-11 16:02:56 Time: 03/11/2016 16:02:55 2016-03-14 04:25:40 OnRSIUpdate() 2016-03-14 16:03:14 Time: 03/14/2016 16:03:13 2016-03-15 06:46:34 OnRSIUpdate() 2016-03-15 16:01:02 Time: 03/15/2016 16:01:01 2016-03-16 05:06:20 OnRSIUpdate() 2016-03-16 16:00:39 Time: 03/16/2016 16:00:38 2016-03-17 04:00:01 OnRSIUpdate() 2016-03-17 16:00:11 Time: 03/17/2016 16:00:10 2016-03-18 04:08:23 OnRSIUpdate() 2016-03-18 16:00:06 Time: 03/18/2016 16:00:05 2016-03-19 00:00:00 Algorithm Id:(b592bfb6498af4ca953757aa4eb5c4c7) completed in 9.46 seconds at 39k data points per second. Processing total of 367,160 data points.