PureBytes Links
Trading Reference Links
|
At 10:43 AM -0600 3/22/00, Randy Rehler wrote:
>Having been digging into this all morning, I've discovered a couple of things.
>
>1. Sess1EndTime (3pm = 1500) - 1 returns the value 1499, which is of
>course not a valid time value.
>
>2. If the data for the chart is missing in say the last 5 mins the
>function Time returns 831, if the last bar at 1500 is there and the
>1459 bar is missing the Time function returns 1500, so this tells me
>that the Time function returns the next bar time. Works the same with
>Close as well.
>
>3. If you pull up the data window and put the cursor on a missing bar
>you will get the correct time showing in the data window, so this
>tells me that TS can get the correct time info even if the bar is
>missing, but that the Time function doesn't access this data.
>
>So, I'm stumped. How do I do an accurate backtest if I can't get an
>accurate time on a bar with no data? Ideas, anyone?
Communications is most of the problem of these kinds of requests. It always takes several tries to understand what the person is really trying to ask...
Your example was 3:15 so I didn't bother to make it work for just any time. The following will get the arithmetic right and the > sign will make it true for any bar following one minute before the session end time:
if Time => MinutesToTime((TimeToMinutes(Sess1EndTime) - 1)) then
If you are just worried about backtesting and there is not a session 2, you might wait until the next day and then refer to the values of the previous bar:
if Date > Date[1] the Value1 = Open[1];
This sets Value1 equal to the open of the last bar of the previous day. and maybe you can work with that.
What to do about missing bars? You got me. You could be tricky and save the values of each bar up until the end of the day and then include code to use the last saved values before Date > Date[1] in case these are missing bars.
You seem to be really worried about getting the price of exactly the open of the exact last bar. Remember, this is just a simulation of what would have happened in the past with your system. The same thing will never happen in the future so why be so concerned about the price being a minute or two off?
Bob Fulks
|