Steve Johnson![]() New User Posts: 3 Joined: 4/29/2020 Location: Olathe, KS ![]() | I was researching the MT indicator and ran across your thread. At first I didn't think the indicator worked for smaller timeframes, but I did find that a function like SUM for 3 five min bars while in 15 min timeframe was indeed the same result as adding each of the 5 min bars within that 15 min bar. You are correct that the value returned for OLHCV is the last lower timeframe bar within the larger timeframe. Then it hit me to try this: MT(V[1],"5M",0) to get the previous 5 min bar. Unfortunately, OT didn't like that syntax and wouldn't compile. But wait! Wrap V[1] inside an indicator and maybe... ExtractV.txt #Indicator #Param "Barsback", 0 Dim mydata As single mydata = V[Barsback] Return mydata Then: MT(ExtractV(2),"5M",0) will give you the first 5 min volume bar from the 15 min bar. I tried to build an elegant solution where I could pass in the data type (OLHCV), bars to look back, lower timeframe number (e.g. -1) and # of lower timeframe bars covered by the current timeframe, but the ExtractV indicator would not work using variables in the MT formula. It just would not compile unless I inserted a simple number for the Barsback parameter. My only solution idea is a large select case structure for each data type and bar position. If you want to cover looking at say 5 min bars from a 60 min current timeframe, you need 12 select case statements for each data type you want to cover. Hopefully that gives you enough to continue your original idea. |