two questions. firstly I know I am probably missing something obvious here. I want to read in the current day candle at a set time in the morning, I have put the code in a strategy rather than the indicator as it was only a few lines. However, after about 3 months of back testing (this is the same even if I change the dates) suddenly I get an "out of range Error" when reading in the high.
1) am I missing something that is causing the error? its like the memory is being filled or something.
- Code: Select all
local daycandle = loadcandle(daycandle, selectedtime, "D1")
local i = core.findDate(daycandle, selectedtime, false);
if i == -1 then
return
end
top = daycandle.high[i];
bottom = daycandle.low[i];
-- fyi loadcandle from the proc
candles = host:execute("getHistory", 1, source:instrument(), "D1", math.floor(selectedtime), selectedtime, source:isBid());
2) finally when I run this in the Debugger the day candle returned is not the open day candle, for the time specified. but, the complete candle for the day. is there a better way of doing this to get the open candle at the time specified?
thanks