Strategy bar stream timing with multiple time frames

Section for all discussions related to development using Indicore API/SDK.

Moderator: admin

Strategy bar stream timing with multiple time frames

Postby tllewell » Sat Nov 03, 2012 11:57 am

Pardon me if this has come up before and been answered. I tried searching for an answer but there are too many variables to do a good search.

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.)
tllewell
 
Posts: 76
Joined: Thu Mar 01, 2012 4:06 pm

Re: Strategy bar stream timing with multiple time frames

Postby tllewell » Tue Nov 06, 2012 2:19 pm

Ran my own test and the condition is never true; the two prices are always the same. So, size() - 1 on a longer time frame refers to an incomplete bar when a shorter time frame is operating.
tllewell
 
Posts: 76
Joined: Thu Mar 01, 2012 4:06 pm


Return to Discussions

Who is online

Users browsing this forum: No registered users and 2 guests