I'm looking for behavior of multiple time frames in strategies. The conditions are that bar sources are called and the strategy is using the lua.helper script.
I'm assuming that the ExtUpdate function is called whenever the smallest timeframe completes a candle. At that point if I do a compare like this:
- Code: Select all
if m15source.close[m15source.close:size() -1] > H1source.close[H1source.close:size() - 1] then
higher = true;
end
So there are four m15 bars for each H1 bar. When I make the comparison above for the first three m15 bars of the hour, does H1source.close[H1source.close:size() - 1] refer to the currently incomplete bar, or does it refer to the last fully complete bar in the price history? If size() - 1 refers to the currently open H1 bar when the first three m15 bars close, then each bar will have the same close and the condition will never be true.
And if size() - 1 always refers to the last fully complete bar, then is there a syntax to refer to a bar when it is not complete yet, if the ExtUpdate is called for a smaller time frame? (I don't have a specific example here, just looking for information.)